[Fontinst] ugly asterisk in typewriter fonts

LarsHellström Lars.Hellstrom at math.umu.se
Mon Feb 24 23:14:51 CET 2003


At 20.09 +0100 2003-02-24, Walter Schmidt wrote:
>On Mon, 24 Feb 2003 16:15:34 +0100 (MEZ), Walter Schmidt wrote:
>
>>First, the algorithm fails, if the height of the asterisk needs
>>no fix at all; second, it does -- of course -- not really center
>>the asterisk vertically.  Any ideas?
>
>Is there really no subroutine provided for vertical centering?

There isn't one in the fontinst core, no. This is mainly because there are
more primitive operations available from which it can be pieced together,
as you yourself observes:

>What about the following approach:
>
>\resetint{vaxis}{%
>  \scale{\sub{\height{parenleft}}{\depth{parenleft}}}{500}}
>
>\resetglyph{asterisk}
>  \moveup{\neg{%
>
>\sub{\scale{\sub{\height{asterisk}}{\depth{asterisk}}}{500}}{\int{vaxis}}}}
>  \glyph{asterisk}{1000}
>  \resetdepth{0}
>\endresetglyph

A \centeredglyph{<name>}{<axispos>} is simply a matter of

\setcommand\centeredglyph#1#2{
   \moveup{\sub{#2}{\div{\sub{\height{#1}}{\depth{#1}}}{2}}}
   \glyph{#1}{1000}
   \moveup{\sub{\div{\sub{\height{#1}}{\depth{#1}}}{2}}{#2}}
}

where the second \moveup is only needed if the \centeredglyph is not the
last thing before the \endsetglyph.

Lars Hellström




More information about the fontinst mailing list