1
0
mirror of https://github.com/ryanoasis/nerd-fonts.git synced 2024-12-01 16:55:57 +02:00

Adds first version of script to generate svg image previews for the website

This commit is contained in:
Ryan L McIntyre 2019-08-15 13:57:52 -07:00
parent 9331307d16
commit 8e34142d62

View File

@ -0,0 +1,16 @@
#!/bin/bash
output_dir="/home/ryan/projects/nerd-fonts-gh-pages/assets/img/previews/"
template_svg="lib/inkscape-template-font-preview.svg"
match_pattern="Nerd Font$"
readarray -t fonts < <( { fc-list --format="%{family[1]}\n" & fc-list --format="%{family[0]}\n"; } | sort | uniq | grep -i "$match_pattern" )
mkdir -p "$output_dir"
for font in "${fonts[@]}"; do
echo "generating image preview for font: '$font'"
sed -e "s/000000/ffffff/" -e "s/sans-serif/${font}/" -e "s/Font Name/${font}/" <"$template_svg" >"${output_dir}${font}.svg"
inkscape -f "${output_dir}${font}.svg" --with-gui --verb EditSelectAll --verb ObjectToPath --verb FileVacuum --verb FitCanvasToDrawing --verb FileSave --verb FileQuit
svgo "${output_dir}${font}.svg"
done