gen-fonts.elv 1.1 KB

1234567891011121314151617181920212223242526272829
  1. # Download the fonts needed by the website and downsize them by subsetting.
  2. #
  3. # External dependencies:
  4. # curl: for downloading files
  5. # fonttools: for processing font files
  6. # Subset of glyphs to include, other than ASCII. Discovered with:
  7. #
  8. # cat **.html | go run ./cmd/runefreq | sort -nr
  9. var subset = …’“”
  10. mkdir -p _fonts_tmp
  11. pwd=_fonts_tmp {
  12. @ssp-files-base = SourceSerif4-{Regular It Semibold SemiboldIt}
  13. for base $ssp-files-base {
  14. curl -C - -L -o $base.otf -s https://github.com/adobe-fonts/source-serif/raw/release/OTF/$base.otf
  15. }
  16. @fm-files-base = FiraMono-{Regular Bold}
  17. for base $fm-files-base {
  18. curl -C - -L -o $base.otf -s https://github.com/mozilla/Fira/raw/master/otf/$base.otf
  19. }
  20. for base [$@ssp-files-base $@fm-files-base] {
  21. # For some reason I don't understand, without U+386, the space (U+20) in
  22. # Fira Mono will be more narrow than other glyphs, so we keep it.
  23. fonttools subset $base.otf --output-file=../fonts/$base.woff2 --flavor=woff2 --with-zopfli ^
  24. --unicodes=00-7f,386 --text=$subset --layout-features-=dnom,frac,locl,numr --name-IDs=
  25. }
  26. }