-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
Optimizing Fonts #174
Comments
I noticed that tabi takes advantage of the modern variable fonts feature in CSS, so it may be difficult to use non-variable fonts like the 400/600/700 ones. I also saw the font charsets with FontForge. Overall, I think optimizations can be done on a case-by-case basis and feel like the current fonts are already good for a majority of users. |
I'm interested in reducing the size of the resources, so I'll definitely look into some options in regards to fonts. |
The Potential advantages include more consistent fonts across a variety of browsers. qutebrowser has trouble showing some of the current font weights, for example. |
I can't use the webfonts helper as I'm using the latest Inter version, not available in Google Fonts. Here's what I did: Coding FontFor the mono/code font (Cascadia Code), I've ran: pyftsubset CascadiaCode-SemiLight.woff2 \
--layout-features="kern,liga" \
--desubroutinize \
--unicodes=U+0020-007E,U+00A0-00FF \
--flavor=woff2 \
--output-file=font_with_accents.woff2 This compresses the font file from 133KB to 13KB. The font includes:
I believe this subset should be sufficient for code formatting in the vast majority of use-cases, satisfying 99.9% of users. Serif & Sans SerifFor the serif and sans-serif fonts, I've ran: pyftsubset SourceSerif4Variable-Roman.otf.woff2 \
--layout-features="kern,liga" \
--desubroutinize \
--unicodes="U+0020-00FF,U+0100-024F,U+1E00-1EFF,\
U+0400-052F,U+0391-03D6,\
U+4E00-9FFF,U+3400-4DBF,U+20000-2A6DF,\
U+3040-309F,U+30A0-30FF,\
U+0600-06FF,U+2000-206F" \
--flavor=woff2 \
--output-file=optimized_font.woff2 pyftsubset InterVariable.woff2 \
--layout-features="kern,liga,calt" \
--desubroutinize \
--unicodes="U+0020-00FF,U+0100-024F,U+1E00-1EFF,\
U+0400-052F,U+0391-03D6,\
U+4E00-9FFF,U+3400-4DBF,U+20000-2A6DF,\
U+3040-309F,U+30A0-30FF,\
U+0600-06FF,U+2000-206F,U+2190-21FF" \
--flavor=woff2 \
--output-file=optimized_font_with_kerning.woff2 This subset includes:
This configuration should cover a broad spectrum of languages and scripts, aiming to satisfy most use-cases. This brings the sans serif font, Inter-4.0-beta9h, from 326KB to 168KB. The serif font, Source Serif 4, went from to 429KB to 253KB. Aggregated, this takes the font sizes from 803KB to 434; almost half of the original size. I will be doing a PR with these changes soon. |
That sounds awesome! Thanks for working on this! |
Done! Thanks for requesting this, I had been meaning to look into it. PR: #186. You might be interested in the last section, which includes instructions to create your own—potentially much smaller— subsets without needing to modify the theme's files. |
Feature Request
Summary
I noticed that fonts total to 822 KB when loading a blog post, which is about 3/4 the size of a page.
The fonts on google-webfonts-helper are generally smaller, so I assume some optimization can be done to significantly reduce the file sizes.
Motivation
Faster load times. Only load what's used.
Detailed Description
Additional Context
Should users be able to customize the fonts used? Specifying fonts can be useful especially if system fonts are preferred.
The text was updated successfully, but these errors were encountered: