4 no warnings 'syntax'; # if assignment
6 use List::Util 'first';
7 use File::Basename 'dirname';
11 my $convbin = './mkttfinfo';
12 my $outdir = '../ttfsupport';
13 my @ttfpath = ('~/.fonts', '../data/osx-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 $ampath = '/usr/share/fonts/truetype/macfonts') {
37 if (my $src = first { -e } map { glob "$_/Lucida?Grande.ttf" } $ampath, @ttfpath) {
38 system $convbin, $src, "$outdir/lucida.inc.pl";
40 if (my $src = first { -e } map { glob "$_/AppleGaramond.ttf" } $ampath, @ttfpath) {
41 system $convbin, $src, "$outdir/garamond.inc.pl";
45 if (my $dvpath = '/usr/share/fonts/truetype/ttf-dejavu') {
46 if (my $src = first { -e } map { glob "$_/DejaVuSans.ttf" } $dvpath, @ttfpath) {
47 system $convbin, $src, "$outdir/dvsans.inc.pl";
49 if (my $src = first { -e } map { glob "$_/DejaVuSerif.ttf" } $dvpath, @ttfpath) {
50 system $convbin, $src, "$outdir/dvserif.inc.pl";
52 if (my $src = first { -e } map { glob "$_/DejaVuSansMono.ttf" } $dvpath, @ttfpath) {
53 system $convbin, $src, "$outdir/dvmono.inc.pl";
57 if (my $gdpath = '/usr/share/fonts/truetype/droid') {
58 if (my $src = first { -e } map { glob "$_/DroidSans.ttf" } $gdpath, @ttfpath) {
59 system $convbin, $src, "$outdir/droidsans.inc.pl";
61 if (my $src = first { -e } map { glob "$_/DroidSerif.ttf" } $gdpath, @ttfpath) {
62 system $convbin, $src, "$outdir/droidserif.inc.pl";
64 if (my $src = first { -e } map { glob "$_/DroidSansMono.ttf" } $gdpath, @ttfpath) {
65 system $convbin, $src, "$outdir/droidmono.inc.pl";
70 if (my $src = first { -e } map { glob "$_/code2000.ttf" } @ttfpath) {
71 system $convbin, $src, "$outdir/c2k.inc.pl";
73 if (my $src = first { -e } map { glob "$_/arial*uni*.ttf" } @ttfpath) {
74 system $convbin, $src, "$outdir/ariuni.inc.pl";
78 if (my $gupath = '/usr/share/fonts/truetype/unifont') {
79 if (my $src = first { -e } map { glob "$_/unifont.ttf" } $gupath, @ttfpath) {
80 system $convbin, $src, "$outdir/unifont.inc.pl";