fontlabapp.features.code · declarations 001
Back to fontlabapp.features.code
feature_text
feature_text(tag: str, pairs: Iterable[tuple[str, str]]) -> str
Build a complete substitution block without a trailing newline.
Require a four-character ASCII alphanumeric tag, safe glyph names and unique source names. Preserve pair order; empty pairs produce an empty block. The result is source text, not proof that the feature compiles or shapes correctly. Ordered native writers may require a final newline.
safe_name
safe_name(name: str) -> bool
Return whether a glyph name can appear unescaped in generated FEA.
Permit ASCII letters/underscore initially and letters, digits, dots or hyphens thereafter, plus .notdef. This is intentionally conservative: it does not parse escaped FEA names or verify a glyph exists in a font.
suffix_pairs
suffix_pairs(names: Iterable[str], suffix: str) -> list[tuple[str, str]]
Return unique existing base/alternate pairs in alternate-name order.
Ignore leading suffix dots, orphan alternates and unsafe names. Every generated pair needs both names in the supplied glyph-name iterable. Empty suffixes yield no pairs. No font or feature source is modified.