Skip to content

Character Table

The-Nice-One edited this page Aug 3, 2026 · 8 revisions

Defines mappings between UTF-8 code point sequences (characters) and their visual representations (pixmaps).

Use Cases

  • Character-to-glyph mapping - Associates text characters, including single utf8 code points, ligatures, and grapheme clusters, with their pixmap representation.

Table Structure

Identifier

  • Value: 0x01

Modifier Flags

BitNameDescription
0use_advance_xEach record includes an advance_x field specifying horizontal pixel advance after rendering.
1use_pixmap_indexEach record includes a pixmap_index field to explicitly reference a pixmap by index.
2use_pixmap_table_indexEach record includes a pixmap_table_index field to specify which linked Pixmap Table to reference.
3-7Reserved for future use.

Flag Details

  • use_advance_x: When disabled, the default advance is the pixmap's width. Letter spacing, if any, is added to the advance value.
  • use_pixmap_index: When disabled, the pixmap index defaults to match the character record index creating a one to one mapping.
  • use_pixmap_table_index: When disabled, the renderer searches linked Pixmap Tables in order until finding a valid pixmap at the character's index. The first pixmap linked will have priority over the last.

Configuration Flags

BitNameDescription
0use_constant_code_point_countAll characters in this table have the same number of code points.
1-7Reserved for future use.

Configuration Values

NameTypeConditionDescription
constant_code_point_countu8If use_constant_code_point_count is enabled.The exact code point length of all records' code_points fields in this table.

Table Links

BitNameDescription
0link_pixmap_tablesThis table links to any number of Pixmap Tables.
1-7Reserved for future use.

Link Arrays

NameTypeConditionDescription
pixmap_tablesVec<u8>If link_pixmap_tables is enabled.Pixmap Tables supplying the pixmaps each record may map to.

Character Record

Each character record contains the following fields in order:

FieldTypeConditionDescription
advance_xu8If use_advance_x modifier is enabled.Number of pixels to advance horizontally after rendering this character.
pixmap_indexu8If use_pixmap_index modifier is enabled.Index of the pixmap within the referenced Pixmap Tables.
pixmap_table_indexu8If use_pixmap_table_index modifier is enabled.Index of the specific Pixmap Table to use for this character.
code_pointsStringAlways present.UTF-8 encoded code point sequence, null-terminated unless constant_code_point_count is set.

Record Layout Examples

Example 1: Minimal record (no modifier flags enabled)

Character A, using the default advance and the default pixmap index.

ByteFieldBinaryHexDescription
1code_points0100000141A (U+0041)
20000000000Null terminator

Example 2: With custom advance (use_advance_x)

Character W with a custom 12 pixel advance.

ByteFieldBinaryHexDescription
1advance_x000011000CAdvance 12 pixels
2code_points0101011157W (U+0057)
30000000000Null terminator

Example 3: With pixmap index (use_pixmap_index)

Character é drawn with the pixmap at index 5. The code point needs two UTF-8 bytes.

ByteFieldBinaryHexDescription
1pixmap_index0000010105Pixmap 5
2code_points11000011C3é (U+00E9), byte 1 of 2
3code_points10101001A9é (U+00E9), byte 2 of 2
40000000000Null terminator

Example 4: With all optional fields

Character 👍 with advance 16, pixmap index 42, drawn from linked Pixmap Table 1.

ByteFieldBinaryHexDescription
1advance_x0001000010Advance 16 pixels
2pixmap_index001010102APixmap 42
3pixmap_table_index0000000101Pixmap Table 1
4code_points11110000F0👍 (U+1F44D), byte 1 of 4
5code_points100111119F👍 (U+1F44D), byte 2 of 4
6code_points1001000191👍 (U+1F44D), byte 3 of 4
7code_points100011018D👍 (U+1F44D), byte 4 of 4
80000000000Null terminator

Example 5: With a constant code point count

Configuration: constant_code_point_count = 1, so every character in the table is exactly one code point.

ByteFieldBinaryHexDescription
1code_points0100001042B (U+0042), no terminator required

Example 6: Multi-code-point cluster

The ligature != stored as a single character, with no constant code point count set.

ByteFieldBinaryHexDescription
1code_points0010000121! (U+0021), code point 1 of 2
2code_points001111013D= (U+003D), code point 2 of 2
30000000000Null terminator ends the cluster

Complete Table Example

The following byte sequence defines a minimal Character Table with two characters (A and B), using custom advance values and linking to one Pixmap Table:

BytesBinaryHexDescription
10000000101Table identifier for Character Table
20000001103Modifier flags: use_advance_x and use_pixmap_index enabled
30000000101Configuration flags: use_constant_code_point_count enabled
40000000101constant_code_point_count = 1 code point
50000000101Table links: link_pixmap_tables enabled
60000000101Pixmap table array length = 1
70000000000Link to Pixmap Table at index 0
80000001002Record count = 2 characters
90000100008Character 0: advance_x = 8 pixels
100000000000Character 0: pixmap_index = 0
110100000141Character 0: code_points = A
120000100008Character 1: advance_x = 8 pixels
130000000101Character 1: pixmap_index = 1
140100001042Character 1: code_points = B

Clone this wiki locally