The best way to reduce the weight of a font is to cut out unnecessary symbols from it. The fonttools library is suitable for this. This docker helps build an environment for work.
- Add fonts to the folder.
- The unicodes.txt file contains a whitelist of characters that will remain.
- In docker-compose you can change the command settings.
docker compose up --build
You can check the results on the website wakamaifondue.com.
Unicode character sets can be found on symbl.cc or wikipedia.org. The default sets for the Inter font are taken from here. Use # to comment out unnecessary things.
Documentation for the subset command can be found on the fonttools.readthedocs.io. Some useful things:
- Use a flag
--flavor=woff2
or--with-zopfli --flavor=woff
to generate fonts in the required formats. - Use a flag
--layout-features-=frac,nums,dnom
to remove some features. - Use a flag
--verbose
to display information of the subsetting process.