Skip to content

fontlabapp.fontui.teaching_writers.import_kerning_pair_list

import_kerning_pair_list

What: Import many current-master kerning pairs from a pasted text list. How: Read left right value lines; # begins a comment. Preview every row before Apply. Decimal values round half away from zero to whole units. Invalid rows block the entire batch. Duplicate pair lines require correction. Why: A pair list can carry different values for many glyph and class pairs. Usage: Open a font, paste the list, press Preview and inspect the table. Press Apply for one Undo step. Edit the list and Preview again for another batch. Benefit: Transfer measured pairs without creating glyphs or kerning classes.

@class names must already exist on the correct side of the current master's kerning. Glyphs with automatic layers, including members of a named class, are refused by the shared FontLab editing rules. Apply checks the font, master, text and complete kerning snapshot again. Native read-back verifies the written batch. Keep the panel open for repeated imports. Setup: FontLab 9, Python 3.11, Fly and App>=0.2.150.dev0.

Based on the author's own FontLab sample, Apache-2.0. Source: recipe.py (Kerning Pairs from Text).

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
TITLE attribute
apply_pairs function (plan: dict[str, Any], text: str) -> bool Revalidate the displayed batch, then use the shared native kerning writer.
main function () -> None Use the host application without creating another Qt event loop.
parse_pairs function (text: str) -> list[dict[str, Any]] Parse every non-comment row, retaining line numbers and row errors.
prepare_pairs function (text: str) -> dict[str, Any] Bind a complete row preview to current font, master and kerning values.
show function (qt: Any, parent: Any, *, embedded: bool=False) -> Any Build a modeless list importer with explicit Preview and Apply actions.
validate_row function (package: Any, master: str, row: dict[str, Any], snapshot: Any, facts: Any, batch: Any, history: Any) -> None Use public App class-side, glyph-existence and auto-layer policies.