Font

retrofont.font.font_to_rom(font)

Serialise a front to ROM content.

Parameters:

font (list[list[bytes]]) – Font.

Return type:

bytes

Returns:

Character ROM content.

retrofont.font.font_to_yaml(font)

Convert a font to its YAML representation.

Parameters:

font (list[list[bytes]]) – Font.

Return type:

list[dict]

Returns:

YAML representation of font.

retrofont.font.keymap_to_permutation(keymap)

Convert a key mapping table to a character set permutation.

Parameters:

keymap (dict) – Key mapping table.

Return type:

list

Returns:

Permutation table.

retrofont.font.map_charset(charset, permutation)

Permute a character set.

Parameters:
  • charset (list[bytes]) – Character set.

  • permutation (list[int]) – Permutation table.

Return type:

list[bytes]

Returns:

Permuted character set.

retrofont.font.map_font(font, permutation)

Permute a list of character sets.

Parameters:
  • font (list[list[bytes]]) – List of character sets.

  • permutation (list[int]) – Permutation.

Return type:

list[list[bytes]]

Returns:

List of permuted character sets.

retrofont.font.rom_to_font(data, mirror=False)

Deserialise ROM content to a font.

Parameters:
  • data (bytes) – Character ROM content.

  • mirror (bool) – Reverse bit order.

Return type:

list[list[bytes]]

Returns:

Font.

retrofont.font.visualise_charset(offset)

Visualise a character set.

Parameters:

offset (int) – Start address of the character set.

Return type:

list[str]

Returns:

Visualition of the character set.

retrofont.font.yaml_to_font(yaml_font)

Convert a font from its YAML representation.

Parameters:

yaml_font (list[dict]) – YAML representation of a font.

Return type:

list[list[bytes]]

Returns:

Font.