1 | /* $Id: font.dox 1879 2007-11-04 11:59:54Z sam $ */ |
---|
2 | |
---|
3 | /** \page libcaca-font The libcaca font format (version 1) |
---|
4 | |
---|
5 | All types are big endian. |
---|
6 | |
---|
7 | \code |
---|
8 | struct |
---|
9 | { |
---|
10 | magic: |
---|
11 | uint8_t caca_header[2]; // "\xCA\xCA" |
---|
12 | uint8_t caca_file_type[2]; // "FT" |
---|
13 | |
---|
14 | font_header: |
---|
15 | uint32_t control_size; // Control size (font_data - font_header) |
---|
16 | uint32_t data_size; // Data size (EOF - font_data) |
---|
17 | |
---|
18 | uint16_t version; // Font format version |
---|
19 | // bit 0: set to 1 if font is compatible |
---|
20 | // with version 1 of the format |
---|
21 | // bits 1-15: unused yet, must be 0 |
---|
22 | |
---|
23 | uint16_t blocks; // Number of blocks in the font |
---|
24 | uint32_t glyphs; // Total number of glyphs in the font |
---|
25 | |
---|
26 | uint16_t bpp; // Bits per pixel for glyph data (valid |
---|
27 | // Values are 1, 2, 4 and 8) |
---|
28 | uint16_t width; // Standard glyph width |
---|
29 | uint16_t height; // Standard glyph height |
---|
30 | uint16_t maxwidth; // Maximum glyph width |
---|
31 | uint16_t maxheight; // Maximum glyph height |
---|
32 | |
---|
33 | uint16_t flags; // Feature flags |
---|
34 | // bit 0: set to 1 if font is fixed width |
---|
35 | // bits 1-15: unused yet, must be 0 |
---|
36 | |
---|
37 | block_info: |
---|
38 | struct |
---|
39 | { |
---|
40 | uint32_t start; // Unicode index of the first glyph |
---|
41 | uint32_t stop; // Unicode index of the last glyph + 1 |
---|
42 | uint32_t index; // Glyph info index of the first glyph |
---|
43 | } |
---|
44 | block_list[blocks]; |
---|
45 | |
---|
46 | glyph_info: |
---|
47 | struct |
---|
48 | { |
---|
49 | uint16_t width; // Glyph width in pixels |
---|
50 | uint16_t height; // Glyph height in pixels |
---|
51 | uint32_t data_offset; // Offset (starting from data) to the data |
---|
52 | // for the first character |
---|
53 | } |
---|
54 | glyph_list[glyphs]; |
---|
55 | |
---|
56 | control_extension_1: |
---|
57 | control_extension_2: |
---|
58 | ... |
---|
59 | control_extension_N: |
---|
60 | ... // reserved for future use |
---|
61 | |
---|
62 | font_data: |
---|
63 | uint8_t data[data_size]; // glyph data |
---|
64 | |
---|
65 | data_extension_1: |
---|
66 | data_extension_2: |
---|
67 | ... |
---|
68 | data_extension_N: |
---|
69 | ... // reserved for future use |
---|
70 | }; |
---|
71 | \endcode |
---|
72 | |
---|
73 | */ |
---|