ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* LMTX isn't typesetting math correctly with Pagella
@ 2021-01-15 12:33 Jack Hill
  2021-01-15 12:56 ` Otared Kavian
  2021-01-15 23:33 ` Hans Hagen
  0 siblings, 2 replies; 5+ messages in thread
From: Jack Hill @ 2021-01-15 12:33 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 703 bytes --]

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 |||

Jack

||


[-- Attachment #1.2: Type: text/html, Size: 995 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: LMTX isn't typesetting math correctly with Pagella
  2021-01-15 12:33 LMTX isn't typesetting math correctly with Pagella Jack Hill
@ 2021-01-15 12:56 ` Otared Kavian
  2021-01-15 23:33 ` Hans Hagen
  1 sibling, 0 replies; 5+ messages in thread
From: Otared Kavian @ 2021-01-15 12:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1640 bytes --]

Hi Jack,

I tested your example both with Pagella and Lucida OT: indeed typesetting with the latest LMTX, with Pagella the math italic « f » runs into the right bar of « |f| ».

However the result with mkiv is correct.

I am attaching the PDF output with LMTX.

Best regards: Otared



> On 15 Jan 2021, at 13:33, Jack Hill <jackhill3103@gmail.com> 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
> Jack
> 
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________


[-- Attachment #1.2.1: Type: text/html, Size: 746 bytes --]

[-- Attachment #1.2.2: bar-distance-f.pdf --]
[-- Type: application/pdf, Size: 14141 bytes --]

[-- Attachment #1.2.3: Type: text/html, Size: 2570 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: LMTX isn't typesetting math correctly with Pagella
  2021-01-15 12:33 LMTX isn't typesetting math correctly with Pagella Jack Hill
  2021-01-15 12:56 ` Otared Kavian
@ 2021-01-15 23:33 ` Hans Hagen
  2021-01-17 21:00   ` Hans Hagen
  1 sibling, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2021-01-15 23:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Jack Hill

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).

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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: LMTX isn't typesetting math correctly with Pagella
  2021-01-15 23:33 ` Hans Hagen
@ 2021-01-17 21:00   ` Hans Hagen
  2021-01-18 20:18     ` Mikael Sundqvist
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2021-01-17 21:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Jack Hill

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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: LMTX isn't typesetting math correctly with Pagella
  2021-01-17 21:00   ` Hans Hagen
@ 2021-01-18 20:18     ` Mikael Sundqvist
  0 siblings, 0 replies; 5+ messages in thread
From: Mikael Sundqvist @ 2021-01-18 20:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 4321 bytes --]

On Sun, Jan 17, 2021 at 10:00 PM Hans Hagen <j.hagen@xs4all.nl> wrote:

> 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
>
>
I got curious about those staircase kerns. Is there a simple example that
shows their effect? I greped the source, but did not find anything where I
could see a difference.

/Mikael

[-- Attachment #1.2: Type: text/html, Size: 5154 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-18 20:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-15 12:33 LMTX isn't typesetting math correctly with Pagella Jack Hill
2021-01-15 12:56 ` Otared Kavian
2021-01-15 23:33 ` Hans Hagen
2021-01-17 21:00   ` Hans Hagen
2021-01-18 20:18     ` Mikael Sundqvist

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).