From cd4f4ebb6bae9e7b7d8ffb334d0ea1c8c90978f0 Mon Sep 17 00:00:00 2001 From: memdmp Date: Sun, 12 Jan 2025 04:02:27 +0100 Subject: feat: describe the font's pattern --- patterns/font.hexpat | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 patterns/font.hexpat (limited to 'patterns/font.hexpat') 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 { + u8 columns[width - 1] [[name("Row"), inline]]; +}; +struct ImageData { + PixelRow 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 imageData[width] [[name("Content")]]; +}; + +CharBmp charbmp @ 0x00 [[name("CharBmp")]]; -- cgit v1.2.3