12# How the fonts here were made; the forge never runs this, it serves the3# outputs. Sources: the variable fonts in google/fonts (ofl/), under the SIL4# Open Font License (each family's OFL-*.txt is next to its fonts).5#6# python3 -m venv /tmp/fonts-venv && /tmp/fonts-venv/bin/pip install fonttools brotli7# PATH=/tmp/fonts-venv/bin:$PATH sh site/assets/fonts/make-fonts.sh <dir of sources>8#9# <dir> holds OpenSans[wdth,wght].ttf, NotoSansMono[wdth,wght].ttf,10# NotoSerif[wdth,wght].ttf and NotoSerif-Italic[wdth,wght].ttf. Each is11# pinned to its normal width (the pages never change it) and keeps a weight12# range, then is cut down to Latin, the punctuation, and the arrows, ticks,13# triangles and box drawing the templates print; a glyph a font lacks14# comes from the system's fonts.15set -eu16src=${1:?usage: make-fonts.sh <dir of source .ttf files>}17here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)18tmp=$(mktemp -d)19trap 'rm -rf "$tmp"' EXIT20# Basic Latin, Latin-1, the Latin Extended-A letters of European languages,21# general punctuation, the euro and trade marks, arrows, minus and the22# comparison signs, the branch sign, box drawing (stack indents), small23# triangles (folds) and ticks and crosses (CI).24uni='U+0020-007E,U+00A0-00FF,U+0100-017F,U+0192,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2190-21FF,U+2212,U+2260,U+2264-2265,U+2387,U+2500-257F,U+25B4-25BF,U+2713-2717'25make() { # make <source> <out> <weights>26 fonttools varLib.instancer -q -o "$tmp/$2.ttf" "$src/$1" wdth=100 "wght=$3"27 pyftsubset "$tmp/$2.ttf" --unicodes="$uni" --layout-features+=tnum,zero,case --flavor=woff2 \28 --no-hinting --desubroutinize --output-file="$here/$2.woff2"29}30make 'OpenSans[wdth,wght].ttf' open-sans 300:80031make 'NotoSansMono[wdth,wght].ttf' noto-sans-mono 400:70032make 'NotoSerif[wdth,wght].ttf' noto-serif 400:70033make 'NotoSerif-Italic[wdth,wght].ttf' noto-serif-italic 400:70034ls -l "$here"/*.woff2