mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2025-01-06 21:49:40 +02:00
31 lines
1007 B
Bash
Executable File
31 lines
1007 B
Bash
Executable File
#!/bin/bash
|
|
|
|
main() {
|
|
|
|
output_dir="/home/ryan/projects/nerd-fonts-gh-pages/assets/img/previews/"
|
|
template_svg="lib/inkscape-template-font-preview.svg"
|
|
|
|
mkdir -p "$output_dir"
|
|
|
|
for i in $(jq '.fonts | keys | .[]' lib/fonts.json); do
|
|
patchedName=$(jq -r ".fonts[$i].patchedName" lib/fonts.json);
|
|
#unpatchedName=$(jq -r ".fonts[$i].unpatchedName" lib/fonts.json);
|
|
imagePreviewFont=$(jq -r ".fonts[$i].imagePreviewFont" lib/fonts.json);
|
|
|
|
generate_preview "$imagePreviewFont" "$patchedName Nerd Font"
|
|
done
|
|
|
|
}
|
|
|
|
generate_preview() {
|
|
font=$1
|
|
fontText=$2
|
|
echo "generating image preview for font: '$font'"
|
|
sed -e "s/000000/ffffff/" -e "s/sans-serif/${font}/" -e "s/Font Name/${fontText}/" <"$template_svg" >"${output_dir}${fontText}.svg"
|
|
inkscape -f "${output_dir}${fontText}.svg" --with-gui --verb EditSelectAll --verb ObjectToPath --verb FileVacuum --verb FitCanvasToDrawing --verb FileSave --verb FileQuit &>/dev/null &
|
|
svgo "${output_dir}${fontText}.svg"
|
|
}
|
|
|
|
main "$@"; exit
|
|
|