mcfonts.utils.exporting.unihex

Functions for exporting into the GNU Unifont HEX format.

Contains functions for transforming and handling Unifont HEX data.

Module Contents

Functions

generate_bitmap_hex(glyph)

Generate a .hex glyph out of a BitmapGlyph.

include_glyph(hex_store, glyph, character)

Include glyph into the .hex font, represented as a dictionary.

set_hex_to_character(hex_store, hex_glyph, character)

Set .hex glyph data to a character.

set_space_to_character(hex_store, character, width[, ...])

Set a simple blank space width to a character.

mcfonts.utils.exporting.unihex.generate_bitmap_hex(glyph)

Generate a .hex glyph out of a BitmapGlyph.

Parameters:
glyph : mcfonts.glyphs.BitmapGlyph

A BitmapGlyph.

Returns:

A string of the .hex glyph data. In hexadecimal, used as-is for exporting.

Return type:

str

mcfonts.utils.exporting.unihex.include_glyph(hex_store, glyph, character)

Include glyph into the .hex font, represented as a dictionary.

Different Glyph subtypes have different methods of being imported; this function centralizes those varying methods.

Parameters:
hex_store : dict[str, str]

The .hex font, represented as a dictionary.

glyph : mcfonts.glyphs.Glyph

An instance of mcfont.glyphs.Glyph.

character : str

The character to assign this glyph to.

Return type:

None

mcfonts.utils.exporting.unihex.set_hex_to_character(hex_store, hex_glyph, character, replace=True)

Set .hex glyph data to a character.

Parameters:
hex_store : dict[str, str]

The .hex font, represented as a dictionary.

hex_glyph : str

A string of the glyph data.

character : str

The character to set a glyph to.

replace : bool

Whether the width should overwrite pre-existing glyph data for character.

Return type:

None

mcfonts.utils.exporting.unihex.set_space_to_character(hex_store, character, width, replace=True)

Set a simple blank space width to a character.

Parameters:
hex_store : dict[str, str]

The .hex font, represented as a dictionary.

character : str

The character to set a space to.

width : int

The width.

replace : bool

Whether the width should overwrite pre-existing glyph data for character.

Return type:

None


Last update: 2023 November 30