[comp.text.tex] Bug in TeX in make_accent?

dhosek@sif.claremont.edu (Hosek, Donald A.) (07/11/90)

In article <TML.90Jul10181833@hemuli.hemuli.tik.vtt.fi>, tml@hemuli.tik.vtt.fi (Tor Lillqvist) writes...
>I was reading the code for the procedure make_accent and the section
>@<Append the accent with appropriate kerns, then set |p:=q|@> when I
>noticed that the actual code does not correspond to the comment in
>front of make_accent:

>    Given an accent of width |a|, designed for characters of height
>    |x| and slant |s|; and given a character of width |w|, height |h|,
>    and slant |t|: We will shift the accent down by |x-h|, and we will
>    insert kern nodes that have the effect of centering the accent
>    over the character and shifting the accent to the right by
>    $\delta={1\over2}(w-a)+h\cdot t-x\cdot s$.

>OK, I understand that this assigns the slant of the font to s:

>    s:=slant(f)/float_constant(65536);

>But what is the slant of a character?  The actual code calculates the
>same value as s:

>    t:=slant(f)/float_constant(65536);

Actually, it doesn't. If you read section 1124, you'll find that
f does not necessarily have the same value when t is calculated
as it is when f is calculated (consider the case of {\bf \H{\tt u}}
in _The TeXbook_.)

>These values are used in calculating delta:

>   delta:=round((w-a)/float_constant(2)+h*t-x*s);

>As t = s, why not simplify this expression to:

>   delta:=round((w-a)/float_constant(2)+(h-x)*s);

>and forget about t?

See above.

>Or should we use the italic correction of the character instead of
>h*t?

No, we do want h*t. Since it's difficult to draw pictures in
ASCII text, I'll refer you to the bottom of page 63 of the
TeXbook; for the first g, h*t is 0 while for the second g, it
gives the distance between the two upper right corners or the two
upper left corners. This gives the proper amount an accent should
be shifted if the accent comes from an unslanted font; on the
other hand, if the accent comes from a font with the same
font_slant as the character being accented, it will already be
shifted that amount so no shifting is necessary UNLESS the
character has a height different than the font_x_height (cf,
capital A). Running DVItype on TeX output containing some unusual
accented characters can be helpful in seeing how things come
together. The italic correction will not necessarily give the
same offset (take a look through the proof sheets in Computer
Modern Typefaces to verify this) and will definitely not give the
desired result for upper case letters.

-dh

---
Don Hosek                         TeX, LaTeX, and Metafont Consulting and
dhosek@ymir.claremont.edu         production work. Free Estimates.
dhosek@ymir.bitnet                
uunet!jarthur!ymir                Phone: 714-625-0147

tml@hemuli.tik.vtt.fi (Tor Lillqvist) (07/11/90)

(I already sent this to texhax, but I didn't notice it showing up, so
I post here, too.)

I was reading the code for the procedure make_accent and the section
@<Append the accent with appropriate kerns, then set |p:=q|@> when I
noticed that the actual code does not correspond to the comment in
front of make_accent:

    Given an accent of width |a|, designed for characters of height
    |x| and slant |s|; and given a character of width |w|, height |h|,
    and slant |t|: We will shift the accent down by |x-h|, and we will
    insert kern nodes that have the effect of centering the accent
    over the character and shifting the accent to the right by
    $\delta={1\over2}(w-a)+h\cdot t-x\cdot s$.

OK, I understand that this assigns the slant of the font to s:

    s:=slant(f)/float_constant(65536);

But what is the slant of a character?  The actual code calculates the
same value as s:

    t:=slant(f)/float_constant(65536);

These values are used in calculating delta:

   delta:=round((w-a)/float_constant(2)+h*t-x*s);

As t = s, why not simplify this expression to:

   delta:=round((w-a)/float_constant(2)+(h-x)*s);

and forget about t?

Or should we use the italic correction of the character instead of
h*t?
--
Tor Lillqvist,
working, but not speaking, for the Technical Research Centre of Finland