vidya/assets/fonts/fetch.sh

29 lines
652 B
Bash
Executable file

#!/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