[Fontinst] Re: \glyph_parameter change proposal

Lars Hellström Lars.Hellstrom at math.umu.se
Wed Sep 3 16:27:41 CEST 2003


At 16.58 +0200 2003-09-02, Vladimir Volovich wrote:
>Lars,
>
>what do you think of the following new definition of the
>\glyph_parameter command:
>
>\def\glyph_parameter#1#2{
>   \if_defined{g-#2}\then
>     \expandafter\expandafter\expandafter
>       #1\csname g-#2\expandafter\endcsname
>   \else\if_defined{g-#2-not}\then
>     \expandafter\expandafter\expandafter
>       #1\csname g-#2-not\expandafter\endcsname
>   \else
>% error: glyph not set
>   \fi\fi
>}
>
>That will allow this command to find the glyph parameters even if the
>glyph is not encoded. That will make it possible to use commands such
>as \height{...} to extract glyph metrics for unencoded glyphs too. in
>the current definition, such attempts will lead to errors.

There are some technical problems, and I am not sure it would be a good thing.

The principal matter generally boils down to this: are `-not'-glyphs really
glyphs? For \width, \height, \depth, and \italic they are certainly just as
good as raw glyphs, but for \glyph it is quite a different matter. The
\mapcommands of a `-not'-glyph is empty, because there is no way of
accessing it from a VF, and consequently a \glyph{dotlessi-not}{1000} is of
no use. Your suggestion would make this the default if a glyph is missing
because it is not encoded. How often are glyph metrics used but not the
actual glyph? Not very often, I believe.

Therefore I would prefer to not have the basic commands automatically
access `-not'-glyphs when the real thing is missing; if the person writing
an MTX file thinks the `-not'-info might be useful, then he probably should
make explicit use of it. Rather, one should use the \ifisglyph command (and
its new sibling \ifareglyphs, which in one step tests of several glyphs are
all defined) to make sure that the glyphs one intends to use are set before
trying to use them. The standard MTX and ETX files haven't always been
strict about that, though.

I can however agree that the current error message one gets is not
particularly informative; it should say "Glyph `#1' is not set". Adding
such an error message in \glyph_parameter is however not the way to go,
since \glyph_parameter is in \mapcommands and \mapcommands get \edef'ed by
\glyph ... The consequences could be quite mysterious. \glyph_parameter
probably rather needs a sibling that checks for glyph existence, for use in
\width and friends.

Lars Hellström




More information about the fontinst mailing list