| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# RCS Status : $Id: Resources.pm,v 1.12 2004/12/18 16:40:52 jv Exp $# Author : Johan Vromans |
|
2
|
|
|
|
|
|
|
# Created On : Januari 1999 |
|
3
|
|
|
|
|
|
|
# Last Modified By: Johan Vromans |
|
4
|
|
|
|
|
|
|
# Last Modified On: Thu Oct 23 14:11:52 2003 |
|
5
|
|
|
|
|
|
|
# Update Count : 187 |
|
6
|
|
|
|
|
|
|
# Status : Released |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
################ Module Preamble ################ |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
package PostScript::Resources; |
|
11
|
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
1501
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
32
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
37
|
BEGIN { require 5.005; } |
|
15
|
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
374
|
use IO qw(File); |
|
|
1
|
|
|
|
|
699
|
|
|
|
1
|
|
|
|
|
4
|
|
|
17
|
1
|
|
|
1
|
|
7605
|
use File::Basename; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
99
|
|
|
18
|
1
|
|
|
1
|
|
5
|
use File::Spec; |
|
|
1
|
|
|
|
|
26
|
|
|
|
1
|
|
|
|
|
26
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
4
|
use vars qw($VERSION); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
1062
|
|
|
21
|
|
|
|
|
|
|
$VERSION = "1.03"; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $ResourcePath = "."; # default standard resource path |
|
24
|
|
|
|
|
|
|
my $defupr = "PSref.upr"; # principal resource file |
|
25
|
|
|
|
|
|
|
my $fn; # file currently being loaded |
|
26
|
|
|
|
|
|
|
my $fh; # handle of file currently being loaded |
|
27
|
|
|
|
|
|
|
my $section; # section currently being loaded |
|
28
|
|
|
|
|
|
|
my $exclusive; # last loaded file was exclusive |
|
29
|
|
|
|
|
|
|
my $rscidx; # current resource index |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $trace; |
|
32
|
|
|
|
|
|
|
my $debug; |
|
33
|
|
|
|
|
|
|
my $verbose; |
|
34
|
|
|
|
|
|
|
my $error; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub new { |
|
37
|
1
|
|
|
1
|
1
|
225
|
my $class = shift; |
|
38
|
1
|
|
50
|
|
|
17
|
my (%atts) = (path => $ENV{"PSRESOURCEPATH"} || "::", |
|
39
|
|
|
|
|
|
|
stdpath => $ResourcePath, |
|
40
|
|
|
|
|
|
|
error => 'die', # 'die', 'warn' or 'ignore' |
|
41
|
|
|
|
|
|
|
verbose => 0, |
|
42
|
|
|
|
|
|
|
trace => 0, |
|
43
|
|
|
|
|
|
|
debug => 0, |
|
44
|
|
|
|
|
|
|
@_); |
|
45
|
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
4
|
$debug = lc($atts{debug}); |
|
47
|
1
|
|
33
|
|
|
5
|
$trace = $debug || lc($atts{trace}); |
|
48
|
1
|
|
33
|
|
|
6
|
$verbose = $trace || lc($atts{verbose}); |
|
49
|
1
|
|
|
|
|
2
|
$error = lc($atts{error}); |
|
50
|
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
3
|
my $self = {}; |
|
52
|
1
|
|
|
|
|
2
|
bless $self, $class; |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# Get the resource paths. |
|
55
|
1
|
|
|
|
|
2
|
my $path = $atts{path}; |
|
56
|
1
|
|
|
|
|
2
|
$path =~ s|::|:$atts{stdpath}:|g; |
|
57
|
1
|
|
|
|
|
2
|
$path =~ s|^:||; |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# According to the specs, the file names are either literal, |
|
60
|
|
|
|
|
|
|
# absolute or relative. In the latter case, the current prefix |
|
61
|
|
|
|
|
|
|
# (which defaults to the directory of the .upr file) must be |
|
62
|
|
|
|
|
|
|
# appended. |
|
63
|
|
|
|
|
|
|
# To avoid lots of unnecessary file name parsing, each prefix |
|
64
|
|
|
|
|
|
|
# will be stored in a prefix array, and the index in this array |
|
65
|
|
|
|
|
|
|
# will be prepended to each file name entry. |
|
66
|
|
|
|
|
|
|
# The costly filename manipulation will only be done when a |
|
67
|
|
|
|
|
|
|
# filename needs to be returned (sub _buildfilename). |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# Create the prefix array and reset the index. |
|
70
|
1
|
|
|
|
|
7
|
$self->{prefix} = []; |
|
71
|
1
|
|
|
|
|
3
|
$rscidx = 0; |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# Process the entries in the list. |
|
74
|
1
|
|
|
|
|
6
|
foreach my $rsc ( split (":", $path) ) { |
|
75
|
|
|
|
|
|
|
|
|
76
|
1
|
50
|
|
|
|
3
|
print STDERR ("rsc#$rscidx: $rsc \n") if $debug; |
|
77
|
|
|
|
|
|
|
|
|
78
|
1
|
50
|
|
|
|
11
|
if ( -d $rsc ) { |
|
79
|
1
|
50
|
|
|
|
3
|
print STDERR ("rsc#$rscidx: $rsc \n") if $debug; |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# Directory. |
|
82
|
1
|
|
|
|
|
2
|
$exclusive = 0; |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# First check for a PSres.upr, and load it if possible. |
|
85
|
1
|
|
|
|
|
25
|
$fn = File::Spec->catfile ($rsc, "PSres.upr"); |
|
86
|
1
|
50
|
|
|
|
7
|
if ( -f $fn ) { |
|
87
|
0
|
0
|
|
|
|
0
|
print STDERR ("rsc#$rscidx: load $fn\n") if $debug; |
|
88
|
0
|
|
|
|
|
0
|
$rscidx++; |
|
89
|
0
|
|
|
|
|
0
|
eval { _loadFile ($self) }; |
|
|
0
|
|
|
|
|
0
|
|
|
90
|
0
|
0
|
|
|
|
0
|
if ( $@ ) { |
|
91
|
0
|
0
|
|
|
|
0
|
die ($@) if $error eq "die"; |
|
92
|
0
|
0
|
|
|
|
0
|
warn ($@) if $error eq "warn"; |
|
93
|
0
|
|
|
|
|
0
|
next; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# Unless PSres.upr was an exclusive resource, load all |
|
98
|
|
|
|
|
|
|
# files with .upr extension. |
|
99
|
1
|
50
|
|
|
|
3
|
unless ( $exclusive ) { |
|
100
|
1
|
|
|
|
|
2
|
my $dh = do { local *DH }; |
|
|
1
|
|
|
|
|
5
|
|
|
101
|
1
|
|
|
|
|
27
|
opendir ($dh, $rsc); |
|
102
|
1
|
|
|
|
|
44
|
my @files = grep (/\.upr$/, readdir ($dh)); |
|
103
|
1
|
|
|
|
|
10
|
closedir ($dh); |
|
104
|
1
|
|
|
|
|
3
|
foreach my $file ( @files ) { |
|
105
|
|
|
|
|
|
|
# Skip the PSres.upr. It is already loaded. |
|
106
|
2
|
50
|
|
|
|
8
|
next if $file eq "PSres.upr"; |
|
107
|
|
|
|
|
|
|
|
|
108
|
2
|
|
|
|
|
17
|
$fn = File::Spec->catfile ($rsc, $file); |
|
109
|
2
|
50
|
|
|
|
6
|
print STDERR ("rsc#$rscidx: load $fn\n") if $debug; |
|
110
|
2
|
|
|
|
|
2
|
$rscidx++; |
|
111
|
2
|
|
|
|
|
3
|
eval { _loadFile ($self) }; |
|
|
2
|
|
|
|
|
5
|
|
|
112
|
2
|
50
|
|
|
|
8
|
if ( $@ ) { |
|
113
|
0
|
0
|
|
|
|
0
|
die ($@) if $error eq "die"; |
|
114
|
0
|
0
|
|
|
|
0
|
warn ($@) if $error eq "warn"; |
|
115
|
0
|
|
|
|
|
0
|
next; |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
} |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
else { |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
# File. This is _not_ defined in the specs. |
|
123
|
|
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
0
|
$fn = $rsc; |
|
125
|
0
|
0
|
|
|
|
0
|
print STDERR ("rsc#$rscidx: load $fn\n") if $debug; |
|
126
|
0
|
|
|
|
|
0
|
$rscidx++; |
|
127
|
0
|
|
|
|
|
0
|
eval { _loadFile ($self) }; |
|
|
0
|
|
|
|
|
0
|
|
|
128
|
0
|
0
|
|
|
|
0
|
if ( $@ ) { |
|
129
|
0
|
0
|
|
|
|
0
|
die ($@) if $error eq "die"; |
|
130
|
0
|
0
|
|
|
|
0
|
warn ($@) if $error eq "warn"; |
|
131
|
0
|
|
|
|
|
0
|
next; |
|
132
|
|
|
|
|
|
|
} |
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
} |
|
135
|
|
|
|
|
|
|
|
|
136
|
1
|
|
|
|
|
5
|
$self; |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
sub FontAFM ($$) { |
|
140
|
1
|
|
|
1
|
1
|
6
|
my ($self, $font) = @_; |
|
141
|
1
|
50
|
|
|
|
7
|
return _buildfilename ($self, $font) |
|
142
|
|
|
|
|
|
|
if defined ($font = $self->{FontAFM}->{$font}); |
|
143
|
0
|
|
|
|
|
0
|
undef; |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub FontOutline ($$) { |
|
147
|
1
|
|
|
1
|
1
|
7
|
my ($self, $font) = @_; |
|
148
|
1
|
50
|
|
|
|
8
|
return _buildfilename ($self, $font) |
|
149
|
|
|
|
|
|
|
if defined ($font = $self->{FontOutline}->{$font}); |
|
150
|
0
|
|
|
|
|
0
|
undef; |
|
151
|
|
|
|
|
|
|
} |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
sub _buildfilename ($$) { |
|
154
|
2
|
|
|
2
|
|
3
|
my ($self, $name) = @_; |
|
155
|
2
|
|
|
|
|
3
|
my $i; |
|
156
|
2
|
|
|
|
|
12
|
($i, $name) = unpack ("IA*", $name); |
|
157
|
2
|
50
|
|
|
|
6
|
return $1 if $name =~ /^=(.*)$/; |
|
158
|
2
|
50
|
|
|
|
18
|
return $name if File::Spec->file_name_is_absolute ($name); |
|
159
|
2
|
|
|
|
|
27
|
File::Spec->canonpath (File::Spec->catfile ($self->{prefix}->[$i], $name)); |
|
160
|
|
|
|
|
|
|
} |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub _loadFile ($) { |
|
163
|
|
|
|
|
|
|
|
|
164
|
2
|
|
|
2
|
|
2
|
my ($self) = @_; |
|
165
|
|
|
|
|
|
|
|
|
166
|
2
|
|
|
|
|
3
|
my $data; # data |
|
167
|
|
|
|
|
|
|
|
|
168
|
2
|
|
|
|
|
2
|
eval { # so we can use die |
|
169
|
|
|
|
|
|
|
|
|
170
|
2
|
|
|
|
|
12
|
$fh = new IO::File; # font file |
|
171
|
2
|
|
|
|
|
101
|
my $sz = -s $fn; # file size |
|
172
|
|
|
|
|
|
|
|
|
173
|
2
|
50
|
|
|
|
8
|
$fh->open ($fn) || die ("$fn: $!\n"); |
|
174
|
2
|
50
|
|
|
|
74
|
print STDERR ($fn, ": Loading Resources\n") if $verbose; |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
# Read in the data. |
|
177
|
2
|
|
|
|
|
28
|
my $line = <$fh>; |
|
178
|
2
|
50
|
|
|
|
14
|
die ($fn."[$.]: Unrecognized file format\n") |
|
179
|
|
|
|
|
|
|
unless $line =~ /^PS-Resources-(Exclusive-)?([\d.]+)/; |
|
180
|
2
|
|
|
|
|
7
|
$exclusive = defined $1; |
|
181
|
2
|
|
|
|
|
3
|
my $version = $2; |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
# The resources file is organised in sections, each starting |
|
184
|
|
|
|
|
|
|
# with the section name and terminated by a line with just |
|
185
|
|
|
|
|
|
|
# a period. |
|
186
|
|
|
|
|
|
|
# Following the first PS-Resources line, the sections are |
|
187
|
|
|
|
|
|
|
# enumerated, e.g.: |
|
188
|
|
|
|
|
|
|
# |
|
189
|
|
|
|
|
|
|
# PS-Resources-1.0 |
|
190
|
|
|
|
|
|
|
# FontAFM |
|
191
|
|
|
|
|
|
|
# FontOutlines |
|
192
|
|
|
|
|
|
|
# FontFamily |
|
193
|
|
|
|
|
|
|
# FontPrebuilt |
|
194
|
|
|
|
|
|
|
# FontBDF |
|
195
|
|
|
|
|
|
|
# FontBDFSizes |
|
196
|
|
|
|
|
|
|
# . |
|
197
|
|
|
|
|
|
|
# |
|
198
|
|
|
|
|
|
|
# Optionally, the name of the resource directory follows. It |
|
199
|
|
|
|
|
|
|
# is preceded with a slash, e.g.: |
|
200
|
|
|
|
|
|
|
# |
|
201
|
|
|
|
|
|
|
# //usr/share/psresources |
|
202
|
|
|
|
|
|
|
# |
|
203
|
|
|
|
|
|
|
# This is then followed by each of the sections, e.g.: |
|
204
|
|
|
|
|
|
|
# |
|
205
|
|
|
|
|
|
|
# FontAFM |
|
206
|
|
|
|
|
|
|
# ... afm info ... |
|
207
|
|
|
|
|
|
|
# . |
|
208
|
|
|
|
|
|
|
# FontOutlines |
|
209
|
|
|
|
|
|
|
# ... outlines info ... |
|
210
|
|
|
|
|
|
|
# . |
|
211
|
|
|
|
|
|
|
# FontFamily |
|
212
|
|
|
|
|
|
|
# ... family info ... |
|
213
|
|
|
|
|
|
|
# . |
|
214
|
|
|
|
|
|
|
# |
|
215
|
|
|
|
|
|
|
# Backslash escapes are NOT handled, except for continuation. |
|
216
|
|
|
|
|
|
|
# |
|
217
|
|
|
|
|
|
|
# We have a _loadXXX subroutine for each section, where XXX is |
|
218
|
|
|
|
|
|
|
# the section name. Flexible and extensible. |
|
219
|
|
|
|
|
|
|
# |
|
220
|
|
|
|
|
|
|
# The current approach is to ignore the first section. |
|
221
|
|
|
|
|
|
|
|
|
222
|
2
|
|
|
|
|
7
|
$self->_skipSection ($fh); |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
# Then, load the sections from the file, skipping unknown ones. |
|
225
|
|
|
|
|
|
|
|
|
226
|
2
|
|
|
|
|
1
|
my $checkdir = 1; |
|
227
|
2
|
|
|
|
|
8
|
while ( defined ($section = _readLine ($self, $fh)) ) { |
|
228
|
4
|
|
|
|
|
5
|
chomp ($section); |
|
229
|
4
|
50
|
66
|
|
|
13
|
if ( $checkdir && $section =~ /^\/(.*)/ ) { |
|
230
|
0
|
|
|
|
|
0
|
$self->{prefix}->[$rscidx] = $1; |
|
231
|
0
|
|
|
|
|
0
|
$checkdir = 0; |
|
232
|
0
|
|
|
|
|
0
|
next; |
|
233
|
|
|
|
|
|
|
} |
|
234
|
4
|
|
|
|
|
6
|
$checkdir = 0; |
|
235
|
4
|
50
|
|
|
|
3
|
my $loader = defined &{"_load$section"} ? "_load$section" : |
|
|
4
|
|
|
|
|
16
|
|
|
236
|
|
|
|
|
|
|
"_skipSection"; |
|
237
|
1
|
|
|
1
|
|
6
|
no strict 'refs'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
905
|
|
|
238
|
4
|
50
|
33
|
|
|
9
|
die ($fn."[$.]: Premature end of $section section\n") |
|
239
|
|
|
|
|
|
|
if $fh->eof || !$loader->($self); |
|
240
|
|
|
|
|
|
|
} |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
}; |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
# Set the dfeault value for the directory prefix, if necessary. |
|
245
|
2
|
|
33
|
|
|
116
|
$self->{prefix}->[$rscidx] ||= dirname ($fn); |
|
246
|
|
|
|
|
|
|
|
|
247
|
2
|
|
|
|
|
12
|
$fh->close; |
|
248
|
2
|
50
|
|
|
|
23
|
die ($@) if $@; |
|
249
|
2
|
|
|
|
|
3
|
$self; |
|
250
|
|
|
|
|
|
|
} |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
sub _readLine () { |
|
253
|
|
|
|
|
|
|
# Read a line, handling continuation lines. |
|
254
|
22
|
|
|
22
|
|
14
|
my $line; |
|
255
|
22
|
|
|
|
|
20
|
while ( 1 ) { |
|
256
|
22
|
100
|
|
|
|
42
|
return undef if $fh->eof; |
|
257
|
20
|
|
|
|
|
87
|
$line .= <$fh>; |
|
258
|
20
|
50
|
|
|
|
36
|
if ( $line =~ /^(.*)\\$/ ) { |
|
259
|
0
|
|
|
|
|
0
|
$line = $1; |
|
260
|
0
|
|
|
|
|
0
|
redo; |
|
261
|
|
|
|
|
|
|
} |
|
262
|
20
|
50
|
|
|
|
29
|
$line = $1 if $line =~ /^(.*)%/; # remove comments |
|
263
|
20
|
|
|
|
|
90
|
$line =~ s/\s+$//; # remove trailing blanks |
|
264
|
20
|
50
|
|
|
|
38
|
next unless $line =~ /\S/; # skip empty lines |
|
265
|
20
|
|
|
|
|
48
|
return $line; |
|
266
|
|
|
|
|
|
|
} |
|
267
|
0
|
|
|
|
|
0
|
continue { $line = "" } |
|
268
|
0
|
|
|
|
|
0
|
undef; |
|
269
|
|
|
|
|
|
|
} |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
sub _loadFontAFM ($) { |
|
272
|
2
|
|
|
2
|
|
15
|
my ($self) = @_; |
|
273
|
2
|
50
|
|
|
|
8
|
print STDERR ($fn, "[$.]: Loading section $section\n") if $trace; |
|
274
|
|
|
|
|
|
|
|
|
275
|
2
|
|
|
|
|
1
|
my $afm; |
|
276
|
2
|
100
|
|
|
|
9
|
$afm = $self->{FontAFM} = {} |
|
277
|
|
|
|
|
|
|
unless defined ($afm = $self->{FontAFM}); |
|
278
|
|
|
|
|
|
|
|
|
279
|
2
|
|
|
|
|
2
|
my $line; |
|
280
|
2
|
|
|
|
|
8
|
my $rscidx = pack ("I", $rscidx); |
|
281
|
2
|
|
|
|
|
4
|
while ( defined ($line = _readLine ()) ) { |
|
282
|
6
|
100
|
|
|
|
17
|
return 1 if $line =~ /^\.$/; |
|
283
|
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
# PostScriptName=the/file.afm |
|
285
|
4
|
50
|
|
|
|
13
|
if ( $line =~ /^([^=]+)=(.*)$/ ) { |
|
286
|
4
|
50
|
|
|
|
16
|
$afm->{$1} = $rscidx.$2 unless $afm->{$1}; |
|
287
|
4
|
|
|
|
|
5
|
next; |
|
288
|
|
|
|
|
|
|
} |
|
289
|
0
|
0
|
|
|
|
0
|
warn ($fn, "[$.]: Invalid FontAFM entry\n") |
|
290
|
|
|
|
|
|
|
unless $error eq "ignore"; |
|
291
|
|
|
|
|
|
|
} |
|
292
|
0
|
|
|
|
|
0
|
return 1; |
|
293
|
|
|
|
|
|
|
} |
|
294
|
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
sub x_loadFontFamily ($) { |
|
296
|
0
|
|
|
0
|
0
|
0
|
my ($self) = @_; |
|
297
|
0
|
0
|
|
|
|
0
|
print STDERR ($fn, "[$.]: Loading section $section\n") if $trace; |
|
298
|
|
|
|
|
|
|
|
|
299
|
0
|
|
|
|
|
0
|
my $fam; |
|
300
|
0
|
0
|
|
|
|
0
|
$fam = $self->{FontFamily} = {} |
|
301
|
|
|
|
|
|
|
unless defined ($fam = $self->{FontFamily}); |
|
302
|
|
|
|
|
|
|
|
|
303
|
0
|
|
|
|
|
0
|
my $line; |
|
304
|
0
|
|
|
|
|
0
|
while ( defined ($line = _readLine ()) ) { |
|
305
|
0
|
0
|
|
|
|
0
|
return 1 if $line =~ /^\.$/; |
|
306
|
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
# Familiyname=Type1,PostScriptName1,Type2,PostScriptName2,... |
|
308
|
0
|
0
|
|
|
|
0
|
if ( $line =~ /^([^=]+)==?(.*)$/ ) { |
|
309
|
0
|
|
|
|
|
0
|
$fam->{$1} = { split (',', $2) }; |
|
310
|
0
|
|
|
|
|
0
|
next; |
|
311
|
|
|
|
|
|
|
} |
|
312
|
0
|
0
|
|
|
|
0
|
warn ($fn, "[$.]: Invalid FontFamily entry\n") |
|
313
|
|
|
|
|
|
|
unless $error eq "ignore"; |
|
314
|
|
|
|
|
|
|
} |
|
315
|
0
|
|
|
|
|
0
|
return 1; |
|
316
|
|
|
|
|
|
|
} |
|
317
|
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
sub _loadFontOutline ($) { |
|
319
|
2
|
|
|
2
|
|
14
|
my ($self) = @_; |
|
320
|
2
|
50
|
|
|
|
5
|
print STDERR ($fn, "[$.]: Loading section $section\n") if $trace; |
|
321
|
|
|
|
|
|
|
|
|
322
|
2
|
|
|
|
|
3
|
my $pfa; |
|
323
|
2
|
100
|
|
|
|
9
|
$pfa = $self->{FontOutline} = {} |
|
324
|
|
|
|
|
|
|
unless defined ($pfa = $self->{FontOutline}); |
|
325
|
|
|
|
|
|
|
|
|
326
|
2
|
|
|
|
|
2
|
my $line; |
|
327
|
2
|
|
|
|
|
6
|
my $rscidx = pack ("I", $rscidx); |
|
328
|
2
|
|
|
|
|
5
|
while ( defined ($line = _readLine ()) ) { |
|
329
|
4
|
100
|
|
|
|
19
|
return 1 if $line =~ /^\.$/; |
|
330
|
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
# PostScriptName=the/file.pfa |
|
332
|
2
|
50
|
|
|
|
11
|
if ( $line =~ /^([^=]+)=(.*)$/ ) { |
|
333
|
2
|
50
|
|
|
|
14
|
$pfa->{$1} = $rscidx.$2 unless $pfa->{$1}; |
|
334
|
2
|
|
|
|
|
5
|
next; |
|
335
|
|
|
|
|
|
|
} |
|
336
|
0
|
0
|
|
|
|
0
|
warn ($fn, "[$.]: Invalid FontOutline entry\n") |
|
337
|
|
|
|
|
|
|
unless $error eq "ignore"; |
|
338
|
|
|
|
|
|
|
} |
|
339
|
0
|
|
|
|
|
0
|
return 1; |
|
340
|
|
|
|
|
|
|
} |
|
341
|
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
sub _skipSection ($) { |
|
343
|
2
|
|
|
2
|
|
3
|
my ($self) = (@_); |
|
344
|
2
|
|
50
|
|
|
9
|
$section ||= "list"; |
|
345
|
2
|
50
|
|
|
|
3
|
print STDERR ($fn, "[$.]: Skipping section $section\n") if $trace; |
|
346
|
|
|
|
|
|
|
|
|
347
|
2
|
|
|
|
|
3
|
my $line; |
|
348
|
2
|
|
|
|
|
4
|
while ( defined ($line = _readLine ()) ) { |
|
349
|
6
|
100
|
|
|
|
16
|
return 1 if $line =~ /^\.$/; |
|
350
|
|
|
|
|
|
|
} |
|
351
|
0
|
|
|
|
|
|
return 1; |
|
352
|
|
|
|
|
|
|
} |
|
353
|
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
1; |
|
355
|
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
__END__ |