[Fontinst] Interesting problem with "dotless_i"
Lars Hellström
Lars.Hellstrom at math.umu.se
Thu Apr 21 16:14:19 CEST 2005
At 22.26 +0200 2005-04-20, Alexej Kryukov wrote:
>On Wednesday 20 April 2005 22:19, Lars Hellström wrote:
>> At 19.45 +0200 2005-04-20, Peter Dyballa wrote:
>> >Hello!
>> >
>> >I am working on a font with oldstyle numerals and strange glyph
>> > names. For example dotless_i.
>>
>> OK, that will require a new encoding. Why? Because none of the
>> standard encoding vectors have any /dotless_i position. With the
>> particular example mapping
>
>There is a nice solution for similar situations, available in the
>cyrfinst (aka T2) package by Vladimir Volovich. This package provides a
>file called fnstcorr.tex; after loading that file one can use
>a special command, \galias, which allows to map one or more
>aliases to a glyph name recognized by fontinst. For example:
>
>\galias{dotlessi}{dotless_i}
Yes, this package has been discussed before on this list---as I recall it
shortly after the release of fontinst v1.914. Renaming glyphs at the
AFM->MTX conversion step is rather straightforward (indeed, one of my first
fontinst hacks around 1997 did this too) and all looks fine as long as one
is just running fontinst.
The problem is that it breaks reencoding.
The case Peter presented is a perfect example of how things go wrong. Had
there been an AFM->MTX renaming step then fasr8a.mtx would have said
\setrawglyph{dotlessi}{fasr8a}{10pt}{245}{600}{436}{0}{0}
rather than as now
\setrawglyph{dotless_i}{fasr8a}{10pt}{245}{600}{436}{0}{0}
and as a result fasr8r.mtx would contain the proper glyph definition
\setscaledrawglyph{dotlessi}{fasr8r}{10pt}{1000}{17}{600}{436}{0}{0}
rather than as now the mere "phantom of a glyph"
\setscalednotglyph{dotless_i}{fasr8r}{10pt}{1000}{-1}{600}{436}{0}{0}
(there are three differences between the two lines: raw/not,
dotlessi/dotless_i, and 17/-1). The virtual font produced from all this is
by itself a perfectly good virtual font, but it doesn't match its base
fonts. Since what defines the font fasr8r in printing is really the mapfile
entry
fasr8r SImPL <8r.enc <fasr8a.pfb " TeXBase1Encoding ReEncodeFont "
what will happen when some virtual font calls upon the glyph in slot 17
(which fontinst was told by fasr8r.mtx is dotlessi)? The PS interpreter
will get element 17 of the TeXBase1Encoding array: this is the name
/dotlessi. Then it tries to look up the /dotlessi entry in the font's
CharStrings dictionary---but there isn't one, since noone renamed the
glyphs in the actual font! Instead the substitution glyph /.notdef is
rendered.
>Since this solution may be useful for any script (not just
>Cyrillic) I also use it in my Greek and Unicode fontinst
>extensions. It would be nice to incorporate it into the
>fontinst core: so it would be not necessary to create a special
>encoding file just because of a single misnamed glyph in a
>particular font.
I'm afraid you can't escape the need for custom encodings (unless you're
lucky and everything you need is accessible using the default font
encoding). Fontinst could in principle do without them, but Postscript can
not, and there's nothing we can do about that.
Now, there is another reason why one might want to change glyph names at
the AFM->MTX conversion step, and that is to simplify files such as
cyrillic.mtx to not have to deal with four different possible names for
every glyph. This reason is certainly good enough IMO that such a
conversion should be possible, but it must be done without breaking
reencoding. A solution which enables add-on packages such as fnstcorr.tex
to do this cleanly, namely the \aliased command, has been in place in the
core since v1.915 and is described in the current manual (Subsection 6.4),
but fnstcorr.tex still hasn't been updated to take advantage of that.
It should be sufficient to change
\def\charnamealias#1{%
\@ifundefined{GN@\charnameprefix#1}%
{\@ifundefined{GN@#1}{#1}{\csname GN@#1\endcsname}}% was just {#1}
{\csname GN@\charnameprefix#1\endcsname}}
to
\def\charnamealias#1{
\string\aliased{#1}{
\@ifundefined{GN@\charnameprefix#1}%
{\@ifundefined{GN@#1}{#1}{\csname GN@#1\endcsname}}% was just {#1}
{\csname GN@\charnameprefix#1\endcsname}
}
}
but there are other things about fnstcorr.tex which ought to be changed too
(the reliance on LaTeX macros).
Lars Hellström
More information about the fontinst
mailing list