#!/usr/bin/env bash set -euo pipefail need() { command -v "$1" >/dev/null 2>&1 || { echo "Missing: $1" >&2; exit 1; }; } echo "[+] Checking tools..." need wget need unzip need tectonic || { echo "Install tectonic first (e.g. sudo apt install tectonic)"; exit 1; } mkdir -p fonts echo "[+] Downloading EB Garamond (Initials) to ./fonts ..." tmpzip="/tmp/ebgaramond.zip" wget -q -O "$tmpzip" https://github.com/octaviopardo/EBGaramond/releases/download/v0.016/EBGaramond-ttf.zip unzip -jq "$tmpzip" "*Initials*.ttf" -d fonts ls -1 fonts | grep -i initials || echo "WARN: EBGaramond Initials not found in zip?" echo "[+] Downloading Cinzel Decorative (Black) to ./fonts ..." tmpzip="/tmp/cinzel.zip" wget -q -O "$tmpzip" "https://fonts.google.com/download?family=Cinzel%20Decorative" || true unzip -jq "$tmpzip" "*Decorative-Black*.ttf" -d fonts || echo "WARN: Cinzel Decorative Black not found; continuing." echo "[+] (Optional) Downloading IM FELL English SC to ./fonts ..." tmpzip="/tmp/imfell.zip" wget -q -O "$tmpzip" "https://fonts.google.com/download?family=IM%20Fell%20English%20SC" || true unzip -jq "$tmpzip" "*.ttf" -d fonts || echo "INFO: IM FELL SC optional; skip if not needed." echo "[+] Building PDFs with Tectonic..." for f in dj_cheat_sheet_transitions.tex dj_tracklist.tex dj_mini_sheet.tex dj_notes.tex dj_setup_mapping.tex dj_one_laptop_fallback.tex dj_rider.tex dj_podrecznik.tex; do if [ -f "$f" ]; then echo " -> $f" tectonic "$f" >/dev/null else echo "SKIP: $f not found" fi done echo "[+] Done. Generated PDFs:" ls -1 *.pdf 2>/dev/null || true