From 9f262e5d2fa9460378717decff0d613174ea3855 Mon Sep 17 00:00:00 2001 From: Polish Hammer Date: Sat, 16 Aug 2025 21:55:41 +0200 Subject: [PATCH] Two util scripts --- dj_debug_fonts.sh | 40 ++++++++++++++++++++++++++++++++++++++++ dj_oneclick_fix.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 dj_debug_fonts.sh create mode 100644 dj_oneclick_fix.sh diff --git a/dj_debug_fonts.sh b/dj_debug_fonts.sh new file mode 100644 index 0000000..f3557a4 --- /dev/null +++ b/dj_debug_fonts.sh @@ -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 diff --git a/dj_oneclick_fix.sh b/dj_oneclick_fix.sh new file mode 100644 index 0000000..2f025d8 --- /dev/null +++ b/dj_oneclick_fix.sh @@ -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