Created
August 23, 2020 17:13
-
-
Save ben-cohen/314cab3954c39333281bffc43cee6df7 to your computer and use it in GitHub Desktop.
Use XeLaTeX to create a sampler for each of the fonts available to the local system
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# fontlist.sh: Create a XeLaTeX document giving samples for each of the fonts | |
# available to the local system from fc-list, and run XeLaTeX on it ignoring | |
# errors. | |
# | |
# Ben Cohen, August 2020. | |
# | |
OUTFILE=fontlist.tex | |
cat > $OUTFILE <<-EOF | |
\\documentclass{article} | |
\\usepackage{fontspec} | |
\\usepackage[english]{babel} | |
\\usepackage{blindtext} | |
\\usepackage{xltxtra} | |
\\title{Samples of locally available fonts in \\XeLaTeX} | |
\\begin{document} | |
\\maketitle | |
EOF | |
IFS=$'\n' | |
for i in $(fc-list :outline -f "%{family}\n" | grep -o "^[^,]*" | grep -v "_") | |
do | |
cat >> $OUTFILE <<-EOF | |
\\setmainfont{$i} | |
\\section*{$i \\texttt{($i)}} | |
\\blindtext | |
EOF | |
done | |
cat >> $OUTFILE <<-EOF | |
\\end{document} | |
EOF | |
echo R | xelatex $OUTFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment