Files
webstudio/packages
Oleg Isonen cdbe9d99f5 fix: Accept custom variable font axes (#6152)
## What changed

- Replace the finite variable-font axis allowlist with validation for
OpenType’s four-character axis tag format.
- Preserve both registered axes and foundry-defined custom axes such as
`CNTR` in font metadata.
- Regenerate the runtime operation contracts so API consumers receive
the new axis-tag constraint.
- Refresh all project fixture bundle versions for the changed public
contract.
- Add regression coverage for a variable font metadata payload
containing `wght` and `CNTR`.

## Root cause

`fontkit` successfully parsed the supplied Antarctica WOFF2 files and
returned all four axes. Webstudio’s shared font schema then rejected
`CNTR` because the schema enumerated only known registered axes and a
small set of Roboto Flex custom axes. That validation failure surfaced
through the upload route as “Internal assets API error”.

The updated schema validates the OpenType axis-tag shape instead of
attempting to enumerate valid tags, so future registered axes and
conforming foundry-defined axes do not require code changes.

## User impact

Valid variable fonts with custom variation axes can be uploaded without
pinning or removing those axes. Existing static fonts and variable fonts
using standard axes keep the same behavior.

## Checklist

- [x] Reproduce the schema rejection with a `CNTR` regression test.
- [x] Confirm the regression test fails before the implementation change
and passes after it.
- [x] Validate the supplied passing Antarctica font and both previously
failing `CNTR` variants through `fontkit` and the updated production
schema.
- [x] Run the complete `@webstudio-is/fonts` test suite.
- [x] Run the complete `@webstudio-is/asset-uploader` test suite.
- [x] Run typechecks for `@webstudio-is/fonts`, `@webstudio-is/sdk`, and
`@webstudio-is/asset-uploader`.
- [x] Regenerate and verify runtime API contracts.
- [x] Refresh and build all project fixture bundles for the new contract
version.
- [x] Run the repository linter.
- [x] Review documentation impact: no documentation update is needed
because this restores support for valid input within the existing
variable-font upload behavior.

## Verification

- `pnpm --filter @webstudio-is/fonts test` — 10 tests passed
- `pnpm --filter @webstudio-is/asset-uploader test` — 196 tests passed
- `pnpm --filter @webstudio-is/protocol test` — 91 tests passed
- `pnpm --filter @webstudio-is/fonts typecheck`
- `pnpm --filter @webstudio-is/sdk typecheck`
- `pnpm --filter @webstudio-is/asset-uploader typecheck`
- `pnpm check:generated-api`
- `pnpm -r fixtures:build`
- `pnpm lint`
- Local supplied-font check: `PASS-antarctica-without-CNTR.woff2`,
`FAIL-antarctica-with-CNTR.woff2`, and
`FAIL-antarctica-raw-rebuild-with-CNTR.woff2` all validate with complete
axis metadata. The commercial binaries are not committed.

The full `pnpm fixtures` command reached the remote sync phase but could
not complete because `main.development.webstudio.is` still advertises
the pre-change bundle contract. The local fixture build and
compatibility tests pass with the refreshed version.

Closes #6151
2026-08-15 00:29:51 +02:00
..