fontlabapp.studios.derived_glyphs.compat_tabular
compat_tabular
Create tabular (.tf) copies of the selected figures, with one shared width per master.
What it does: For each selected figure (zero to nine, also with a suffix such as one.osf) the script creates a new glyph with ".tf" added to the name, on every master. In each master all new glyphs get one advance width: the widest selected figure of that master plus an extra amount. The figure outline is copied and centred in that width. The source figures do not change.
How it works: A non-modal panel lists every selected glyph with its new name, or the reason why it is skipped. Create checks the font again. FontLab's own Add Glyph command makes each new glyph with its master layers and the shared widths. Then one step through the shared module fly.ap.core.history.glyphs adds the centred copies to all new layers. The centring keeps the outline on whole units; an odd unit of white space goes to the right side. The copy keeps node names and raw node flags, which a FontLab contour copy can drop (fl#8569). After the write the script reads every new layer back, and checks that no automatic glyph of the font changed. The creation, the contour copy and the panel are shared (fly.ap.glyphs.copies, fly.ap.contours.copy).
Copy limits: Anchors are not copied. Add the required anchors to the new glyphs before building accented composites. Only node names and raw node flags are repaired (fl#8569); selection is cleared. Other node properties and contour names are not repaired. Copied contours are merged into one element; source element names and notes are not copied.
Why this design: - New glyphs, not changed figures: proportional and tabular figures can then live side by side, as the OpenType tnum feature expects. To make the existing figures tabular in place, use Metrics > Tabular Width. - A figure needs a layer with contours on every master, with no components and no automatic layer. Otherwise the figure is listed and skipped, so the new glyphs stay compatible across masters. - A target name that exists is never overwritten. - Create discloses queued ids and their possible date changes. The script does not call UpdateAll (fl#8537). - FontLab can rebuild an automatic glyph when a new name appears. When the font has automatic glyphs without a recipe whose names carry the new suffix, the row shows "may rebuild auto ..." and is skipped unless you tick "Create even if FontLab may rebuild these auto glyphs". Use selection clears the tick. - Each new glyph is recorded as its own Undo step, and the outlines as one more Undo step.
How to use: Select the figures in the Font window. Run the script. Set the extra width, check the table and press Create. Narrow figures such as one can then need redrawing in their wider space.
Benefit: A complete, compatible set of tabular figures to refine, in one step.
Credit: Adapted from the author's own FontLab sample, Apache-2.0 (generate_tabular_copies.py, "Tabular Figure Copies").
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 |
|---|---|---|---|
FIGURES |
attribute | (shared captured text) | |
KEY |
attribute | ||
SUFFIX |
attribute | ||
TITLE |
attribute | ||
centring_shift |
function | (layer: Any, width: int) |
Delegate the retained callable contract to the studio model. |
main |
function | () -> Any |
Open the panel. (shared captured text) |
naming |
function | (name: str) |
Delegate the retained callable contract to the studio model. |
panel_type |
function | () -> type |
Build the panel class once Qt is available (inside FontLab). |
prepare |
function | (rows: Sequence[Any], widths: dict[str, int]) |
Delegate the retained callable contract to the studio model. |
survey |
function | (package: Any, names: Sequence[str], facts: Any, allow_rebuild: bool=False) |
Delegate the retained callable contract to the studio model. |
tabular_widths |
function | (rows: Sequence[Any], extra: int) |
Delegate the retained callable contract to the studio model. |