fontlabapp.fontui.teaching_writers.scale_with_stem_compensation
scale_with_stem_compensation
What: Scale selected glyphs with independent vertical/horizontal stem compensation. How: Each checked master row supplies two source layers, their measured stems, target stems, scale X/Y and slant. Unslant all nodes, blend X/Y independently, scale and reslant. Preview lists every glyph/master and output layer. Confirm, then Create Layers. The entire batch is recorded as one Undo step. Why: Plain scaling changes stems. Per-master stem measurements make derived small caps or superiors without changing the source masters. Usage: Select glyphs in the Font window. Use Selection, check target master rows, edit their source pairs and measurements, Preview, inspect kept rows, confirm. Benefit: Generate many compensated glyph layers in one repeatable action.
Outputs are new auxiliary layers named master + suffix. Existing outputs are kept. New names cannot contain @ or # or start with |temp|. No in-place overwrite or whole-font default is provided. Preview and Apply each scan dependencies once; control edits never scan fonts. Apply rechecks the displayed plan. All nodes and controls use the same affine blend; TT contours remain quadratic, including consecutive controls and implied on-curves. First-source node names, raw flags and contour names are retained, with selection flags cleared. Advance is first-source advance times scale X. Components, transforms, automatic or locked sources, custom node/contour properties and unsafe automatic dependants are kept. Anchors, guides, hints, element metadata and metrics expressions are not copied. Source layers stay unchanged. Slant defaults to minus the current master's angle; each table row can override it. Extrapolation, boundary-fix, stem probing and saved table presets are not provided. Partial failures direct you to Edit > Undo. Setup: FontLab 9, Python 3.11, Fly and App>=0.2.150.dev0. Non-modal panel.
Independent behaviour rewrite of DeltaMachine.py, Vassil Kateliev / Karandash Type Foundry, kateliev/TypeRig, MPL-2.0. https://github.com/kateliev/TypeRig The small arithmetic helper reuses the Apache-2.0 Stem Blend implementation. No TypeRig code, private identifiers, comments or assets copied. Capture allows 3 seconds plus one second per selected glyph/master. A timeout refuses the whole preview; select fewer glyphs. Read-back allows coordinate changes up to 1e-3 units. Advance is checked against its detached value read immediately after the native setter applies the current rounding preference, with the same tolerance. The coordinate tolerance is measured in FontLab 9: coordinates drift 1.2e-5..1.6e-5 after Redo and up to 5e-4 after save and reopen (live reports 16 and 17).
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 |
|---|---|---|---|
COORDINATE_TOLERANCE |
attribute | ||
HEADERS |
attribute | ||
KEY |
attribute | ||
TITLE |
attribute | ||
apply_plan |
function | (plan: dict[str, Any], confirmed: bool) -> dict[str, Any] |
Create all ready layers through one history.commit, after rechecking Preview. |
blend_contours |
function | (first: list, second: list, stems: tuple, target: tuple, scales: tuple, angle: float) -> list |
Private Stem Blend arithmetic; preserve topology and transform every control. |
checked_name |
function | (name: str) -> str |
Reject FontLab recipe, temporary and lossy text syntax. |
current_font |
function | (identity: int) -> Any |
Bind to the current font's fgId, never its label or wrapper identity. |
main |
function | () -> None |
Contain startup errors; the App guards all owned callbacks. |
make_plan |
function | (identity: int, names: list[str], configs: list[dict[str, Any]], suffix: str) -> dict[str, Any] |
Take an explicit batch preview with one shared dependency scan. |
panel_type |
function | () -> type |
Build a per-master table, explicit Preview and separate confirmation. |
read_contours |
function | (layer: Any, deadline: float) -> tuple[list, list] |
Capture each contour once, including TT flag and stable index-based metadata. |
stored_outline_matches |
function | (actual: list, expected: list) -> bool |
Accept native integer snapping; require exact topology and node kinds. |
survey |
function | (package: Any, names: list[str], configs: list[dict[str, Any]], suffix: str, facts: Any) -> list[dict[str, An… |
Plan selected glyphs times checked masters; retain every refused combination. |