Skip to content

Commit

Permalink
Fix Sarabun font downloading
Browse files Browse the repository at this point in the history
  • Loading branch information
ThewBear committed Mar 31, 2024
1 parent 3ceb8fa commit 5014d22
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions .devcontainer/setupTex.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
#! /bin/bash
set -euo pipefail

wget -O ~/Sarabun.zip https://fonts.google.com/download?family=Sarabun
unzip ~/Sarabun.zip -d ~/.fonts/
# Download Sarabun font
# Download the JSON file
curl -s "https://fonts.google.com/download/list?family=Sarabun" > cv/sarabun_metadata_raw.txt
# Remove ")]}'" from the beginning of the file
tail -c +5 cv/sarabun_metadata_raw.txt > cv/sarabun_metadata.json
# Extract the necessary information from the JSON file
file_refs=$(jq -rc '.manifest.fileRefs[]' cv/sarabun_metadata.json)
# Download, rename the font files and save to ~/.fonts
while IFS= read -r file_ref; do
filename=$(echo "$file_ref" | jq -r '.filename')
url=$(echo "$file_ref" | jq -r '.url')
curl -s "$url" -o "~/.fonts/$filename"
done <<< "$file_refs"
rm cv/sarabun_*

echo '$xelatex = "xelatex -shell-escape";' >> ~/.latexmkrc

0 comments on commit 5014d22

Please sign in to comment.