aboutsummaryrefslogblamecommitdiffstats
path: root/patterns/font.hexpat
blob: b1ebe61a8b6b1cad0f28d4f02f9b206d6883002f (plain) (tree)
1
2
3
4
5
6
7
8
9








                                                                      
                                     
                             
                                            



                                                                         
  












                                                                                                                              
                                                                                                                                   
                                  
                                                            


                                           
#pragma author memdmp
#pragma description Character Bitmap (.charbmp) file format, version 1

#pragma endian little
#pragma pattern_limit 4294967295

import std.sys;
import type.magic;

/* doesnt work idk why imhex is dying
struct PixelRow<auto width> {
  u8 columns[width] [[name("Row"), inline]];
};
struct ImageData<auto width> {
  PixelRow<width> rows[while(!std::mem::eof())] [[name("Rows"), inline]];
};
*/
struct Offset {
  /** The X Offset of the character */
  s32 x [[name("X"), comment("The X offset of the character's pixel data"), color("ff99ff")]];
  /** The Y Offset of the character */
  s32 y [[name("Y"), comment("The Y offset of the character's pixel data"), color("ffff99")]];
};

struct CharBmp {
  /** The width of each line of the drawn character */
  u8 width [[name("Width"), comment("Indicates the width of the character's drawn data, in pixels"), color("ff44aa")]];
  /** The width of each line of the drawn character */
  Offset offset [[name("Offset"), comment("Indicates the offset of the character's drawn data, in pixels"), color("cc99bb")]];
  /** The horizontal offset that the origin of the next glyph should be from the origin of this glyph. */
  s32 advance_width  [[name("Offset"), comment("Indicates the offset of the character's drawn data, in pixels"), color("99aaff")]];
  /** Table of contents entries */
  u8 imageData[while(!std::mem::eof())] [[name("Content")]];
};

CharBmp charbmp @ 0x00 [[name("CharBmp")]];