4 no warnings 'syntax'; # if assignment
6 use List::Util 'first';
7 use File::Basename 'dirname';
11 my $convbin = './convert-ttf.pl';
12 my $outdir = '../ttfsupport';
13 my @ttfpath = '~/.fonts'; # local fallbacks
15 if (my $mspath = '/usr/share/fonts/truetype/msttcorefonts') {
16 if (my $src = first { -e } map { glob "$_/Verdana.ttf" } $mspath, @ttfpath) {
17 system $convbin, $src, "$outdir/verdana.inc.pl";
19 if (my $src = first { -e } map { glob "$_/Times_New_Roman.ttf" } $mspath, @ttfpath) {
20 system $convbin, $src, "$outdir/times.inc.pl";
22 if (my $src = first { -e } map { glob "$_/Arial.ttf" } $mspath, @ttfpath) {
23 system $convbin, $src, "$outdir/arial.inc.pl";
25 if (my $src = first { -e } map { glob "$_/Courier_New.ttf" } $mspath, @ttfpath) {
26 system $convbin, $src, "$outdir/courier.inc.pl";
28 if (my $src = first { -e } map { glob "$_/Comic_Sans_MS.ttf" } $mspath, @ttfpath) {
29 system $convbin, $src, "$outdir/comic.inc.pl";
31 if (my $src = first { -e } map { glob "$_/Georgia.ttf" } $mspath, @ttfpath) {
32 system $convbin, $src, "$outdir/georgia.inc.pl";
36 if (my $dvpath = '/usr/share/fonts/truetype/ttf-dejavu') {
37 if (my $src = first { -e } map { glob "$_/DejaVuSans.ttf" } $dvpath, @ttfpath) {
38 system $convbin, $src, "$outdir/dvsans.inc.pl";
40 if (my $src = first { -e } map { glob "$_/DejaVuSerif.ttf" } $dvpath, @ttfpath) {
41 system $convbin, $src, "$outdir/dvserif.inc.pl";
43 if (my $src = first { -e } map { glob "$_/DejaVuSansMono.ttf" } $dvpath, @ttfpath) {
44 system $convbin, $src, "$outdir/dvmono.inc.pl";
48 if (my $gdpath = '/usr/share/fonts/truetype/droid') {
49 if (my $src = first { -e } map { glob "$_/DroidSans.ttf" } $gdpath, @ttfpath) {
50 system $convbin, $src, "$outdir/droidsans.inc.pl";
52 if (my $src = first { -e } map { glob "$_/DroidSerif.ttf" } $gdpath, @ttfpath) {
53 system $convbin, $src, "$outdir/droidserif.inc.pl";
55 if (my $src = first { -e } map { glob "$_/DroidSansMono.ttf" } $gdpath, @ttfpath) {
56 system $convbin, $src, "$outdir/droidmono.inc.pl";
61 if (my $src = first { -e } map { glob "$_/code2000.ttf" } @ttfpath) {
62 system $convbin, $src, "$outdir/c2k.inc.pl";
64 if (my $src = first { -e } map { glob "$_/arial*uni*.ttf" } @ttfpath) {
65 system $convbin, $src, "$outdir/ariuni.inc.pl";
69 if (my $gupath = '/usr/share/fonts/truetype/unifont') {
70 if (my $src = first { -e } map { glob "$_/unifont.ttf" } $gupath, @ttfpath) {
71 system $convbin, $src, "$outdir/unifont.inc.pl";