PrintToVeraeTimeStamp/site/printit.verae.ai/fonts/fetch-fonts.example.sh
George Lambert da4a0dc4e2
Some checks failed
windows-msi / full-msi-unsigned (push) Has been cancelled
feat: fill-manifest-sha256.ps1 + CERT local font-face first
Hash helper for DOWNLOADS-MANIFEST; certificate.html prefers fonts/*.woff2 when present.
2026-10-14 00:27:11 -04:00

97 lines
4 KiB
Shell
Executable file

#!/usr/bin/env bash
# fetch-fonts.example.sh — placeholder download steps for CERT self-host fonts
#
# Does NOT download by default. Review licenses, then uncomment ONE source
# block and re-run. Binaries stay uncommitted until OFL/LICENSE is beside them.
#
# Target dir: this script's directory (site/printit.verae.ai/fonts/).
# Wire-up: see README.md. certificate.html probes this dir at load time —
# any valid planned woff2 → local @font-face; none → Google Fonts CDN.
#
# License reminder:
# Fraunces — SIL Open Font License 1.1 (OFL)
# JetBrains Mono — SIL Open Font License 1.1 (OFL)
# Commit OFL.txt / LICENSE next to any binary. Do not strip copyright notices.
set -euo pipefail
DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$DIR"
echo "CERT fonts dir: $DIR"
echo "This is an EXAMPLE script — no network fetch runs unless you uncomment."
echo
# ---------------------------------------------------------------------------
# Planned local names (keep stable once wired — see README.md)
# ---------------------------------------------------------------------------
# fraunces-opsz-wght-600.woff2
# fraunces-opsz-wght-700.woff2
# jetbrains-mono-500.woff2
# OFL.txt
# ---------------------------------------------------------------------------
# Option A — google/fonts GitHub release trees (OFL sources; pick a tag/commit)
# Comment-only reference URLs (do not curl until you pin a commit + verify OFL):
#
# # Fraunces variable / static under apache/ofl:
# # https://github.com/google/fonts/tree/main/ofl/fraunces
# # raw example (PIN A COMMIT — main moves):
# # https://raw.githubusercontent.com/google/fonts/<COMMIT>/ofl/fraunces/Fraunces%5Bopsz%2CSOFT%2CWONK%2Cwght%5D.ttf
# #
# # JetBrains Mono:
# # https://github.com/google/fonts/tree/main/ofl/jetbrainsmono
# # https://raw.githubusercontent.com/google/fonts/<COMMIT>/ofl/jetbrainsmono/JetBrainsMono%5Bwght%5D.ttf
# #
# # Upstream project pages (also OFL):
# # https://github.com/underscript-type/fraunces
# # https://github.com/JetBrains/JetBrainsMono
#
# Example curl skeleton (still commented — replace COMMIT and convert TTF→woff2
# with fonttools/woff2_compress; do not commit unlicensed or renamed dumps):
#
# # COMMIT=________________________________
# # curl -fsSL -o /tmp/fraunces.ttf \
# # "https://raw.githubusercontent.com/google/fonts/${COMMIT}/ofl/fraunces/Fraunces%5Bopsz%2CSOFT%2CWONK%2Cwght%5D.ttf"
# # # subset + woff2, then:
# # # cp fraunces-opsz-wght-700.woff2 "$DIR/"
# # curl -fsSL -o "$DIR/OFL.txt" \
# # "https://raw.githubusercontent.com/google/fonts/${COMMIT}/ofl/fraunces/OFL.txt"
#
# ---------------------------------------------------------------------------
# Option B — fonts.google.com CSS API (CDN helper; not for production self-host
# of binaries in-repo — use only to discover gstatic file URLs you already
# have rights to cache under OFL):
#
# # curl -fsSL -A "Mozilla/5.0" \
# # "https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=JetBrains+Mono:wght@500&display=swap"
# # # Then curl each https://fonts.gstatic.com/...woff2 URL into this dir
# # # with the planned filenames above. Still need OFL.txt from Option A.
#
# ---------------------------------------------------------------------------
if [[ "${1:-}" == "--check" ]]; then
missing=0
for f in fraunces-opsz-wght-600.woff2 fraunces-opsz-wght-700.woff2 OFL.txt; do
if [[ -f "$f" ]]; then
echo "OK $f"
else
echo "MISS $f"
missing=1
fi
done
if [[ -f jetbrains-mono-500.woff2 ]]; then
echo "OK jetbrains-mono-500.woff2 (optional)"
else
echo "skip jetbrains-mono-500.woff2 (optional)"
fi
exit "$missing"
fi
echo "No downloads performed."
echo "1. Pin a google/fonts commit or upstream release."
echo "2. Uncomment a curl block after license review."
echo "3. Place woff2 + OFL.txt here; run: $0 --check"
echo "4. Reload certificate.html — local @font-face auto-selects; CDN skipped."
echo
echo "Status: drop-in ready — binaries not committed (OPEN-ISSUES #7 still left)."