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.
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.
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.
_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]|
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.
Of course, it would not yet explain why preloading New Computer Modern
seems to influence the behaviour.
_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.
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.
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.
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?
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.
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!
Many thanks to Wolfgang and Hans for their explanations, and to Jim for
providing such a revealing example.
Best//JP
Le 21/10/2026 à 01:43, Jim Diamond via ntg-context a écrit :
Hi,
I see that the font file attached to my first attempt at this made the
email too big, and I guess it is in moderation. So to keep the ball
rolling, here is the attachment-free attempt.
Anyone wanting to try the test for themselves can d/l the font file from
https://download.gnu.org.ua/release/newcm/newcm-8.1.1.txz
Thanks. (See my new question below.)
Jim
----- Forwarded message from Jim Diamond<[email protected]> -----
From: Jim Diamond<[email protected]>
To: mailing list for ConTeXt users<[email protected]>
Subject: Re: [NTG-context] Re: How does one use \usefontpath ?
Date: Tue, 20 Oct 2026 20:12:26 -0300
On Sun, Oct 18, 2026 at 14:33 (+0200), Wolfgang Schuster wrote:
Am 18.10.2026 um 00:04 schrieb Jim Diamond via ntg-context:
Hi list,
I wanted to try out the new CM fonts found at
https://download.gnu.org.ua/release/newcm/newcm-8.1.1.txz
I downloaded them and put the font files in a director called NCMS, then I
compiled this document:
[...]
I didn't get the NCM font in my PDF. ConTeXt reported
selectfont > the requested font 'NewCMSans10-Regular.otf' has no files for
the 'tf' alternative, Latin Modern is used instead.
Then I put unpacked the tar file in a place where ConTeXt searches for font
files, reloaded the font cache, and compiled it again. This time, I did
get the NCM font in my PDF, with ConTeXT reporting:
fonts > otf loading > loading
'.../tex/fonts/other-fonts/newcm-8.1.1/otf/NewCMSans10-Regular.otf', hash
'newcmsans10-regular'
There is no wiki page, and I didn't find the TeX definition of \usefontpath
or the backing Lua definition enlightening.
Can someone enlighten me as to how I should / could use \usefontpath to
tell ConTeXt to look in a particular directory for font file(s)?
Alternatively, if there is A Better Way of telling ConTeXt (from within the
source file, not from the command line) to use a font which is not cached,
I'd be happy to know that.
You're using \definefontfamily which can only use cached font even with the
file method, \usefontpath is only used when you use a typescript/typeface to
load a font.
For New Computer Modern you're lucky because context provides a typescript
which can be used but you have to provide the font files yourself.
%%%% begin example
\usefontpath
[NCMS]
\definestartstop
[NCMSsmallprint]
[before=\startnarrower,
after=\stopnarrower,
style=\switchtobodyfont[newcomputermodern,small,ss]]
\definestartstop
[SmallPrint]
[before=\startnarrower,
after=\stopnarrower,
style=\switchtobodyfont[small,ss]]
\usebodyfont
[newcomputermodern]
\setupbodyfont
[modern]
\starttext
Latin Modern:
\startSmallPrint
This is a line of text. {\sc This is a \tex{sc} line of text.}
\stopSmallPrint
\blank
New Computer Modern:
\startNCMSsmallprint
This is a line of text. {\sc This is a \tex{sc} line of text.}
\stopNCMSsmallprint
\stoptext
%%%% end example
As previously remarked, the above code did indeed get the NCM SS font
loaded.
However, it seems there are some side effects with, at least, how I am
using it.
Consider this test document:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% cut here %%%%%%%%%%%%%%%%
\usefontpath[NCMS]
% Commenting the following out makes the Schola table correct (I think):
\usebodyfont[newcomputermodern]
\setupbodyfont[modern]
\starttext
\startchapter[title=Fun with Fonts in \ConTeXt,]
Hello
% Uncommenting either of these saves the day:
%\showbodyfont[schola,8pt]
%\switchtobodyfont[schola] \switchtobodyfont[modern]
% Commenting this out makes the table below show correctly.
{\setbox0=\hbox{\switchtobodyfont[schola] Schola!!!}}
\showbodyfont[schola,8pt]\bigskip
\stopchapter
\stoptext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% cut here %%%%%%%%%%%%%%%%
When I process this with ConTeXt 2026.10.16, the table has apparently
incorrect rows for \rm, \tt and \mr, and the \ss line is a bit wonky too.
Curiously (to me), if I do any one of the following, the table appears to
be correct
(1) comment out the \usebodyfont[newcomputermodern] line
(this is not a big surprise, but I think I need that to get NCM SS);
(2) uncomment the first \showbodyfont line
(or the \switchtobodyfont[schola] \switchtobodyfont[modern] line)
(which is a bit of a nuisance if I have to switch to every body font I
might like to use before the first grouped use of such a font); or
(3) comment out the hiding-inside-a-group \setbox0=\hbox{...} line
(I speculate that xtable cells are set inside groups, but I say that
only because the problem showed up after showing fonts in an xtable).
For intrepid souls who want to see the problem for themselves:
(i) save the above test document in some-file.tex;
(ii) create a directory "NCMS" in the same directory where you saved the
above document;
(iii) save the attached file into fonts/NewCMSans10-Regular.otf; and
(iv) then run ConTeXt on some-file.tex.
I am very curious about why the inside-a-group setbox-hbox line causes Bad
Things to happen, and would be very happy to be enlightened on that point,
since it might shed some light on my real question.
My real question is either:
(a) What am I doing wrong?, or
(b) What else needs to be done so that I can have my NCM ss font
*and* not mess up my other fonts while doing so?
Thanks.
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
___________________________________________________________________________________
___________________________________________________________________________________
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
___________________________________________________________________________________