[1357] | 1 | /* $Id: font.dox 1879 2007-11-04 11:59:54Z sam $ */ |
---|
[744] | 2 | |
---|
[1879] | 3 | /** \page libcaca-font The libcaca font format (version 1) |
---|
[744] | 4 | |
---|
[1357] | 5 | All types are big endian. |
---|
[746] | 6 | |
---|
[1357] | 7 | \code |
---|
| 8 | struct |
---|
[746] | 9 | { |
---|
[1357] | 10 | magic: |
---|
| 11 | uint8_t caca_header[2]; // "\xCA\xCA" |
---|
| 12 | uint8_t caca_file_type[2]; // "FT" |
---|
[746] | 13 | |
---|
[1357] | 14 | font_header: |
---|
| 15 | uint32_t control_size; // Control size (font_data - font_header) |
---|
| 16 | uint32_t data_size; // Data size (EOF - font_data) |
---|
[746] | 17 | |
---|
[1357] | 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 |
---|
[746] | 22 | |
---|
[1357] | 23 | uint16_t blocks; // Number of blocks in the font |
---|
| 24 | uint32_t glyphs; // Total number of glyphs in the font |
---|
[746] | 25 | |
---|
[1357] | 26 | uint16_t bpp; // Bits per pixel for glyph data (valid |
---|
| 27 | // Values are 1, 2, 4 and 8) |
---|
[1365] | 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 |
---|
[746] | 32 | |
---|
[1357] | 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 |
---|
[746] | 36 | |
---|
[1357] | 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]; |
---|
[754] | 45 | |
---|
[1357] | 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]; |
---|
[754] | 55 | |
---|
[1357] | 56 | control_extension_1: |
---|
| 57 | control_extension_2: |
---|
| 58 | ... |
---|
| 59 | control_extension_N: |
---|
| 60 | ... // reserved for future use |
---|
[746] | 61 | |
---|
[1357] | 62 | font_data: |
---|
| 63 | uint8_t data[data_size]; // glyph data |
---|
[760] | 64 | |
---|
[1357] | 65 | data_extension_1: |
---|
| 66 | data_extension_2: |
---|
| 67 | ... |
---|
| 68 | data_extension_N: |
---|
| 69 | ... // reserved for future use |
---|
| 70 | }; |
---|
| 71 | \endcode |
---|
[763] | 72 | |
---|
[1357] | 73 | */ |
---|