reorderGlyphs: Functions to reorder the glyphs in a font

Overview

The fontTools.ttLib.reorderGlyphs module is a helper for fontTools.ttLib.

Reorder glyphs in a font.

class fontTools.ttLib.reorderGlyphs.ReorderRule[source]

Bases: ABC

A rule to reorder something in a font to match the fonts glyph order.

abstract apply(font: TTFont, value: BaseTable) None[source]
class fontTools.ttLib.reorderGlyphs.ReorderCoverage(parallel_list_attr: str | None = None, coverage_attr: str = 'Coverage')[source]

Bases: ReorderRule

Reorder a Coverage table, and optionally a list that is sorted parallel to it.

parallel_list_attr: str | None = None
coverage_attr: str = 'Coverage'
apply(font: TTFont, value: BaseTable) None[source]
class fontTools.ttLib.reorderGlyphs.ReorderList(list_attr: str, key: str)[source]

Bases: ReorderRule

Reorder the items within a list to match the updated glyph order.

Useful when a list ordered by coverage itself contains something ordered by a gid. For example, the PairSet table of https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#lookup-type-2-pair-adjustment-positioning-subtable.

list_attr: str
key: str
apply(font: TTFont, value: BaseTable) None[source]
fontTools.ttLib.reorderGlyphs.reorderGlyphs(font: TTFont, new_glyph_order: List[str])[source]