mcfonts.utils.exporting.yaff

Functions for exporting into the text-only human-readable YAFF format.

Module Contents

Functions

generate_bitmap_yaff(glyph)

Generate a YAFF glyph out of a BitmapGlyph.

generate_unihex_yaff(glyph)

Generate a YAFF glyph out of a UnihexGlyph.

include_glyph(yaff_store, glyph, character)

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

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

Set a simple blank space width to a character.

set_yaff_to_character(yaff_store, yaff_glyph, character)

Set YAFF glyph data to a character.

Attributes

YAFF_STORE_GLYPH_MAGIC

The magic constant that is used as a key for glyph data to be stored under.

mcfonts.utils.exporting.yaff.YAFF_STORE_GLYPH_MAGIC = '__glyph__'

The magic constant that is used as a key for glyph data to be stored under.

mcfonts.utils.exporting.yaff.generate_bitmap_yaff(glyph)

Generate a YAFF glyph out of a BitmapGlyph.

Parameters:
glyph : mcfonts.glyphs.BitmapGlyph

A BitmapGlyph.

Returns:

A dictionary of the YAFF data. Glyph data is stored under YAFF_STORE_GLYPH_MAGIC.

Return type:

dict[str, list[str] | str | int]

mcfonts.utils.exporting.yaff.generate_unihex_yaff(glyph)

Generate a YAFF glyph out of a UnihexGlyph.

Parameters:
glyph : mcfonts.glyphs.UnihexGlyph

A UnihexGlyph.

Returns:

A dictionary of the YAFF data. Glyph data is stored under YAFF_STORE_GLYPH_MAGIC.

Return type:

dict[str, list[str] | str | int]

mcfonts.utils.exporting.yaff.include_glyph(yaff_store, glyph, character)

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

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

Parameters:
yaff_store : dict[str, str | int | dict[str, list[str]]]

The YAFF 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.yaff.set_space_to_character(yaff_store, character, width, replace=True)

Set a simple blank space width to a character.

Parameters:
yaff_store : dict[str, str | int | dict[str, list[str]]]

The YAFF 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

mcfonts.utils.exporting.yaff.set_yaff_to_character(yaff_store, yaff_glyph, character, replace=True)

Set YAFF glyph data to a character.

Parameters:
yaff_store : dict[str, str | int | dict[str, list[str] | str | int]]

The YAFF font, represented as a dictionary.

yaff_glyph : dict[str, list[str] | str | int]

A dictionary of the YAFF data. Glyph data is stored under YAFF_STORE_GLYPH_MAGIC.

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


Last update: 2023 November 30