Skip to content

fontlabapp.metrics.master_writer

master_writer

Write font master vertical metrics as ONE native Undo step.

What: write_master_metrics(package, {master: {field: value}}, title) writes ascender, descender, x-height, caps height and line gap of one or more masters through font_history.commit_masters (route A of issue 122 M2, measured for ascender and xHeight on FontLab 9.0.9790). The same flPackage.*_value setters are what Font Info uses (fontinfo_data.cpp:577-581).

Fields (FIELDS): ascender, descender, xHeight, capsHeight and lineGap. capHeight is an alias of capsHeight (ALIASES): the host registers flPackage.capHeight on the same setter (pyflpackage.cpp:1405-1414,3545); results use capsHeight. lineGap is the master line gap of Font Info (flPackage.lineGap_value). The separate hhea line gap is in master otherData; no measured setter exists for it, so a name such as hhea_line_gap is refused as unknown.

Refusals (ValueError) come before any history call: an empty request, an unknown field, a value that is not a finite real number, and every refusal of commit_masters (GUI thread, Font window, unknown master).

Read-back: FontLab stores these values as C++ double (flpackage.h:603-654). A stored value reads back as the same double, so the tolerance (TOLERANCE) only absorbs a last-bit difference; a rounded or clamped value fails the read-back, all values are restored and font_history.RolledBackError is raised.

Known host defect (fl#8574): after Undo/Redo, the font-metric guidelines show 3 of 9 until updateFontMetrics() or a reopen (see font_history). scripting.write_font_info stays unchanged. Offline tests prove the call order only.

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
ALIASES attribute Mapping[str, str]
FIELDS attribute Mapping[str, str]
TITLE attribute
TOLERANCE attribute
parse function (values: Mapping[str, Mapping[str, object]]) -> dict[str, dict[str, float]] Return the checked request <code>{master: {field: float}}</code> in field order.
write_master_metrics function (package: Any, values: Mapping[str, Mapping[str, object]], title: str=TITLE, *, native: Any=None) -> MastersC… Write <code>values</code><code> (</code><code>{master: {field: value}}</code>) as ONE Undo step.