Skip to content

Fix variable font loading on Safari iOS by using woff2 format#22

Merged
cooper (czxtm) merged 1 commit intomainfrom
claude/fix-safari-ios-fonts-pqExK
Apr 30, 2026
Merged

Fix variable font loading on Safari iOS by using woff2 format#22
cooper (czxtm) merged 1 commit intomainfrom
claude/fix-safari-ios-fonts-pqExK

Conversation

@czxtm
Copy link
Copy Markdown
Contributor

Summary

This PR fixes variable font loading failures on Safari iOS by changing the font format declaration from the unsupported woff2-variations to the standard woff2 format. Safari iOS does not recognize the woff2-variations format string and skips the entire src declaration, causing fonts to fail to load.

Key Changes

  • base.css: Changed Google Sans Code Variable font format from woff2-variations to woff2 with explanatory comment
  • globals.css: Changed Google Sans Code Variable font format from woff2-variations to woff2 with reference to base.css documentation
  • web.css: Added Safari iOS-compatible @font-face overrides for three variable fonts:
    • Inter Variable (normal and italic)
    • Montserrat Variable (normal and italic)
    • Source Code Pro Variable (normal and italic)

Implementation Details

The solution leverages CSS cascade rules where later @font-face declarations override earlier ones with the same font-family, font-style, and font-weight range. By re-declaring the fonts with the standard woff2 format (which inherently supports variations), we override the broken declarations that use the unrecognized woff2-variations format. This ensures fonts load correctly on Safari iOS while maintaining compatibility with other browsers.

All font declarations include font-display: swap for optimal loading behavior and proper unicode-range specifications where applicable.

https://claude.ai/code/session_01FazMTBk3y6C9wYQYcAzYcS

Safari (notably iOS Safari) does not recognize the legacy
format("woff2-variations") keyword and silently skips the entire src,
leaving the font unloaded. WOFF2 inherently supports variations, so
format("woff2") is sufficient and is the modern recommendation.

Replace the broken keyword in our hand-written @font-face rules
(base.css, globals.css) and add overriding declarations in web.css for
the @fontsource-variable/{inter,montserrat,source-code-pro} fonts —
those packages emit the same broken format string, so re-declaring the
families with format("woff2") later in the cascade gives Safari iOS a
working source.
@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 30, 2026

PR Summary

Low Risk
CSS-only font-face changes scoped to font loading/cascade behavior; low chance of impacting runtime logic, with primary risk being unintended font selection/order on non-Safari browsers.

Overview
Fixes variable font loading failures on iOS Safari by switching @font-face src format from the unsupported format("woff2-variations") to format("woff2") for Google Sans Code Variable in base.css and globals.css (with added documentation).

Adds Safari iOS-specific @font-face override declarations in web.css for Inter Variable, Montserrat Variable, and Source Code Pro Variable (normal + italic) so the later, woff2-formatted rules win in the cascade when upstream font packages emit woff2-variations.

Reviewed by Cursor Bugbot for commit 6dea47c. Configure here.

@czxtm cooper (czxtm) merged commit e503daa into main Apr 30, 2026
7 of 8 checks passed
@czxtm cooper (czxtm) deleted the claude/fix-safari-ios-fonts-pqExK branch April 30, 2026 13:27
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 30, 2026

Preview pr-22 has been destroyed.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 30, 2026

Docs preview pr-22 has been destroyed.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6dea47c00e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment on lines +9 to +15
@font-face {
font-family: "Inter Variable";
font-style: normal;
font-display: swap;
font-weight: 100 900;
src: url(@fontsource-variable/inter/files/inter-latin-wght-normal.woff2)
format("woff2");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add unicode-range to latin-only override faces

These new @font-face overrides point to *-latin-* font files but omit unicode-range, which defaults to U+0-10FFFF. Because they reuse the same family/style/weight as the Fontsource definitions, this broad match can capture non-Latin text as well, causing Cyrillic/Greek/Vietnamese glyphs to fall back to other fonts instead of using the intended variable face. Limit these overrides to the Latin range (or add corresponding subset faces) so the Safari fix doesn’t regress international text rendering.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

Reviewed by Cursor Bugbot for commit 6dea47c. Configure here.

font-weight: 200 900;
src: url(@fontsource-variable/source-code-pro/files/source-code-pro-latin-wght-italic.woff2)
format("woff2");
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing unicode-range in Latin-only font override declarations

Medium Severity

All six new @font-face declarations reference Latin-only subset font files (e.g., inter-latin-wght-normal.woff2) but omit the unicode-range descriptor, defaulting to the full Unicode range. This is inconsistent with base.css, which correctly specifies unicode-range for its Latin-only Google Sans Code file. On non-Safari browsers where both the fontsource rules (with unicode-range subsets for cyrillic, greek, etc.) and these new rules coexist, the full-range override can take precedence over fontsource's non-Latin subset rules, causing non-Latin characters to fail to render with the correct font and fall back to system fonts instead.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6dea47c. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants