pyhershey.glyph_factory

Module Contents

Classes

GlyphFactory

This class manages the access to glyph database.

class pyhershey.glyph_factory.GlyphFactory(database_file: str)[source]

This class manages the access to glyph database.

from_index(self, index: int)pyhershey.glyph_view.GlyphView[source]

Creates a Glyph with given index.

Parameters

index (int) – index of glyph. See docs for complete list all glyphs.

Returns

Glyph

from_ascii(self, char: str, mapping: str)pyhershey.glyph_view.GlyphView[source]

Creates a Glyph with given ascii value, font style and font type.

Additionally, “°” can be passed as char.

Parameters
  • char (str) – ascii character

  • mapping (str) – ascii mapping to be used

Returns

Glyph

Raises

ValueError – if mapping does not exist, ascii character is not found in mapping or chr is not an ascii character.

property ascii_mappings(self)List[str]

List[str]: list of all ascii mappings

property collections(self)List[str]

List[str]: list of all collections

index_iterator(self, subset: Optional[str] = None)Iterable[int][source]

Generator function yielding the indices of the passed subset. Subset must be in collections() or in ascii_mappings(). If no subset is specified, all glyphs are used.

Parameters

subset – name of the collection or mapping

Raises

ValueError – if subset does not exist.

iterator(self, subset: Optional[str] = None)Iterable[GlyphView][source]

Generator function yielding the glyphs of the passed subset. Subset must be in collections or in ascii_mappings. If no subset is specified, all glyphs are used.

Parameters

subset – name of the collection or mapping

pyhershey.glyph_factory.glyph_factory :GlyphFactory

Instance of GlyphFactory with loaded database