On Wed, Oct 21, 2026 at 11:08 (+0200), Jean-Pierre Delange via ntg-context
wrote:
> Hi Jim,
> I've been following this discussion with considerable interest, particularly
> Jim's observations concerning the unexpected behaviour of
>>\showbodyfont[schola,8pt]|after the first selection of Schola inside a
> local TeX group.
> Wolfgang's explanation of |\usefontpath|, together with Hans's recent
> example using |\usetypescriptfile[newcomputermodern]|, seems to clarify the
> initial question of how New Computer Modern can be loaded.
It does, but, unfortunately, with an unfortunate side eddect.
> However, Jim's subsequent example raises a different and, I think, rather
> interesting issue.
> The crucial line appears to be:
>>{\setbox0=\hbox{\switchtobodyfont[schola] Schola!!!}}|
> As Jim observes, the subsequent font table is apparently incorrect when
> this line is present, but becomes correct if Schola has already been
> selected outside the group.
I find this interesting because of the fact that it is inside a group. I
suppose if there is some \global\def inside \switchtobodyfont (or some
other use of \global} it would explain the effect.
Still, it would seem like something is getting clobbered
> The fact that removing |\usebodyfont[newcomputermodern]|also eliminates the
> problem suggests that the order in which the different body-font families
> are initialized may be relevant.
> I wonder whether we are encountering a case in which the first selection of
> a typeface inside a local group triggers definitions that are not fully
> preserved after the group ends.
Or the definitions are not fully restored? (Or maybe that is what you
meant...)
> _Two earlier discussions:_
> I found two previous exchanges on this subject that seem particularly
> relevant.
> *1. November 2020 *— |\switchtobodyfont|and the preparation of body-font
> families
> https://mailman.ntg.nl/archives/list/[email protected]/thread/WJLAADVOMVE4DV7KBPWLXO4EYI222FKJ/
>
> <https://mailman.ntg.nl/archives/list/[email protected]/thread/WJLAADVOMVE4DV7KBPWLXO4EYI222FKJ/>
> In that discussion, Hans and Wolfgang explained aspects of the relationship
> between |\setupbodyfont|, |\usebodyfont|, and |\switchtobodyfont|.
> In particular, Hans recommended preparing the required body-font families
> before |\starttext|.
> *2. April 2025* — Initializing a typeface inside a local group
> https://lists.contextgarden.net/archives/list/[email protected]/thread/LRMIHD5PPSTDW2EOVBO76KHZJWS4HSPV/
>
> <https://lists.contextgarden.net/archives/list/[email protected]/thread/LRMIHD5PPSTDW2EOVBO76KHZJWS4HSPV/>
> In this exchange, Wolfgang explained that when a typeface is initialized for
> the first time inside a local group, some settings may be lost when the
> group ends.
> His suggested solution was to preload the relevant family globally, for
> example:
>>\usebodyfont[dejavu] \setupbodyfont[modern]|
> These discussions seem closely related to Jim's observations, although we
> cannot assume that the underlying mechanism is necessarily identical in the
> current LMTX implementation.
> _A possible first test?_
> Jim, would you be willing to try explicitly preloading Schola in the
> preamble?
> For example:
>>\usefontpath[NCMS] \usebodyfont[newcomputermodern] \usebodyfont[schola]
> \setupbodyfont[modern]|
Adding the \usebodyfont[schola] does indeed fix the problem, thanks.
Unfortunately, that apparently (?) means that one has to
\usebodyfont[XYZ]
for every font in the document. This is problematic and error-prone in a
large document which uses many fonts.
Thus, while it is a pragmatic work-around, I feel that it is not an elegant
solution.
> The remainder of your minimal example could remain unchanged, including the
> grouped |\setbox0=\hbox{...}|line.
> If the resulting |\showbodyfont[schola,8pt]|table becomes correct, this
> would support the hypothesis that the problem is related to the first
> initialization of Schola inside a local group.
Indeed. And why would that be?
> Of course, it would not yet explain why preloading New Computer Modern seems
> to influence the behaviour.
Indeed. And why would that be?
> _Comparing two LMTX releases:_
> There is another experiment that might help distinguish an existing feature
> of font initialization from a possible change introduced in a recent
> release.
> We could therefore compile the same minimal example under two different
> ConTeXt releases:
> Test ConTeXt version |\usebodyfont[schola]|
> A 2026.10.01 Absent
> B 2026.10.01 Present
> C 2026.10.16 Absent
> D 2026.10.16 Present
> For the comparison to be meaningful, the same font files and identical
> source code should be used, with separate caches and formats for each
> installation.
So far my tests on three different stand-alone versions all show the same
results.
The version in TL2026 works, but I suspect that is because TL2026 has the
New CM fonts already included. The log file indicates those files are
read, rather than the ones supplied in ./NCMS.
> It would also be useful to retain the original grouped construction in all
> four tests:
>>{\setbox0=\hbox{\switchtobodyfont[schola] Schola!!!}}|
> We could then perform a second comparison in which Schola is selected once
> outside the group before this line is executed.
> Several outcomes would be informative.
> If the behaviour is identical in both releases, it may reflect an
> established characteristic of font initialization and grouping.
> If the anomaly occurs only with the October 16 release, we may have
> identified a possible regression.
I think that turns out not to be the case. Which is too bad, because if it
was we all know someone who would be keen to fix it. ;-)
> If explicitly preloading Schola eliminates the anomaly in both versions, we
> would at least have a reproducible workaround and a clearer indication of
> where the problem originates.
You may have a clearer indication. I remain boggled. ;-)
> One remaining question:
> What I find particularly intriguing is the interaction between:
>>\usebodyfont[newcomputermodern]|
> and the first local invocation of:
>>\switchtobodyfont[schola]|
> Are we simply observing the consequences of delayed typeface
> initialization within a TeX group, or is something else involved in the
> way the different body-font collections are registered?
I look forward to someone answering that question.
> The earlier explanations from Hans and Wolfgang suggest a possible
> direction, but I think the comparison between the two LMTX releases could
> help us establish what is actually happening.
> I haven't reproduced the anomaly myself, so these are hypotheses rather than
> conclusions.
Lack of time or did the anomaly not happen for you?
> Still, the experiments seem straightforward enough, and the results might
> be useful to others working with several font families in the same
> document.
> Jim, perhaps an earlier ConTeXt release will prove useful for something more
> interesting than simply keeping a stable installation at hand!
Not in this case, although keeping a stable installation certainly has some
benefits.
> Many thanks to Wolfgang and Hans for their explanations, and to Jim for
> providing such a revealing example.
Thanks for your thoughts and pointers to those other discussions.
Jim
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________