aboutsummaryrefslogtreecommitdiffstats
path: root/patterns
diff options
context:
space:
mode:
authorLibravatarLarge Libravatar memdmp <memdmpmemewarenet>2025-01-12 04:02:27 +0100
committerLibravatarLarge Libravatar memdmp <memdmpmemewarenet>2025-01-12 04:02:27 +0100
commitcd4f4ebb6bae9e7b7d8ffb334d0ea1c8c90978f0 (patch)
tree664e686252071c159c7a7f8d213c5d9a4f31042d /patterns
parent424e0e328d9b7ffbb6669d67b034324b48ea777c (diff)
downloadcosin25-invite-mountainbytes-cd4f4ebb6bae9e7b7d8ffb334d0ea1c8c90978f0.tar.gz
cosin25-invite-mountainbytes-cd4f4ebb6bae9e7b7d8ffb334d0ea1c8c90978f0.tar.bz2
cosin25-invite-mountainbytes-cd4f4ebb6bae9e7b7d8ffb334d0ea1c8c90978f0.tar.lz
cosin25-invite-mountainbytes-cd4f4ebb6bae9e7b7d8ffb334d0ea1c8c90978f0.zip

feat: describe the font's pattern

Diffstat (limited to 'patterns')
-rw-r--r--patterns/font.hexpat34
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")]];