font: convert-allfonts: generic search
[sheet.git] / tools / convert-allfonts
index e7d1964bf835c439f2f227fcec80a3e63158af62..54322f54d8aa000d688773c24597da5f87c8fc35 100755 (executable)
@@ -1,51 +1,50 @@
 #!/bin/sh
+set -u
 
-cd $(dirname $0)
+cd $(dirname "$0")
 
-CONVBIN=./convert-ttf.pl
+CONVBIN=./mkttfinfo
 OUTDIR=../ttfsupport
-TTFDIR=~/.fonts
-
-# microsoft
-
-TTFDIR_MS=/usr/share/fonts/truetype/msttcorefonts
-if [ -e $TTFDIR_MS ]; then
-$CONVBIN $TTFDIR_MS/Verdana.ttf $OUTDIR/verdana.inc.pl
-$CONVBIN $TTFDIR_MS/Times_New_Roman.ttf $OUTDIR/times.inc.pl
-$CONVBIN $TTFDIR_MS/Arial.ttf $OUTDIR/arial.inc.pl
-$CONVBIN $TTFDIR_MS/Courier_New.ttf $OUTDIR/courier.inc.pl
-$CONVBIN $TTFDIR_MS/Comic_Sans_MS.ttf $OUTDIR/comic.inc.pl
-$CONVBIN $TTFDIR_MS/Georgia.ttf $OUTDIR/georgia.inc.pl
-fi
-
-# bitstream
-
-TTFDIR_DV=/usr/share/fonts/truetype/ttf-dejavu
-if [ -e $TTFDIR_DV ]; then
-$CONVBIN $TTFDIR_DV/DejaVuSans.ttf $OUTDIR/dvsans.inc.pl
-$CONVBIN $TTFDIR_DV/DejaVuSerif.ttf $OUTDIR/dvserif.inc.pl
-$CONVBIN $TTFDIR_DV/DejaVuSansMono.ttf $OUTDIR/dvmono.inc.pl
-fi
-
-# google
-
-TTFDIR_GD=/usr/share/fonts/truetype/droid
-if [ -e $TTFDIR_GD ]; then
-$CONVBIN $TTFDIR_DV/DroidSans.ttf $OUTDIR/droidsans.inc.pl
-$CONVBIN $TTFDIR_DV/DroidSerif.ttf $OUTDIR/droidserif.inc.pl
-$CONVBIN $TTFDIR_DV/DroidSansMono.ttf $OUTDIR/droidmono.inc.pl
-fi
-
-# other
-
-find $TTFDIR -iname code2000.ttf -exec \
-       $CONVBIN "{}" $OUTDIR/c2k.inc.pl \;
-
-find $TTFDIR -iname arial\*uni\*.ttf -exec \
-       $CONVBIN "{}" $OUTDIR/ariuni.inc.pl \;
-
-TTFDIR_GU=/usr/share/fonts/truetype/unifont/
-if [ -e $TTFDIR_GU ]; then
-$CONVBIN $TTFDIR_GU/unifont.ttf $OUTDIR/unifont.inc.pl
-fi
+
+INC=~/.fonts/\ /usr/share/fonts/truetype/
+INC=$INC\ ../data/macfonts/
+
+convfont () {
+       find $INC -name "$1" -print -quit |
+       xargs -i $CONVBIN {} $OUTDIR/$2.inc.pl
+}
+
+# /usr/share/fonts/truetype/msttcorefonts
+convfont Verdana.ttf verdana
+convfont Times_New_Roman.ttf times
+convfont Arial.ttf arial
+convfont Courier_New.ttf courier
+convfont Comic_Sans_MS.ttf comic
+convfont Georgia.ttf georgia
+
+convfont 'arial*uni*.ttf' ariuni
+
+# ../data/macfonts
+convfont Lucida\?Grande.ttf lucida
+convfont AppleGaramond.ttf garamond
+
+# /usr/share/fonts/truetype/ttf-dejavu
+convfont DejaVuSans.ttf dvsans
+convfont DejaVuSerif.ttf dvserif
+convfont DejaVuSansMono.ttf dvmono
+
+# /usr/share/fonts/truetype/droid
+convfont DroidSans.ttf droid
+convfont DroidSerif.ttf droidserif
+convfont DroidSansMono.ttf droidmono
+# /usr/share/fonts/truetype/roboto
+convfont Roboto-Regular.ttf roboto
+# /usr/share/fonts/truetype/noto
+convfont NotoSans-Regular.ttf noto
+convfont NotoSerif-Regular.ttf notoserif
+
+# /usr/share/fonts/truetype/unifont
+convfont unifont.ttf unifont
+
+convfont code2000.ttf c2k