Browse Source

* New version of the font format.

tags/v0.99.beta14
Sam Hocevar sam 19 years ago
parent
commit
33060e0b5a
1 changed files with 41 additions and 19 deletions
  1. +41
    -19
      cucul/font.c

+ 41
- 19
cucul/font.c View File

@@ -18,8 +18,8 @@
*/

/*
* The libcaca font format
* -----------------------
* The libcaca font format, version 1
* ----------------------------------
*
* All types are big endian.
*
@@ -28,33 +28,55 @@
* uint8_t caca_header[4]; // "CACA"
* uint8_t caca_file_type[4]; // "FONT"
*
* header:
* uint32_t header_size; // size of the header (data - header)
* uint16_t version; // font format version (= 1)
* font_header:
* uint32_t header_size; // Header size (font_data - font_header)
* uint32_t data_size; // Data size (EOF - font_data)
*
* uint16_t glyphs; // total number of glyphs in the font
* uint16_t width; // glyph width
* uint16_t height; // glyph height
* uint16_t bytes; // bytes used to code each character,
* // rounded up to a multiple of 2.
* uint16_t version; // Font format version
* // bit 0: set to 1 if font is compatible
* // with version 1 of the format
* // bits 1-15: unused yet, must be 0
*
* uint16_t blocks; // number of blocks in the font
* uint16_t blocks; // Number of blocks in the font
* uint32_t glyphs; // Total number of glyphs in the font
*
* uint16_t bpp; // Bits per pixel for glyph data (valid
* // Values are 1, 2, 4 and 8)
* uint16_t width; // Maximum glyph width
* uint16_t height; // Maximum glyph height
*
* uint16_t flags; // Feature flags
* // bit 0: set to 1 if font is fixed width
* // bits 1-15: unused yet, must be 0
*
* block_info:
* struct
* {
* uint32_t start; // Unicode index of the first character
* uint32_t end; // Unicode index of the last character + 1
* uint32_t offset; // Offset (starting from data) to the data
* // for the first character
* uint32_t start; // Unicode index of the first glyph
* uint32_t end; // Unicode index of the last glyph + 1
* uint32_t info_offset; // Offset (starting from data) to the info
* // for the first glyph
* }
* block_list[blocks];
*
* padding:
* glyph_info:
* struct
* {
* uint16_t width; // Glyph width in pixels
* uint16_t height; // Glyph height in pixels
* uint32_t data_offset; // Offset (starting from data) to the data
* // for the first character
* }
* glyph_list[glyphs];
*
* extension_1:
* extension_2:
* ...
* extension_N:
* ... // reserved for future use
*
* data:
* uint4_t[glyphs * bytes]; // glyph data
* font_data:
* uint8_t data[data_size]; // glyph data
* };
*
*/


Loading…
Cancel
Save