Skip to content

Instantly share code, notes, and snippets.

@smellman
Created December 19, 2025 08:55
Show Gist options
  • Select an option

  • Save smellman/97054ebf61ed56300141bc87721194b2 to your computer and use it in GitHub Desktop.

Select an option

Save smellman/97054ebf61ed56300141bc87721194b2 to your computer and use it in GitHub Desktop.
Font to SVG
#!/bin/bash
set -euo pipefail
if [ $# -ne 2 ]; then
echo "Usage: $0 PATH_TO/FONT.OTF OUTPUT_DIRECTORY" >&2
exit 1
fi
FONT="$1"
OUTPUT_DIR="$2"
echo "Converting font $FONT to SVGs in directory $OUTPUT_DIR"
mkdir -p "$OUTPUT_DIR"
fontforge -lang=ff -script /dev/stdin <<EOF
Open("$FONT")
SelectWorthOutputting()
Export("$OUTPUT_DIR/%u-%n.svg")
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment