matrix-doc/static/css/fonts
Andrew Morgan a786fa980d
Rename assets-hugo directory to assets (#3259)
Now that we've dropped the old build pipeline (and an assets directory does not exist in the repo any longer, we can rename the hugo version of the assets (assets-hugo) created during the build tools migration back to simply assets.
2022-01-06 10:34:56 +00:00
..
Inter.css Opt for serving new spec JS/CSS dependencies locally instead of downloading from CDNs (#3036) 2021-03-02 14:58:26 +00:00
README.md Rename assets-hugo directory to assets (#3259) 2022-01-06 10:34:56 +00:00
download_google_fonts_css.py Write font files as binary instead of text (#3039) 2021-03-03 10:39:26 +00:00
requirements.txt Opt for serving new spec JS/CSS dependencies locally instead of downloading from CDNs (#3036) 2021-03-02 14:58:26 +00:00

README.md

Fonts

Inter.css

Inter.css is a local copy of https://fonts.googleapis.com/css?family=Inter:300,300i,400,400i,700,700i, modified to pull font files (.woff2) from local sources. It was created using download_google_fonts_css.py.

download_google_fonts_css.py

download_google_fonts_css.py is a script that takes a google fonts CSS URL, downloads the file and linked fonts, then saves the fonts locally along with a modified CSS file to load them. Example call:

python3 download_google_fonts_css.py \
  "https://fonts.googleapis.com/css?family=Inter:300,300i,400,400i,700,700i" \
  ../../fonts \
  ../../fonts 

Which would pop out a Inter.css file that should be @import url("Inter.css")d somewhere in the site's SCSS (currently in /assets/scss/_variables_project.scss).

Re-running the script and committing any new files is only necessary when a desired font updates (not very often), or we want to change the font we're using. In that case, remove the existing font files at /static/fonts/*.woff2 and re-run the script with a different URL.