ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Mikael Sundqvist <mickep@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: LMTX isn't typesetting math correctly with Pagella
Date: Mon, 18 Jan 2021 21:18:54 +0100	[thread overview]
Message-ID: <CAHy-LL8heM9ox7E05iEf9iwxhz631Kmih4CVzgyDHa4Rj+EWkg@mail.gmail.com> (raw)
In-Reply-To: <00e04880-8856-4535-903f-92c275ae2946@xs4all.nl>


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

      reply	other threads:[~2021-01-18 20:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 12:33 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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHy-LL8heM9ox7E05iEf9iwxhz631Kmih4CVzgyDHa4Rj+EWkg@mail.gmail.com \
    --to=mickep@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).