Repository navigation
fix(fonts): subset Inter by script with unicodeRange - #250
Open
faisalahammad wants to merge 1 commit into
Open
faisalahammad wants to merge 1 commit into
faisalahammad wants to merge 1 commit into
Conversation
- Split Inter into per-script woff2 subsets - Add bin/subset-inter.py to regenerate them - Document the update steps in CONTRIBUTING.md Inter is the text font, so it loads on every page. The browser now only downloads the scripts a page uses. Latin pages load about 71 KiB of Inter instead of 341 KiB. Fixes WordPress#194
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #194
Inter is the text font, so it loads on every page. The theme shipped the full variable fonts (341 KiB normal, 376 KiB italic), with every script and every stylistic set, even on pages with only Latin text.
This PR splits each Inter file into one file per script (latin, latin-ext, cyrillic, cyrillic-ext, greek, greek-ext, vietnamese, plus a symbols file for everything else) and gives each
fontFaceintheme.jsonaunicodeRange. The browser now only downloads the files a page needs.What changed:
assets/fonts/inter/: 16 subset files replace the 2 full files. Both variable axes (opsz,wght) and the copyright and license strings are kept. Stylistic sets and character variants are dropped, since the theme turns none of them on.tnumandcaseare kept.theme.json: onefontFaceper subset with itsunicodeRange. Latin is listed last, so it wins where ranges overlap.bin/subset-inter.py: regenerates the subsets from an Inter release and prints thefontFaceentries. It exits with an error if any character from the original font ends up in no subset.CONTRIBUTING.md: a short "Updating Inter" section.bin/andCONTRIBUTING.mdstay in this repository and don't ship with the theme.Screenshots
No visual change. The text renders the same, only the downloaded files are different.
Testing Instructions
inter-var-normal-latin.woff2(about 71 KiB) loads for Inter.inter-var-italic-latin.woff2(about 78 KiB) loads for italic Inter.Привет мир,Γειά σου κόσμεandTiếng Việt. Each renders in Inter, and the matching-cyrillic,-greekand-vietnamesefiles load.→ ½ ①to a paragraph. These render in Inter from the-symbolsfile.npm run lintpasses (stylelint, PHPCS, theme validation).Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus
Used for: Writing the subsetting script and the
theme.jsonentries. I reviewed the changes and tested the theme myself.