[NTG-context] Incorrect math kerning

Hans Hagen pragma at wxs.nl
Mon May 30 09:35:25 CEST 2016


On 5/30/2016 5:50 AM, Aditya Mahajan wrote:
> Hi,
>
> This is based on a question about latex on tex.stackexchange:
> http://tex.stackexchange.com/q/312098/323
>
> but context shows the same behaviour.
>
> The subscript "i" in the following example is kerned incorrectly (it is
> too far away from W). Is this a bug in the font, or with the fontloader?
>
> \setupbodyfont[cambria]
>
> \starttext
>
> \startTEXpage[offset=2mm]
> $W_i^i$
> \stopTEXpage
>
> \stoptext

In traditional TeX fonts italic correction is used as a kind of kerning. 
This happens in combination with cheating with the width of glyphs. This 
is somewhat reflected in the lm fonts (with some inconsistencies between 
for instance V and W ... we're currently discussing this). So, a way to 
force a subscript towards the shape is to use less width, and then use 
italic correction to move the superscript the other way. Of course this 
kind of kerning is a bit of a cheat and not related to italic shape 
(some upright characters also have italic corrections).

In cambria staircase kerns are used for this but they are not defined 
for all (base) characters. The gyre fonts don't cheat on the width.

\starttext

\startTEXpage[offset=2mm]
     \startcombination[2*2]
         {\hbox to 40pt{\hss\showboxes\switchtobodyfont 
[modern]$W_i^i$\hss}} {\infofont modern}
         {\hbox to 40pt{\hss\showboxes\switchtobodyfont 
[cambria]$W_i^i$\hss}} {\infofont cambria}
         {\hbox to 
40pt{\hss\showboxes\switchtobodyfont[lucidaot]$W_i^i$\hss}} {\infofont 
lucida}
         {\hbox to 40pt{\hss\showboxes\switchtobodyfont 
[pagella]$W_i^i$\hss}} {\infofont pagella}
     \stopcombination
\stopTEXpage

\stoptext

Once the math fonts are stable and frozen I'll come up with a solution 
(in ConTeXt) for this. Luatex < 0.85 had a mixed code path for dealing 
with italics (adding them always and removing them selectively) but as 
the standard is not more explicit about where to apply italic correction 
these code paths have been separated.

In ConTeXt we had some italic correction juggling (basically i disabled 
passing them to the engine and applied them selectively) but because lm 
/ rest of ot is not consistent it never was satisfying.

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list