diff options
Diffstat (limited to 'patterns')
-rw-r--r-- | patterns/font.hexpat | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/patterns/font.hexpat b/patterns/font.hexpat new file mode 100644 index 0000000..4a6a8c4 --- /dev/null +++ b/patterns/font.hexpat @@ -0,0 +1,34 @@ +#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; + +struct PixelRow<auto width> { + u8 columns[width - 1] [[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. */ + float advance_width [[name("Offset"), comment("Indicates the offset of the character's drawn data, in pixels"), color("99aaff")]]; + /** Table of contents entries */ + ImageData<width> imageData[width] [[name("Content")]]; +}; + +CharBmp charbmp @ 0x00 [[name("CharBmp")]]; |