[Fontinst] Re: \glyph_parameter change proposal
Lars Hellström
Lars.Hellstrom at math.umu.se
Fri Sep 5 15:04:03 CEST 2003
At 20.07 +0200 2003-09-03, Vladimir Volovich wrote:
>"LH" == Lars Hellstrm writes:
>
> >> it is possible that there is a need to refer to glyph metrics for
> >> unencoded glyphs - e.g. when re-encoding the font to OT2 encoding,
> >> one may still wish to be able to access the \height{x} to set
> >> fontdimen parameters;
>
> LH> One can already do this by saying \height{x-not}.
>
>but i cannot know in advance whether the glyphs x is encoded or not,
>so i will then have to bloat the code with
>\ifisglyph{x}\then\height{x}\else\height{x-not}\fi
>instead of just \height{x}
What you do need to do is probably something like
\ifisglyph{x}\then
\setint{xheight}{\height{x}}
\Else\ifisglyph{x-not}\then
\setint{xheight}{\height{x-not}}
\Else
\setint{xheight}{500} % Fallback default
\Fi\Fi
since it should work even when x-not isn't defined either. Also, this
\ifisglyph{x}\then\height{x}\else\height{x-not}\fi
(using a conditional in an integer expression) isn't really supported.
Fontinst can certainly take it, but fontdoc cannot. See ficommon.dtx for
futher details.
> LH> But wouldn't the height of "cyrillic small letter ha" (U+0445) be
> LH> more appropriate in this context?
>
>for xheight, it might me the case (although it still might be good to
>refer to x since all latin letters are usually also present in
>cyrillic fonts),
With a larger set of glyphs that can provide defaults, the following
construction may be more convenient
\foreach(N){x,x-not,cyrha,...}
\ifisglyph{\str{N}}\then \setint{xheight}{\height{\str{N}}} \Fi
\endfor(N)
\setint{xheight}{500} % Fallback default
>but for other parameters (e.g. ascender and
>descender) i don't know which cyrillic glyphs would be right to use
>instead of d and g respectively.
Why do you presume these glyphs are better than any other glyph with
ascender or descender respectively? Some of the standard fontinst files
have traditionally used the depth of p as default for descender. I doubt
the choice is in any way critical (how many places are these parameters
used, anyway?).
The xheight is a bit different, since it is used by TeX as the height of
letters to which the accent positions are adjusted. If cyrillic and latin
x-heights aren't the same and the latin accents are used also for cyrillic
then the results could be wrong. But one would probably have to look at the
fonts to make sure.
>
> >> or when building faked glyphs, it might me useful to refer to
> >> glyph metrics of some other glyphs which might me unencoded.
>
> LH> Again, it is already perfectly possible to do this. But you (as
> LH> the author of an MTX file) have to bother to explicitly access
> LH> the metrics of this unencoded glyph.
>
>understood; though it makes the code unnecessarily bloated (or
>requires one more macro)...
>
> >> will the proposed change to the \glyph_parameter command have some
> >> undesired effects? if not, why not change it? :)
>
> LH> As I explained, the proposed change does indeed have undesired
> LH> effects, for example because of the \edef that \glyph_parameter
> LH> needs to survive.
>
>no - the proposed \glyph_parameter perfectly survives in all cases
>when the current \glyph_parameter survives.
Checking again, I see that the error case was left empty. I was thinking
about the variation that some error message was being generated there.
Lars Hellström
More information about the fontinst
mailing list