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:
parent
9331307d16
commit
8e34142d62
16
bin/scripts/generate-font-image-previews.sh
Executable file
16
bin/scripts/generate-font-image-previews.sh
Executable 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
|
||||
|
Loading…
Reference in New Issue
Block a user