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
___________________________________________________________________________________