{"record":{"id":"f304e9ad8d5f2ad7","repo":"subframe7536/maple-font","slug":"font-weight-of-extrabold-must-be-800","errorCode":null,"errorMessage":"Font weight of `extrabold` must be 800","messagePattern":"Font weight of `extrabold` must be 800","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"source/py/utils.py","lineNumber":458,"sourceCode":"    os2.sTypoAscender = new_ascender  # type: ignore\n    os2.sTypoDescender = new_descender  # type: ignore\n    os2.usWinAscent = new_ascender  # type: ignore\n    os2.usWinDescent = -new_descender  # type: ignore\n\n\ndef patch_instance(font: TTFont, all_weight_map: dict[str, int]):\n    if all_weight_map == default_weight_map:\n        print(\"Skip weight remapping since nothing changed.\")\n        return\n\n    if \"fvar\" not in font or \"STAT\" not in font:\n        return\n\n    if all_weight_map[\"thin\"] != 100:\n        raise Exception(\"Font weight of `thin` must be 100\")\n\n    if all_weight_map[\"extrabold\"] != 800:\n        raise Exception(\"Font weight of `extrabold` must be 800\")\n\n    value_to_name = {v: k for k, v in default_weight_map.items()}\n\n    for instance in font[\"fvar\"].instances:  # type: ignore\n        current_weight = int(instance.coordinates[\"wght\"])\n        weight_name = value_to_name.get(current_weight)\n        if weight_name and weight_name in all_weight_map:\n            instance.coordinates[\"wght\"] = all_weight_map[weight_name]\n\n    axes = font[\"fvar\"].axes  # type: ignore\n    wght_index = next((i for i, ax in enumerate(axes) if ax.axisTag == \"wght\"), None)\n    if wght_index is None:\n        return\n\n    stat = font[\"STAT\"].table  # type: ignore\n    if not stat.AxisValueArray:\n        return\n","sourceCodeStart":440,"sourceCodeEnd":476,"githubUrl":"https://github.com/subframe7536/maple-font/blob/c08fda97fef73d68c1755219852150770f6e6578/source/py/utils.py#L440-L476","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set the extrabold weight back to 800 in the weight map / fvar instance configuration.","Verify the wght axis design space reaches 800 for the extrabold master/instance.","If 800 is intentionally not used, update patch_instance's hardcoded extrabold check and value_to_name mapping.","Diff your build config against upstream defaults to locate the changed extrabold value."],"exampleFix":"// before\n# weight_map = {\"extrabold\": 700, ...}\n// after\n# weight_map = {\"extrabold\": 800, ...}  # extrabold must be exactly 800","handlingStrategy":"validation","validationCode":"def assert_extrabold_is_800(weight_map):\n    if weight_map.get(\"extrabold\") != 800:\n        raise ValueError(\n            f\"extrabold weight must be 800 for variable-font patching, got {weight_map.get('extrabold')}\"\n        )","typeGuard":"def has_valid_weight_axis(all_weight_map: dict) -> bool:\n    return all_weight_map.get(\"thin\") == 100 and all_weight_map.get(\"extrabold\") == 800","tryCatchPattern":"try:\n    build_variable_fonts(...)\nexcept Exception as e:\n    if \"extrabold\" in str(e) and \"800\" in str(e):\n        print(\"Fix extrabold weight to 800 in the weight map config\")\n    raise","preventionTips":["Keep the wght axis maximum at 800 for extrabold in build config.","Validate the full weight map (thin=100, extrabold=800) before building.","Diff config changes against upstream defaults when altering weights.","Add a unit check that fvar extrabold instance coordinates == 800."],"tags":["font","variable-font","weight-axis","config"],"backgroundTag":"invalid-font-weight-value","analyzedSha":"c08fda97fef73d68c1755219852150770f6e6578","analyzedAt":"2026-08-28T22:07:29.503Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}