-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfontmap.pl
executable file
·60 lines (52 loc) · 1.37 KB
/
fontmap.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#http://tex.stackexchange.com/questions/24002/turning-off-font-subsetting-in-pdftex
use strict;
my $default_map = `kpsewhich pdftex.map`;
open(F,"<$default_map");
my @map = ();
while (my $line=<F>) {
chomp $line;
# yvtri8r VenturisADF-Italic <8r.enc <yvtri8a.pfb "TeXBase1Encoding ReEncodeFont"
# "..." may also be before <'s; just eliminate it:
$line =~ s/".*"//;
#print "=$line=\n";
push @map,$line;
}
close(F);
local $/; # slurp whole file
my $log = <>;
#print "encs:\n";
my @enc = (''); # null string is because some lines in pdftex.map have no .enc
while ($log =~ /{([^}]+\.enc)}/g) {
my $enc = $1;
$enc =~ s/\n//g;
if ($enc =~ /([^\/]+)\.enc/) {
my $tail = $1;
#print "enc=$tail\n";
push @enc,$tail;
}
}
#print "pfbs:\n";
my @pfb = ();
while ($log =~ /<([^>]+\.pfb)>/g) {
my $pfb = $1;
$pfb =~ s/\n//g;
if ($pfb =~ /([^\/]+\.pfb)/) {
my $tail = $1;
#print "$tail\n";
push @pfb,$tail;
}
}
foreach my $enc(@enc) {
my $e = quotemeta $enc;
foreach my $pfb(@pfb) {
my $p = quotemeta $pfb;
foreach my $map(@map) {
#if ($pfb =~ /tipasl10/ && $enc eq '') {print "trying enc=$enc, pfb=$pfb, map=$map\n"}
if ( $map =~/$p/ && (($enc ne '' && $map =~ /$e/) || ($enc eq '' && ! ($map =~ /\.enc/)))) {
$map =~ s/(<[^ ]+.pfb)/<$1/;
#print "enc=$enc, pfb=$pfb, map=$map\n";
print "$map\n";
}
}
}
}