[Fontinst] accessing unencoded charecters

Lars Hellström Lars.Hellstrom at math.umu.se
Wed Dec 3 19:05:00 CET 2003


At 15.55 +0100 2003-12-02, Walter Schmidt wrote:
>Maybe I should explain what I was doing, since this leads
>me to a change request regarding the fontinst distribution:
>
>Most etx files in the fontinst distrib include a piece of
>code such as
>
>  \ifisglyph{space}\then
>     \setint{interword}{\width{space}}
>  \Else\ifisglyph{i}\then
>     \setint{interword}{\width{i}}
>  and so on...
>
>This requires that the space character actually belongs to
>the encoding of the base font of the particular \installfont
>or \installrawfont command.

No, not really. But read on.

>This holds -- fortunately --
>for 8r, but you cannot assume it always.

Which is why there is an else-branch to the above if.

>In my particular
>case, a physical font is first reencoded to OT2, then an
>\installrawfont command adds the ligatures and fontdimens.
>Since the OT2 encoding does not include the space, the
>"usual" code in the ot2.etx file did not recognize this
>character, despite its presence in the underlying physical
>font.  Adding the extra check for "space-not" to the etx
>file fixed the problem.

Certainly. But this is not the real problem.

>As a result, I suggest to "spice up" the etx files in the
>fontinst distribution and make them check also for space-not,
>if applicable.

First of all, remember that fontinst \set... commands are like LaTeX
\Provide... commands: they only set something if it is currently undefined.
Many of the \set... commands that appear in actual fontinst files are
fallback definitions rather than preferred definitions.

So what about this particular definition of interword, then? Quoting the
fisource.tex entry on interword:

  \item[interword] (integer denoting length)
    \begin{smalldes}
      \item[Description] The natural width of interword glue (spaces).
      \item[Set by] MTX files.
      \item[Used by] Some ETX and MTX files.
    \end{smalldes}

we see that it is normally supposed to be set by an MTX file. Hence the ETX
file definitions are fallback ones. In principle a simple
\setint{interword}{333} would have done, but traditionally the fallback has
been a bit more sophisticated, so it should probably be kept that way.
txtfdmns.etx is a bit more explicit on the matter:

  \section{Default values}

  This code tries to produce reasonable values for the font dimensions,
  in case the font metrics didn't specify them. Preferably, all the
  integers computed below should already be set.

As usual, I'm afraid, the traditional MTX and ETX files are rather shaky on
the matter. For no apparent reason latin.mtx defines capheight, ascender,
and descender (it doesn't use them). It _doesn't_ define interword, even
though this information should have been of use in faking the space glyph.
(And it seems latin fonts have traditionally only learnt the space width of
the base font via this fake, which happens to be based on space-not, no
less! A messy business indeed.)

So to summarize: The preferred action in this case would be that you have
an MTX file (probably mostly parallel to 8r.mtx) which (amongst other
things) takes care of computing suitable values for the font dimension
integers, rather than to rely on the ETX file for this. This is more
modular and thus more flexible. It also means the code will only be
executed once (rather than 3--4 times, as is the case with code in ETX
files) for each font.

Lars Hellström




More information about the fontinst mailing list