On 1/16/2021 12:33 AM, Hans Hagen wrote:
On 1/15/2021 1:33 PM, Jack Hill wrote:
Hi,
I've been having some trouble with ConTeXt not typesetting math correctly when using the Pagella font (I do not know if the same issue occurs with other fonts as I haven't tested them).
If I compile with LMTX, the spacing between letters becomes very small so that when I type "|f|", for example, the second "|" intersects the f and looks rather ugly. However, compiling with the --luatex switch fixes these issues and the math looks nice again.
Can anybody else replicate this issue, and does anybody know why it is happening?
This the code I used to test:
|\setupbodyfont[pagella] \starttext \startformula |f| = \sqrt{\int_0^1 |f(t)|^2 \text{d}t} \stopformula \stoptext ||| I'll check it ... smells like some interference between newer and older corrections (these gyre fonts need some special treatment). I uploaded lmtx.
Here is the story about math: - there is traditional math, the 8 bit fonts (from Don Knuth) - and there is opentype math (originating at Microsoft) the eight bit fonts are all modelled after the cmr fonts so they have the same set of parameters, the same assumptions about family 2 and 3, use the same width/height/depth trickery one thing is that they lie about the width: the italic correction is subtracted from the width and the engine always adds it when a glyph is dealt with but then removes in some cases afterwards in opentype we also have italic correction but that is applied in specific cases; there the shapes have a real width (there are tricks to make fonts seen as opentype be treated as old school which work ok for virtual constructs that only use those 8 bit fonts but often fail for gyre fonts) now, the gust foundation fonts are a mix: they are opentype, have its parameters and properties but have the wrong width and assume the italic hackery the microsoft cambria font is the reference for opentype math (and to some extend microsoft word also is) afaik xetex uses the old tex approach also for opentype so that is why probably the old width approach works ok there but i never looked into it; cambria is an opentype font but probably seldom used so side effects will go unnoticed, also, texies often have no problem blaming microsoft, even when they got it right; of course we have to admit that 'moving forward wrt math fonts' didn't come from our community so we just have to follow now, when we move on (with context + luametatex) to a variants font scaling model, i need to adapt the math machinery to deal with that ... this can have side effects as you noticed but these will be dealt with (or fixed when something is wrong) in context we have font goodies that can handle this (widths, kerns etc) and we do so for at least the 'f' which also has a strange left offset ... i now adapted that to also serve the new (compact context font) model and also make sure that the smaller sizes for mkiv are handled; we can add more in those files, but that's also a (math) user effort to be decided is of we use the feature setting "mathkerns=yes" (this was a directive but i made it just a feature) Now, ideally: \enableexperiments[fonts.compact] % for the definitions should give nearly similar results (but less mem usage, less fonts loaded and possibly some performance gain) I also updated some test features: \definefontfeature[mathextra][staircase=yes,boundingbox=frame] as part of the general lmtx upgrading process. Only cambria (and lucida) have these staircase kerns and e.g. pagella and friends have a few defined in the font goodies but one has to do something liek this: \definefontfeature[mathextra][mathkerns=yes,staircase=yes,boundingbox=frame] more such tracers will be added in due time (and some old ones will go away as they lost their purpose). Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------