Two util scripts

This commit is contained in:
2025-08-16 21:55:41 +02:00
parent ba80523d6c
commit 9f262e5d2f
2 changed files with 80 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
set -euo pipefail
exists() { command -v "$1" >/dev/null 2>&1; }
echo "[i] Checking environment..."
for c in fc-list pdffonts tectonic; do
if ! exists "$c"; then
echo " - $c: NOT FOUND (optional but recommended: sudo apt install -y fontconfig poppler-utils tectonic)"
else
echo " - $c: OK"
fi
done
echo "[i] Listing local ./fonts content:"
ls -l ./fonts 2>/dev/null || echo " (no ./fonts directory)"
if exists fc-list; then
echo "[i] System fonts (grep Garamond|Cinzel|FELL):"
fc-list | grep -Ei "Garamond|Cinzel|Fell" || echo " (none found in system)"
fi
pdfs=(dj_cheat_sheet_transitions.pdf dj_tracklist.pdf dj_mini_sheet.pdf dj_notes.pdf dj_setup_mapping.pdf dj_one_laptop_fallback.pdf dj_rider.pdf dj_podrecznik.pdf)
if exists pdffonts; then
for p in "${pdfs[@]}"; do
[ -f "$p" ] || continue
echo "[i] Fonts embedded in $p:"
pdffonts "$p" || true
done
else
echo "[!] pdffonts not installed; cannot list embedded fonts."
fi
echo "[i] Grepping last Tectonic log (if any .log files exist)..."
logs=$(ls -1 *.log 2>/dev/null || true)
if [ -n "$logs" ]; then
grep -Ei "fontspec|warning|not found" *.log || echo " (no relevant warnings)"
else
echo " (no .log files)"
fi
+40
View File
@@ -0,0 +1,40 @@
#!/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