subframe7536/maple-font · error · Exception
Font weight of `thin` must be 100
Error message
Font weight of `thin` must be 100
What it means
patch_instance post-processes a variable font's fvar instances and STAT table, assuming the weight axis covers named instances from thin (100) to extrabold (800). It raises this Exception when all_weight_map["thin"] is not exactly 100, meaning the font's minimum named weight deviates from the variable-font spec value the patching logic relies on. The name-to-weight mapping (value_to_name) would otherwise be wrong.
Source
Thrown at source/py/utils.py:455
head.yMin = new_descender # type: ignore
hhea.ascent = new_ascender # type: ignore
hhea.descent = new_descender # type: ignore
os2.sTypoAscender = new_ascender # type: ignore
os2.sTypoDescender = new_descender # type: ignore
os2.usWinAscent = new_ascender # type: ignore
os2.usWinDescent = -new_descender # type: ignore
def patch_instance(font: TTFont, all_weight_map: dict[str, int]):
if all_weight_map == default_weight_map:
print("Skip weight remapping since nothing changed.")
return
if "fvar" not in font or "STAT" not in font:
return
if all_weight_map["thin"] != 100:
raise Exception("Font weight of `thin` must be 100")
if all_weight_map["extrabold"] != 800:
raise Exception("Font weight of `extrabold` must be 800")
value_to_name = {v: k for k, v in default_weight_map.items()}
for instance in font["fvar"].instances: # type: ignore
current_weight = int(instance.coordinates["wght"])
weight_name = value_to_name.get(current_weight)
if weight_name and weight_name in all_weight_map:
instance.coordinates["wght"] = all_weight_map[weight_name]
axes = font["fvar"].axes # type: ignore
wght_index = next((i for i, ax in enumerate(axes) if ax.axisTag == "wght"), None)
if wght_index is None:
return
stat = font["STAT"].table # type: ignoreView on GitHub (pinned to c08fda97fe)
Solutions
- Set the thin weight back to 100 in the weight map / fvar instance coordinates configuration.
- Verify the wght axis design space starts at 100 for the thin master/instance.
- If a different thin weight is intentional, update patch_instance's expectation (the hardcoded 100 check) accordingly.
- Diff your config against upstream defaults to find where the thin weight was changed.
Example fix
// before
# weight_map = {"thin": 200, ...}
// after
# weight_map = {"thin": 100, ...} # thin must be exactly 100 Defensive patterns
Strategy: validation
Validate before calling
def assert_thin_is_100(weight_map):
if weight_map.get("thin") != 100:
raise ValueError(
f"thin weight must be 100 for variable-font patching, got {weight_map.get('thin')}"
) Type guard
def has_valid_weight_axis(all_weight_map: dict) -> bool:
return all_weight_map.get("thin") == 100 and all_weight_map.get("extrabold") == 800 Try / catch
try:
build_variable_fonts(...)
except Exception as e:
if "thin" in str(e) and "100" in str(e):
print("Fix thin weight to 100 in the weight map config")
raise Prevention
- Keep the wght axis endpoints at the standard 100..800 in build config.
- Validate the weight map against expected values before building.
- Diff config changes against upstream defaults when altering weights.
- Add a unit check that fvar thin instance coordinates == 100.
When it happens
Trigger: Calling build_variable_fonts → patch_instance when the wght axis's thin instance coordinates are not 100 — e.g. the design-space weight map was customized so thin maps to another value, or the axis range was changed.
Common situations: Editing the weight configuration (weight map / axis ranges) in the build config and setting thin to a non-100 value; regenerating the variable font with a changed wght axis minimum; a mis-merged config producing wrong instance coordinates.
Related errors
- Font weight of `extrabold` must be 800
- Invalid font source type: {type(source)}
- Invalid axe value, range: [{min_value}, {max_value}]
- line_height object must contain 'ascender' and 'descender' f
- {file_name or 'The font'} may contains glyphs that width is
AI-assisted analysis of subframe7536/maple-font@c08fda97fe (2026-08-28).
Data as JSON: /api/errors/6a991b3d0196ef44.
Report an issue: GitHub.