-
Notifications
You must be signed in to change notification settings - Fork 1
Fix variable font loading on Safari iOS by using woff2 format #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,65 @@ | ||
| @import "./base.css"; | ||
|
|
||
| /* Safari iOS-compatible overrides for Fontsource variable fonts. | ||
| The @fontsource-variable/* packages imported in apps/web emit | ||
| src: ... format("woff2-variations"), which Safari iOS does not recognize. | ||
| Safari skips the unknown-format src and the font fails to load. Re-declaring | ||
| the same family/style/weight with format("woff2") overrides the broken rule | ||
| (later @font-face wins) and restores fonts on Safari iOS. */ | ||
| @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"); | ||
| } | ||
|
|
||
| @font-face { | ||
| font-family: "Inter Variable"; | ||
| font-style: italic; | ||
| font-display: swap; | ||
| font-weight: 100 900; | ||
| src: url(@fontsource-variable/inter/files/inter-latin-wght-italic.woff2) | ||
| format("woff2"); | ||
| } | ||
|
|
||
| @font-face { | ||
| font-family: "Montserrat Variable"; | ||
| font-style: normal; | ||
| font-display: swap; | ||
| font-weight: 100 900; | ||
| src: url(@fontsource-variable/montserrat/files/montserrat-latin-wght-normal.woff2) | ||
| format("woff2"); | ||
| } | ||
|
|
||
| @font-face { | ||
| font-family: "Montserrat Variable"; | ||
| font-style: italic; | ||
| font-display: swap; | ||
| font-weight: 100 900; | ||
| src: url(@fontsource-variable/montserrat/files/montserrat-latin-wght-italic.woff2) | ||
| format("woff2"); | ||
| } | ||
|
|
||
| @font-face { | ||
| font-family: "Source Code Pro Variable"; | ||
| font-style: normal; | ||
| font-display: swap; | ||
| font-weight: 200 900; | ||
| src: url(@fontsource-variable/source-code-pro/files/source-code-pro-latin-wght-normal.woff2) | ||
| format("woff2"); | ||
| } | ||
|
|
||
| @font-face { | ||
| font-family: "Source Code Pro Variable"; | ||
| font-style: italic; | ||
| font-display: swap; | ||
| font-weight: 200 900; | ||
| src: url(@fontsource-variable/source-code-pro/files/source-code-pro-latin-wght-italic.woff2) | ||
| format("woff2"); | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing
|
||
|
|
||
| @theme inline { | ||
| --font-montserrat: | ||
| "Montserrat Variable", "Montserrat", "Helvetica Neue", Helvetica, Arial, | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These new
@font-faceoverrides point to*-latin-*font files but omitunicode-range, which defaults toU+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 👍 / 👎.