mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 21:38:38 +00:00
Merge branch 'main' of https://github.com/migatu/conjurer
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
#!/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
|
||||
Executable
+141
@@ -0,0 +1,141 @@
|
||||
#!/usr/bin/env bash
|
||||
# System-wide install & verify (Debian/RPi):
|
||||
# - EB Garamond (APT)
|
||||
# - Cinzel Decorative Black (RAW TTF)
|
||||
# - IM Fell English SC (gstatic/RAW)
|
||||
# No TeX build here. Very verbose + clear final report.
|
||||
|
||||
set -Eeuo pipefail
|
||||
|
||||
SUDO=sudo; [ "$(id -u)" -eq 0 ] && SUDO=
|
||||
log(){ echo -e "[+] $*"; }
|
||||
warn(){ echo -e "[WARN] $*" >&2; }
|
||||
die(){ echo -e "[FATAL] $*" >&2; exit 1; }
|
||||
|
||||
need(){ command -v "$1" >/dev/null 2>&1 || die "Missing tool: $1"; }
|
||||
fetch(){
|
||||
local url="$1" out="$2"
|
||||
if command -v wget >/dev/null 2>&1; then
|
||||
log "wget -> $url"
|
||||
wget -O "$out" --https-only --no-verbose "$url"
|
||||
else
|
||||
log "curl -> $url"
|
||||
curl -L --fail --show-error --output "$out" "$url"
|
||||
fi
|
||||
}
|
||||
|
||||
# ---- detection using fc-list families (robust, no PCRE) ----
|
||||
fc_families_lower() {
|
||||
fc-list -f '%{family}\n' \
|
||||
| tr ',' '\n' \
|
||||
| sed 's/^[[:space:]]*//; s/[[:space:]]*$//' \
|
||||
| tr '[:upper:]' '[:lower:]' \
|
||||
| sort -u
|
||||
}
|
||||
has_family_re() { # $1 = POSIX ERE anchored-at-start pattern (lowercase)
|
||||
fc_families_lower | grep -Eiq "$1"
|
||||
}
|
||||
|
||||
# ---- prereqs ----
|
||||
for t in fc-cache fc-list grep sed awk; do need "$t"; done
|
||||
command- v wget >/dev/null 2>&1 || command -v curl >/dev/null 2>&1 || die "Need wget or curl"
|
||||
|
||||
SYSTEM_DIR="/usr/local/share/fonts/dj"
|
||||
DIR_CINZEL="$SYSTEM_DIR/cinzel-decorative"
|
||||
DIR_IMFELL="$SYSTEM_DIR/im-fell-english-sc"
|
||||
$SUDO mkdir -p "$DIR_CINZEL" "$DIR_IMFELL"
|
||||
|
||||
echo "=== APT phase (EB Garamond) ==="
|
||||
if command -v apt-get >/dev/null 2>&1; then
|
||||
$SUDO apt-get update -y || warn "apt update failed (continuing)"
|
||||
if $SUDO apt-get install -y --no-install-recommends fonts-ebgaramond; then
|
||||
log "installed: fonts-ebgaramond"
|
||||
else
|
||||
warn "apt install failed: fonts-ebgaramond"
|
||||
fi
|
||||
else
|
||||
warn "apt-get not found — skipping"
|
||||
fi
|
||||
|
||||
echo
|
||||
log "Families BEFORE web fallback (sample grep):"
|
||||
fc-list | grep -Ei "Garamond|Cinzel|Fell" || echo " (none)"
|
||||
|
||||
echo
|
||||
echo "=== Web fallback (system-wide to $SYSTEM_DIR) ==="
|
||||
|
||||
# --- Cinzel Decorative Black ---
|
||||
CINZEL_TTF="$DIR_CINZEL/CinzelDecorative-Black.ttf"
|
||||
if ! has_family_re '^cinzel decorative( |$)'; then
|
||||
fetch "https://github.com/google/fonts/raw/main/ofl/cinzeldecorative/CinzelDecorative-Black.ttf" "$CINZEL_TTF" || warn "Cinzel Decorative Black download failed"
|
||||
[ -s "$CINZEL_TTF" ] && $SUDO chmod 0644 "$CINZEL_TTF"
|
||||
else
|
||||
log "Cinzel Decorative already present."
|
||||
fi
|
||||
|
||||
# --- IM Fell English SC ---
|
||||
IMFELL_TTF="$DIR_IMFELL/IMFeENsc.ttf"
|
||||
if ! has_family_re '^im fell english sc( |$)'; then
|
||||
# Try known gstatic TTFs (stable direct links)
|
||||
for u in \
|
||||
"https://fonts.gstatic.com/s/imfellenglishsc/v7/h3Tn6yWfw4b5qaLD1RWvz5ATixNthKRRR1XVH3rJNiw.ttf" \
|
||||
"https://fonts.gstatic.com/s/imfellenglishsc/v6/h3Tn6yWfw4b5qaLD1RWvz5ATixNthKRRR1XVH3rJNiw.ttf"
|
||||
do
|
||||
if fetch "$u" "$IMFELL_TTF"; then
|
||||
[ -s "$IMFELL_TTF" ] && { $SUDO chmod 0644 "$IMFELL_TTF"; log "IM Fell SC from gstatic OK"; break; }
|
||||
fi
|
||||
done
|
||||
# Secondary RAW in google/fonts (names changed over time)
|
||||
if [ ! -s "$IMFELL_TTF" ]; then
|
||||
for u in \
|
||||
"https://github.com/google/fonts/raw/main/ofl/imfellenglishsc/IMFeENsc28P.ttf" \
|
||||
"https://github.com/google/fonts/raw/main/ofl/imfellenglishsc/IMFellEnglishSC-Regular.ttf"
|
||||
do
|
||||
if fetch "$u" "$IMFELL_TTF"; then
|
||||
[ -s "$IMFELL_TTF" ] && { $SUDO chmod 0644 "$IMFELL_TTF"; log "IM Fell SC from google/fonts RAW OK"; break; }
|
||||
fi
|
||||
done
|
||||
fi
|
||||
# Minimal mirror fallback (only if naprawdę trzeba)
|
||||
if [ ! -s "$IMFELL_TTF" ]; then
|
||||
for u in \
|
||||
"https://www.wfonts.com/download/data/2016/06/14/im-fell-english-sc/IMFeENsc28P.ttf" \
|
||||
"https://www.1001freefonts.com/d/6800/IMFeENsc28P.ttf"
|
||||
do
|
||||
fetch "$u" "$IMFELL_TTF" || true
|
||||
[ -s "$IMFELL_TTF" ] && { $SUDO chmod 0644 "$IMFELL_TTF"; log "IM Fell SC from mirror OK"; break; }
|
||||
done
|
||||
fi
|
||||
[ -s "$IMFELL_TTF" ] || warn "IM Fell English SC still missing."
|
||||
else
|
||||
log "IM Fell English SC already present."
|
||||
fi
|
||||
|
||||
echo
|
||||
log "Fix perms & rebuild cache..."
|
||||
$SUDO find "$SYSTEM_DIR" -type f -size 0 -print -delete || true
|
||||
$SUDO find "$SYSTEM_DIR" -type f \( -name "*.ttf" -o -name "*.otf" \) -exec chmod 0644 {} \; || true
|
||||
$SUDO find "$SYSTEM_DIR" -type d -exec chmod 0755 {} \; || true
|
||||
$SUDO fc-cache -f -v >/dev/null || warn "fc-cache returned non-zero"
|
||||
|
||||
# ---- FINAL REPORT ----
|
||||
echo
|
||||
log "FINAL STATUS (fc-list families & file presence)"
|
||||
families="$(fc_families_lower)"
|
||||
|
||||
report(){
|
||||
local label="$1" fam_re="$2" file_hint="$3"
|
||||
local fam_ok file_ok="n/a"
|
||||
if echo "$families" | grep -Eiq "$fam_re"; then fam_ok="OK"; else fam_ok="MISSING"; fi
|
||||
if [ -n "$file_hint" ]; then
|
||||
if [ -s "$file_hint" ]; then file_ok="yes"; else file_ok="no"; fi
|
||||
fi
|
||||
printf " %-22s : families=%-8s file=%-3s (%s)\n" "$label" "$fam_ok" "$file_ok" "${file_hint:-no-file-hint}"
|
||||
}
|
||||
|
||||
report "EB Garamond" '^eb garamond( |$)' "" # from APT
|
||||
report "Cinzel Decorative" '^cinzel decorative( |$)' "$CINZEL_TTF"
|
||||
report "IM Fell English SC" '^im fell english sc( |$)' "$IMFELL_TTF"
|
||||
|
||||
echo
|
||||
log "Done. (Run your LaTeX pipeline next.)"
|
||||
@@ -1,40 +0,0 @@
|
||||
#!/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
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
#!/usr/bin/env bash
|
||||
# "apt dla fontów": Google Fonts ZIP → GitHub (ofl RAW) → fonts.gstatic.com → mirrory.
|
||||
# System-wide install do /usr/local/share/fonts/fontget/<rodzina> + fc-cache.
|
||||
# Usage: sudo ./fontget.sh "IM Fell English SC" "Cinzel Decorative" "EB Garamond"
|
||||
|
||||
set -Eeuo pipefail
|
||||
SUDO=sudo; [ "$(id -u)" -eq 0 ] && SUDO=
|
||||
log(){ echo -e "[+] $*"; }
|
||||
warn(){ echo -e "[WARN] $*" >&2; }
|
||||
die(){ echo -e "[FATAL] $*" >&2; exit 1; }
|
||||
|
||||
need(){ command -v "$1" >/dev/null 2>&1 || die "Missing: $1"; }
|
||||
need fc-cache
|
||||
command -v wget >/dev/null 2>&1 || command -v curl >/dev/null 2>&1 || die "Need wget/curl"
|
||||
command -v unzip >/dev/null 2>&1 || warn "unzip missing — ZIP installs limited"
|
||||
command -v file >/dev/null 2>&1 || warn "file missing — MIME checks limited"
|
||||
command -v fc-list >/dev/null 2>&1 || die "Missing: fc-list"
|
||||
|
||||
fetch(){ local u="$1" o="$2"; if command -v wget >/dev/null 2>&1; then wget -O "$o" --https-only --no-verbose "$u"; else curl -L --fail --show-error --output "$o" "$u"; fi; }
|
||||
slug(){ echo "$1" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9]+/-/g; s/^-+|-+$//g'; }
|
||||
present(){ fc-list -f '%{family}\n' | tr ',' '\n' | sed 's/^[[:space:]]*//; s/[[:space:]]*$//' | tr '[:upper:]' '[:lower:]' | sort -u | grep -Eiq "$1"; }
|
||||
|
||||
install_dir="/usr/local/share/fonts/fontget"; $SUDO mkdir -p "$install_dir"
|
||||
|
||||
is_zip(){ command -v file >/dev/null 2>&1 && file "$1" | grep -qi zip; }
|
||||
gf_zip_try(){
|
||||
local name="$1" outdir="$2" enc zip
|
||||
enc="$(python3 - <<PY
|
||||
import urllib.parse,sys
|
||||
print(urllib.parse.quote(sys.argv[1]))
|
||||
PY
|
||||
"$name")" || enc="$(echo "$name" | sed 's/ /%20/g')"
|
||||
zip="$(mktemp /tmp/fontget.XXXXXX.zip)"
|
||||
if fetch "https://fonts.google.com/download?family=${enc}" "$zip"; then
|
||||
if is_zip "$zip"; then $SUDO mkdir -p "$outdir"; $SUDO unzip -o -q "$zip" -d "$outdir" || true; rm -f "$zip"; return 0; fi
|
||||
fi
|
||||
rm -f "$zip" || true; return 1
|
||||
}
|
||||
gh_ofl_try(){
|
||||
local family="$1" outdir="$2" html
|
||||
html="$(mktemp /tmp/ofl.$(slug "$family").html)"
|
||||
if fetch "https://github.com/google/fonts/tree/main/ofl/$(slug "$family")" "$html"; then
|
||||
mapfile -t paths < <(grep -Eo '/google/fonts/blob/main/ofl/'"$(slug "$family")"'/[^"]+\.(ttf|otf)' "$html" | sed 's|/blob/|/raw/|g' | sort -u)
|
||||
[ "${#paths[@]}" -gt 0 ] || { rm -f "$html"; return 1; }
|
||||
$SUDO mkdir -p "$outdir"
|
||||
for p in "${paths[@]}"; do fetch "https://github.com$p" "$outdir/$(basename "$p")" || true; done
|
||||
rm -f "$html"; return 0
|
||||
fi
|
||||
rm -f "$html"; return 1
|
||||
}
|
||||
gstatic_try(){ local out="$2"; shift 2; for u in "$@"; do fetch "$u" "$out" && [ -s "$out" ] && return 0; done; return 1; }
|
||||
|
||||
report(){ local label="$1" re="$2"; if present "$re"; then printf "RESULT: %-24s : OK\n" "$label"; else printf "RESULT: %-24s : FAIL\n" "$label"; fi }
|
||||
|
||||
if [ $# -lt 1 ]; then echo "Usage: $0 <Font Family> [Another ...]"; exit 1; fi
|
||||
|
||||
for family in "$@"; do
|
||||
echo; log "=== $family ==="
|
||||
fam_slug="$(slug "$family")"
|
||||
outdir="$install_dir/$fam_slug"
|
||||
$SUDO mkdir -p "$outdir"
|
||||
|
||||
case "$fam_slug" in
|
||||
cinzel-decorative|cinzel|cinzel-decorative-black)
|
||||
fetch "https://github.com/google/fonts/raw/main/ofl/cinzeldecorative/CinzelDecorative-Black.ttf" "$outdir/CinzelDecorative-Black.ttf" || warn "Cinzel fetch failed"
|
||||
;;
|
||||
im-fell-english-sc)
|
||||
gstatic_try "$fam_slug" "$outdir/IMFeENsc.ttf" \
|
||||
"https://fonts.gstatic.com/s/imfellenglishsc/v7/h3Tn6yWfw4b5qaLD1RWvz5ATixNthKRRR1XVH3rJNiw.ttf" \
|
||||
"https://fonts.gstatic.com/s/imfellenglishsc/v6/h3Tn6yWfw4b5qaLD1RWvz5ATixNthKRRR1XVH3rJNiw.ttf" \
|
||||
|| { fetch "https://github.com/google/fonts/raw/main/ofl/imfellenglishsc/IMFeENsc28P.ttf" "$outdir/IMFeENsc.ttf" || true
|
||||
[ -s "$outdir/IMFeENsc.ttf" ] || fetch "https://github.com/google/fonts/raw/main/ofl/imfellenglishsc/IMFellEnglishSC-Regular.ttf" "$outdir/IMFeENsc.ttf" || true
|
||||
[ -s "$outdir/IMFeENsc.ttf" ] || fetch "https://www.wfonts.com/download/data/2016/06/14/im-fell-english-sc/IMFeENsc28P.ttf" "$outdir/IMFeENsc.ttf" || true
|
||||
[ -s "$outdir/IMFeENsc.ttf" ] || fetch "https://www.1001freefonts.com/d/6800/IMFeENsc28P.ttf" "$outdir/IMFeENsc.ttf" || true; }
|
||||
;;
|
||||
eb-garamond|ebgaramond)
|
||||
# Najpierw apt (jeśli chcesz: sudo apt install fonts-ebgaramond), tu tylko web:
|
||||
gf_zip_try "$family" "$outdir" || gh_ofl_try "$family" "$outdir" || true
|
||||
;;
|
||||
*)
|
||||
gf_zip_try "$family" "$outdir" || gh_ofl_try "$family" "$outdir" || true
|
||||
;;
|
||||
esac
|
||||
|
||||
$SUDO find "$outdir" -type f -size 0 -print -delete || true
|
||||
$SUDO find "$outdir" -type f \( -name "*.ttf" -o -name "*.otf" \) -exec chmod 0644 {} \; || true
|
||||
$SUDO find "$outdir" -type d -exec chmod 0755 {} \; || true
|
||||
$SUDO fc-cache -f -v >/dev/null || true
|
||||
|
||||
case "$fam_slug" in
|
||||
cinzel* ) report "Cinzel Decorative" '^cinzel decorative( |$)' ;;
|
||||
im-fell-english-sc ) report "IM Fell English SC" '^im fell english sc( |$)' ;;
|
||||
eb-garamond* ) report "EB Garamond" '^eb garamond( |$)' ;;
|
||||
* ) report "$family" "$(echo "$family" | tr '[:upper:]' '[:lower:]' | sed 's/ /.* /g')" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo; log "All done."
|
||||
Binary file not shown.
Reference in New Issue
Block a user