[Fontinst] topaccent definition
Lars Hellström
Lars.Hellstrom at math.umu.se
Sat Apr 30 17:21:23 CEST 2005
At 23.53 +0200 2005-04-29, Alexej Kryukov wrote:
>Dear Lars,
>
>there is one question which disturbs me for a quite long
>time :) When preparing the first version of my cm-lgc
>package (which is based on the METAFONT sources, but
>contains also some accented glyphs which have to be faked),
Mostly out of curiousity: Are you using pens when drawing, or do you
express the glyph outlines? Given the "cm" prefix, I'd guess it's all done
in the Knuthian style of drawing with pens, though.
>I noticed that my accents were incorrectly positioned above
>capital letters in italic/slanted fonts.
>
>So I studied the \topaccent command definition, and the
>following line looks suspicious for me:
>
>{\scale{\sub{\height{#1}}{\int{xheight}}}{\int{italicslant}}}}
>
>Since we are calculating an x-shift, additional to the italic slant
>value, there is no reason to scale a *vertical* dimension
>(the letter height minus xheight) by the italic slant.
Yes there is. Remember that the italicslant is a "cotangent" of sorts,
i.e., a horizontal displacement divided by a vertical displacement (only
magnified by 1000, as is the rule in fontinst). The \scale therefore
converts a vertical displacement to the corresponding horizontal
displacement.
>Instead, the
>*horizontal* dimension (the italic slant) should be scaled by the
>difference in glyph heights.
OK, that's another way to look at it (it boils down to the same
calculations either way), but italicslant is _documented_ to be a factor
quantity rather than a length.
>So I changed the line above
>as follows:
>
>{\scale{\int{italicslant}}{\sub{\height{#1}}{\int{xheight}}}}}
That should be precisely the same thing. Multiplication is, after all,
commutative.
>Now I use this definition in all my mtx files (e. g. those
>available in my ofntinst ang grkfinst packages) and it seems to work
>perfectly for me. Am I right or wrong? And, if I am right, is
>it possible to include this modification into the fontinst core?
Both formulae should be exactly equivalent, unless your TeX has a buggy
\multiply command or something. What \scale does is that it first
multiplies the two arguments, and then divides the result by 1000. Since
multiplication is commutative, \scale should be too.
Traditionally "fixed" scaling factors have been put in the second argument
(which BTW is probably bad for readability, but that's too late to do much
about now), so fontdoc has a special case where it attempts to format
\scale{#1}{#2} as \frac{#2}{1000} #1 if the argument of #2 looks simple
enough, but that's really all the difference there is between the two
arguments. There is nothing which should show up as a difference in the
generated fonts.
Lars Hellström
More information about the fontinst
mailing list