On Tue, 13 Nov 2001, Hans Hagen wrote:

> At 08:28 PM 11/12/2001 -0400, George N. White III wrote:
> >I've just started using texfont, version=2000.12.14, (from the Sept. 14th
> >beta), and encountered a couple minor problems:
> >
> >1) The line with mkdir:
> >
> >   { my $str = shift ; mkdir $str, 0755 unless -d $str }
> >
> >originally used a mode off '755', which gives bad permissions
> >for the directories texfont creates.
>
> so the 0 really means something (i thought that perl would see it as a
> number and drop leading 0's)
>
> >2)  The actual map files are always missing the first line shown in the
> >encoding-vendor-collection.map file.
>
> i'll send you the latest version so that you can test it;

A few minutes with "perl -d" reveals that the lost zero was actually just
misplaced and written as an "o".  The list of map file entries is stored
in two forms:

$mapdata -- list of new entries to be appended to the file
$maplist -- the list of entries for the current font collection

The misplaced "0" appears in the line which strips any existing entries
for the current font ($thename) from $mapdata:

       { $mapdata =~ s/^$thename\s.*?$//gmois ;

The effect the "o" is to tell perl to only compile the regular expression
once (e.g., assume that $thename never changes -- an important
optimization for certain loops).  This line strips out any existing entry
in the mapfile for font $thename, so that $mapdata can be appended to the
file without duplicating existing entries.  The result is that, when
creating a new map file, the first font will not appear in the map file.

I've gone into lots of detail here a) so the next time I see a similar
problem there will be an explanation in the archives, and b) so that
people who use texfont and have never written a perl script can see
that it is possible to tweak perl scripts when they go astray.

-- 
George N. White III <[EMAIL PROTECTED]> Bedford Institute of Oceanography


Reply via email to