[Fontinst] determining the font shape in mtx

Lars Hellström Lars.Hellstrom at math.umu.se
Mon Apr 25 21:11:06 CEST 2005


At 16.59 +0200 2005-04-25, Alexej Kryukov wrote:
>Hi,
>
>I'd like to know, if it is possible to write mtx
>glyph definitions, depending from the font shape and/or
>series. Suppose e. g. that some glyphs can be faked by
>a specific way in Italic fonts, but only if they are
>really Italic, not just oblique or slanted, so that
>my glyph definitions can't depend, say, from the italic
>slant value.
>
>So, is there a standard way to determine that the font
>shape is really "it"?

This depends a bit on what you mean. There's no way (that I know of) for
telling from the data available in any metric file whether the font is
italic or slanted---mostly because this is mostly an aestetic distinction
that is hard to quantify, so it really needs to be judged by a human.

One concrete datum that could be taken as deciding whether the font is
italic or not is the "shape" under which it is declared, so on that line
your question could be interpreted as "Is there a way to inspect the
\installfont shape argument from within an MTX file?". Here the answer has
to be no, because the arguments are not stored in any variable while the
font is being built.

But if you consider the sequence of \installfont commands to be under your
control (which seems a reasonable assumption), then you can make use of the
\ifoption command. You would then write code like

  \installfont ... {...,mymtx option italic,...} ... {it}{}

for italic fonts, and

  \installfont ... {...,mymtx,...} ... {sl}{}

for non-italic fonts. The basicex.tex file contains examples of using an
option nosc, which is tested by newlatin.mtx.

If that's no good, then the only other thing I can think of is to inspect
the base font names (these can be found in the \g-GLYPH macros that hold
glyph definitions, as arguments of some commands) and try to parse these as
Fontname scheme names, but that's very hacky and is an advanced TeX
programming challenge.

Lars Hellström




More information about the fontinst mailing list