4
# Copyright 2010 Kenshi Muto <kmuto@debian.org>
5
# License: GNU General Public License Version 2
7
my $orgt1dir = "/usr/share/fonts/type1";
8
my $gt1dir = "/usr/share/grace/fonts/type1";
9
my $fontbase = "/usr/share/grace/fonts/FontDataBase";
12
my($odir, $cdir) = @_;
13
opendir(my $dh, $odir);
14
my @files = readdir($dh);
17
recursiveLink("$odir/$_", $cdir) if -d "$odir/$_";
18
symlink("$odir/$_", "$cdir/$_") if -f "$odir/$_";
23
# cleanup (remove symlink only)
24
opendir(my $dh, $gt1dir) || die "Can't open $gt1dir: $!\n";
25
my @files = readdir($dh);
28
unlink "$gt1dir/$_" if -l "$gt1dir/$_";
32
# symlink from original font directory
33
recursiveLink($orgt1dir, $gt1dir);
35
# define essential Postscript font map
37
"Times-Roman" => "n021003l.pfb",
38
"Times-Italic" => "n021023l.pfb",
39
"Times-Bold" => "n021004l.pfb",
40
"Times-BoldItalic" => "n021024l.pfb",
41
"Helvetica" => "n019003l.pfb",
42
"Helvetica-Oblique" => "n019023l.pfb",
43
"Helvetica-Bold" => "n019004l.pfb",
44
"Helvetica-BoldOblique" => "n019024l.pfb",
45
"Courier" => "n022003l.pfb",
46
"Courier-Oblique" => "n022023l.pfb",
47
"Courier-Bold" => "n022004l.pfb",
48
"Courier-BoldOblique" => "n022024l.pfb",
49
"Symbol" => "s050000l.pfb",
50
"ZapfDingbats" => "d050000l.pfb",
55
open(my $ph, "fc-scan -f '%{fontformat}\t%{family}-%{style}\t%{file}\n' . |") || die "Can't execute fc-scan: $!\n";
58
my($fontformat, $familystyle, $file) = split(/\t/);
59
next if $fontformat ne "Type 1";
60
$familystyle =~ s/ //g;
62
$map{$familystyle} = $file;
67
open(my $fh, ">$fontbase") || die "Can't create $fontbase: $!\n";
68
print $fh (scalar(keys %map));
70
foreach (sort keys %map) {
71
print $fh "$_ $_ " . $map{$_} . "\n";