Skip to content

fontlabapp.fontui.teaching_writers.stem_blend

stem_blend

What: Write a stem-compensated blend into a new layer of the current glyph. How: Divide target stems by scale to choose independent X/Y interpolation fractions. Unslant, blend, scale and reslant. The final stems match the typed measurements when the source stems interpolate linearly. Why: Make scaled lettering at a requested stem size without changing masters. Usage: Open a glyph. Choose two source layers. Enter measured source and target stems and scale factors. Build, inspect the output name, then Create Layer. The layer name is Stem x (), for example Stem 75x60 (Light). Names containing @ or #, starting with |temp|, or matching a master name are refused. An existing layer name is refused. Each new layer is recorded as one Undo step through App history. The new layer becomes the active layer. Benefit: Keep native font-unit geometry without an artwork import transform.

The angle starts at minus the current master's italic angle; positive means that the top moves right. Refresh Sources reloads layer choices and the angle. Targets divided by scale must lie between the measured source stems. Equal stems, components, shape transforms and incompatible paths are refused. TrueType off-curves stay quadratic, including implied on-curve midpoints. The new layer keeps the first source's advance. Anchors, hints, node flags and other source metadata are not copied. Automatic-layer owners and bases of automatic composites are kept unchanged and named in the refusal message. Copy SVG is secondary artwork only. SVG import may rescale or reposition it; no SVG import preserves scale by this tool's guarantee. No stored axis setup, extrapolation or batch target baking is provided. Use native Font > Generate Instance for native instance generation. Requires FontLab 9, Python 3.11, Fly and App >= 0.2.150.dev0.

Credit: Independent behaviour rewrite of Delta.py and DeltaNew.py by Vassil Kateliev, TypeRig, kateliev/TypeRig, MPL-2.0. https://github.com/kateliev/TypeRig No source code, comments, icons or preset formats are copied. 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 (shared captured text)
Contour attribute
Contours attribute
Point attribute (shared captured text)
TITLE attribute
blend_contours function (first: Contours, second: Contours, stems: tuple[float, float, float, float], target: tuple[float, float], sc… Use independent measured-stem fractions; never change source coordinates.
capture_pair function (first: str, second: str) -> tuple[str, Contours, Contours] Read both source layers twice and refuse a changed current font or glyph.
checked_layer_name function (name: str, masters: tuple[str, ...]) -> str Refuse native recipe, master and temporary-layer naming syntax.
contour_parts function (contour: Contour) -> tuple[bool, list[Point], bool] Read an explicit TT flag; older detached cubic inputs default to cubic.
create_layer function (plan: dict[str, Any], *, disclosure: dict[str, Any] | None=None) -> str Create one layer through App history and settle; reject stale or unsafe previews.
current_context function () -> tuple[Any, Any] Resolve an owned current glyph without reading native FontGate caches.
export_new function (filename: str, content: str) -> None Write one detached SVG artifact; refuse overwriting an existing file.
main function () -> None Use the existing FontLab application and main window.
numbers function (text: str, count: int) -> tuple[float, ...] Parse the exact count of space-separated finite numeric controls.
path_text function (closed: bool, points: list[Point], tt: bool=False) -> str Serialize complete paths; refuse malformed control runs instead of dropping nodes.
prepare_blend function (first: str, second: str, stems: tuple, target: tuple, scales: tuple, angle: float) -> dict[str, Any] Bind a detached outline preview to its exact font, glyph, layers and advance.
read_contours function (layer: Any, deadline: float) -> Contours Read plain contour shapes with a deadline; refuse geometry that needs flattening.
show function (qt: Any, parent: Any, *, embedded: bool=False) -> Any Show repeatable blend controls; keep SVG detached and invalidate on edits.
source_options function () -> tuple[list[str], float] Offer current-glyph layer names and the current master's rightward slant.
stored_outline_matches function (actual: list, expected: list) -> bool Accept native integer snapping; require exact topology and node kinds. (shared captured text)
svg_text function (label: str, contours: Contours) -> str Keep font-unit coordinates and invert SVG y exactly once.