Skip to content
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

perf: create junicode subset to improve performance #400

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

flyri0
Copy link

@flyri0 flyri0 commented Jan 2, 2025

As mentioned in #389, both font families (Junicode and Junicode-Italic) were over 1 MB in size but not heavily used on the site. To optimize this, I created subsets of both font families using glyphhanger and fonttools/pyftsubset. The subsets now contain only the characters that are actively being used.

This process resulted in the following size reductions:

JunicodeVF-Italic: reduced from 1.11 MB to 5.19 KB (99.53% reduction)
JunicodeVF-Roman: reduced from 1.06 MB to 16.5 KB (98.48% reduction)

Additionally, I disabled several unused OpenType features. The parameters used for pyftsubset were as follows:

--flavor=woff2 --layout-features='liga,kern' --no-hinting

You can view a comparison of the subset and the original font here. Some features would need to be enabled to maintain the font's appearance identical to the original. It's up to us to decide if it's worth it.

If you need to create new subsets, here are the relevant resources:
Glyphhanger repository
FontTools pyftsubset documentation

@NOCanoa NOCanoa requested a review from mauro-balades January 2, 2025 22:50
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.

1 participant