Skip to content

perf: subset and preload inter font - #3500

Merged
JammingBen merged 1 commit into
mainfrom
perf/subset-inter-font
Sep 30, 2026
Merged

JammingBen merged 1 commit into
mainfrom
perf/subset-inter-font

Conversation

@JammingBen

Copy link
Copy Markdown
Member

Description

Split the inter font into multiple smaller files per unicode range and preload the latin one to reduce the bytes loaded initially.

How the fonts can be created:

# 1. Fix opsz at 14 and limit wght to 400-700
fonttools varLib.instancer inter.woff2 opsz=14 wght=400:700 -o inter-400-700.ttf

# 2. One subset per script (unicode ranges from fonts.css)
pyftsubset inter-400-700.ttf \
  --unicodes="U+0000-00FF,U+0131,U+0152-0153,..." \
  --layout-features='*' \
  --flavor=woff2 \
  --output-file=inter-latin.woff2

closes #3375

Numbers

Font file Size
inter-latin.woff2 48.5 KB
inter-latin-ext.woff2 59.9 KB
inter-symbols.woff2 38.5 KB
inter-cyrillic-ext.woff2 17.0 KB
inter-cyrillic.woff2 13.2 KB
inter-greek.woff2 12.8 KB
inter-vietnamese.woff2 8.6 KB
inter-greek-ext.woff2 8.2 KB
Total (all subsets) 206.9 KB
inter.woff2 (old) 337.5 KB

Lighthouse

Benchmark Before After
FCP 1.3 s 1.1 s
LCP 1.9 s 1.7 s
Score 88 92

@JammingBen JammingBen self-assigned this Sep 30, 2026
@JammingBen
JammingBen marked this pull request as ready for review September 30, 2026 12:34
@JammingBen
JammingBen merged commit 5f5de9a into main Sep 30, 2026
32 checks passed
@JammingBen
JammingBen deleted the perf/subset-inter-font branch September 30, 2026 12:52
@openclouders openclouders mentioned this pull request Sep 30, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inter font asset is way too big

2 participants