aboutsummaryrefslogtreecommitdiffstats
path: root/patterns/font.hexpat
blob: 4a6a8c43b4df2eca0273ed8437099f612827a6bf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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")]];