X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/b5b3537710ed9f73e1c867e0cc27d50439eaf4cd..c7b7be5fc4d7a4fb9c85ba2e0938c5809dce8948:/tools/convert-allfonts diff --git a/tools/convert-allfonts b/tools/convert-allfonts index 9610114..54322f5 100755 --- a/tools/convert-allfonts +++ b/tools/convert-allfonts @@ -1,74 +1,50 @@ -#!/usr/bin/env perl -use strict; -use warnings; -no warnings 'syntax'; # if assignment +#!/bin/sh +set -u -use List::Util 'first'; -use File::Basename 'dirname'; +cd $(dirname "$0") -chdir dirname $0; +CONVBIN=./mkttfinfo +OUTDIR=../ttfsupport -my $convbin = './mkttfinfo'; -my $outdir = '../ttfsupport'; -my @ttfpath = '~/.fonts'; # local fallbacks +INC=~/.fonts/\ /usr/share/fonts/truetype/ +INC=$INC\ ../data/macfonts/ -if (my $mspath = '/usr/share/fonts/truetype/msttcorefonts') { - if (my $src = first { -e } map { glob "$_/Verdana.ttf" } $mspath, @ttfpath) { - system $convbin, $src, "$outdir/verdana.inc.pl"; - } - if (my $src = first { -e } map { glob "$_/Times_New_Roman.ttf" } $mspath, @ttfpath) { - system $convbin, $src, "$outdir/times.inc.pl"; - } - if (my $src = first { -e } map { glob "$_/Arial.ttf" } $mspath, @ttfpath) { - system $convbin, $src, "$outdir/arial.inc.pl"; - } - if (my $src = first { -e } map { glob "$_/Courier_New.ttf" } $mspath, @ttfpath) { - system $convbin, $src, "$outdir/courier.inc.pl"; - } - if (my $src = first { -e } map { glob "$_/Comic_Sans_MS.ttf" } $mspath, @ttfpath) { - system $convbin, $src, "$outdir/comic.inc.pl"; - } - if (my $src = first { -e } map { glob "$_/Georgia.ttf" } $mspath, @ttfpath) { - system $convbin, $src, "$outdir/georgia.inc.pl"; - } +convfont () { + find $INC -name "$1" -print -quit | + xargs -i $CONVBIN {} $OUTDIR/$2.inc.pl } -if (my $dvpath = '/usr/share/fonts/truetype/ttf-dejavu') { - if (my $src = first { -e } map { glob "$_/DejaVuSans.ttf" } $dvpath, @ttfpath) { - system $convbin, $src, "$outdir/dvsans.inc.pl"; - } - if (my $src = first { -e } map { glob "$_/DejaVuSerif.ttf" } $dvpath, @ttfpath) { - system $convbin, $src, "$outdir/dvserif.inc.pl"; - } - if (my $src = first { -e } map { glob "$_/DejaVuSansMono.ttf" } $dvpath, @ttfpath) { - system $convbin, $src, "$outdir/dvmono.inc.pl"; - } -} - -if (my $gdpath = '/usr/share/fonts/truetype/droid') { - if (my $src = first { -e } map { glob "$_/DroidSans.ttf" } $gdpath, @ttfpath) { - system $convbin, $src, "$outdir/droidsans.inc.pl"; - } - if (my $src = first { -e } map { glob "$_/DroidSerif.ttf" } $gdpath, @ttfpath) { - system $convbin, $src, "$outdir/droidserif.inc.pl"; - } - if (my $src = first { -e } map { glob "$_/DroidSansMono.ttf" } $gdpath, @ttfpath) { - system $convbin, $src, "$outdir/droidmono.inc.pl"; - } -} - -{ - if (my $src = first { -e } map { glob "$_/code2000.ttf" } @ttfpath) { - system $convbin, $src, "$outdir/c2k.inc.pl"; - } - if (my $src = first { -e } map { glob "$_/arial*uni*.ttf" } @ttfpath) { - system $convbin, $src, "$outdir/ariuni.inc.pl"; - } -} - -if (my $gupath = '/usr/share/fonts/truetype/unifont') { - if (my $src = first { -e } map { glob "$_/unifont.ttf" } $gupath, @ttfpath) { - system $convbin, $src, "$outdir/unifont.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