geometra/scripts/gen_fonts.sh

29 lines
613 B
Bash
Executable File

#!/usr/bin/env bash
msdf="msdf-atlas-gen"
gen_glyph_map="dune exec --no-print-directory --display=quiet scripts/gen_glyph_map.exe"
out_dir=assets/fonts/
mkdir -p $out_dir
function gen() {
echo "$1..."
dst_png=$out_dir/$1.png
dst_map=$out_dir/$1.map
src=$(find /usr/share/fonts -name $2)
emsize=$3
[[ "$src" -nt "$dst_png" ]] &&
($msdf \
-font $src \
-imageout $dst_png \
-json >($gen_glyph_map > $dst_map) \
-size $emsize \
-yorigin top \
| exit 1)
}
gen liberation LiberationMono-Regular.ttf 64