3perf / website

The site of PerfPerfPerf, a web performance consulting agency
https://3perf.com
18 stars 4 forks source link

Add subsets for montserrat font-family to include "→" character #105

Closed vadikmash closed 1 year ago

vadikmash commented 1 year ago

Closes #91.


Used glyphhanger tool (version 5.0.0) to create subsets. To subset fonts in the future, please use the following commands:

# Installation
npm install -g glyphhanger
# Additional installation for working with woff2 format
pip install brotli

# Usage
glyphhanger --subset="*.woff2" --formats=woff2 --LATIN --whitelist=→      

This would create font subsets for all .woff2 fonts and output them in the same format with -subset postfix. It would also output unicode ranges, that you can use in your @font-face declarations in css.


To prevent unnecessary loading of fallback non-subset fonts on pages with certain types of emoji, I've used the following tools:

Current emoji unicode range: emoji-unicode-range.txt.

iamakulov commented 1 year ago

Darn, this is great!

Qq: while testing on the home page, I noticed that the full “Bold” font is downloaded in addition to the subsetted one:

Screenshot 2022-11-29 at 23 53 48

(See rows 3 and 4.)

Is there anything we can do to optimize this?

vadikmash commented 1 year ago

@iamakulov, hey!

I've fixed fallback non-subsetted fonts loading issue by excluding emoji unicode range from fallback @font-face declarations. image Also, updated PR description with more detailed explanation of how I did it and instructions for further font subsetting. Lmk if I missed anything or if you need more descriptive instructions.

iamakulov commented 1 year ago

Gah, the builds are now failing due to https://answers.netlify.com/t/builds-failing-because-they-started-using-npm-instead-of-yarn/79495. Will merge this in a couple days (hopefully the issue is fixed by that date).

vadikmash commented 1 year ago

@iamakulov, looks like Netlify checks have been fixed!