diff --git a/assets/fonts/.gitignore b/assets/fonts/.gitignore new file mode 100644 index 0000000..d259f05 --- /dev/null +++ b/assets/fonts/.gitignore @@ -0,0 +1 @@ +*.ttf diff --git a/assets/fonts/fetch.sh b/assets/fonts/fetch.sh new file mode 100755 index 0000000..f64a534 --- /dev/null +++ b/assets/fonts/fetch.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +set -euo pipefail + +FORCE=0 +if [[ "${1:-}" == "--force" ]]; then + FORCE=1 +fi + +BASE_URL="https://github.com/google/fonts/raw/refs/heads/main/" + +declare -A FONTS=( + ["Roboto.ttf"]="ofl/roboto/Roboto%5Bwdth,wght%5D.ttf" + ["NotoSans.ttf"]="ofl/notosans/NotoSans%5Bwdth,wght%5D.ttf" + ["NotoSansSC.ttf"]="ofl/notosanssc/NotoSansSC%5Bwdth,wght%5D.ttf" +) + +for filename in "${!FONTS[@]}"; do + font_path="${FONTS[$filename]}" + url="${BASE_URL}${font_path}" + + if [[ -f "$filename" && $FORCE -eq 0 ]]; then + echo "Skipping $filename (already exists)" + fi + + echo "Fetching $filename from $url" + curl -L "$url" -o "$filename" +done