subframe7536/maple-font · error · Exception

Font weight of `extrabold` must be 800

Error message

Font weight of `extrabold` must be 800

What it means

patch_instance requires the variable font's extrabold named weight to be exactly 800 (the standard wght-axis value) before mapping instance coordinates to weight names. This Exception is raised when all_weight_map["extrabold"] differs from 800, which would make value_to_name lookups produce wrong or missing instance names. It mirrors the thin==100 guard at the other end of the axis.

Source

Thrown at source/py/utils.py:458

    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: ignore
    if not stat.AxisValueArray:
        return

View on GitHub (pinned to c08fda97fe)

Solutions

  1. Set the extrabold weight back to 800 in the weight map / fvar instance configuration.
  2. Verify the wght axis design space reaches 800 for the extrabold master/instance.
  3. If 800 is intentionally not used, update patch_instance's hardcoded extrabold check and value_to_name mapping.
  4. Diff your build config against upstream defaults to locate the changed extrabold value.

Example fix

// before
# weight_map = {"extrabold": 700, ...}
// after
# weight_map = {"extrabold": 800, ...}  # extrabold must be exactly 800
Defensive patterns

Strategy: validation

Validate before calling

def assert_extrabold_is_800(weight_map):
    if weight_map.get("extrabold") != 800:
        raise ValueError(
            f"extrabold weight must be 800 for variable-font patching, got {weight_map.get('extrabold')}"
        )

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 "extrabold" in str(e) and "800" in str(e):
        print("Fix extrabold weight to 800 in the weight map config")
    raise

Prevention

When it happens

Trigger: Calling build_variable_fonts → patch_instance when the wght axis's extrabold instance coordinates are not 800 — e.g. a customized weight map sets extrabold to 700 or 850, or the axis maximum was changed in the design space.

Common situations: Customizing the weight map/axis range in build config so extrabold isn't 800; collapsing or extending the weight axis (e.g. adding a 'heavy' 900 and shifting extrabold); a config merge or typo changing the extrabold value.

Related errors


AI-assisted analysis of subframe7536/maple-font@c08fda97fe (2026-08-28). Data as JSON: /api/errors/f304e9ad8d5f2ad7. Report an issue: GitHub.