1

I am following this page: https://wiki.contextgarden.net/Command/definefontfamily

For some reason, the code

\definefontfamily [mainface] [rm] [stixtwo]
\definefontfamily [mainface] [ss] [dejavu,ss]
\definefontfamily [mainface] [mm] [stixtwo]

\setupbodyfont[mainface]

\starttext

    Hello \bf world
    
    \ss
    Hello \bf world
    
    $hello world$

\stoptext

Produces a file with Latin Modern. It seems that the problem is:

selectfont      > the requested font 'stixtwo' has no files for the 'tf' alternative, Latin Modern is used instead.
selectfont      > the requested font 'dejavu,ss' has no files for the 'tf' alternative, Latin Modern is used instead.
selectfont      > the requested font 'stixtwo' has no files for the 'tf' alternative, Latin Modern is used instead.
fonts           > preloading modern-designsize (mono)
fonts           > 'fallback modern-designsize tt 12pt' is loaded

How can I fix it?

UPDATE: The suggested code by @mickep:

\definefontfamily [mainface] [rm] [STIXTwoText]
\definefontfamily [mainface] [ss] [DejaVuSans] [rscale=0.85]
\definefontfamily [mainface] [mm] [STIXTwoMath]

\definefontfeature[default][default][goodies=stix-two-math.lfg]

\setupbodyfont[mainface]

\starttext

    Hello {\bf world}, {\it what} {\bi is up?}
    
    {\ss Hello {\bf world}, {\it what} {\bi is up?}}
    
    $\sin x = \int_0^x \cos t\dd t$

\stoptext

Doesn't work for Stix, and gives the following error:

selectfont      > the requested font 'STIXTwoText' has no files for the 'tf' alternative, Latin Modern is used instead.
selectfont      > the requested font 'STIXTwoMath' has no files for the 'tf' alternative, Latin 

Modern is used instead.

EDIT:

The result of the mtxrun --script fonts --list --all | grep stixtwotext command

stixtwotext                                  stixtwotext                        stixtwotext                            /System/Library/Fonts/Supplemental/STIXTwoText.ttf                                       regular medium semibold bold
stixtwotextbold                              stixtwotext                        stixtwotextbold                        STIXTwoText-Bold.otf
stixtwotextbolditalic                        stixtwotext                        stixtwotextbolditalic                  STIXTwoText-BoldItalic.otf
stixtwotextitalic                            stixtwotext                        stixtwotextitalic                      STIXTwoText-Italic.otf
stixtwotextmedium                            stixtwotext                        stixtwotextmedium                      STIXTwoText-Medium.otf
stixtwotextmediumitalic                      stixtwotext                        stixtwotextmediumitalic                STIXTwoText-MediumItalic.otf
stixtwotextnormal                            stixtwotext                        stixtwotextitalic                      STIXTwoText-Italic.otf
stixtwotextregular                           stixtwotext                        stixtwotextregular                     STIXTwoText-Regular.otf
stixtwotextsemibold                          stixtwotext                        stixtwotextsemibold                    STIXTwoText-SemiBold.otf
stixtwotextsemibolditalic                    stixtwotext                        stixtwotextsemibolditalic              STIXTwoText-SemiBoldItalic.otf
8
  • Do you have the fonts? For example <installation directory>/tex/texmf/fonts/data/stix/stix2/STIXTwoMath-Regular.otf.
    – mickep
    Oct 23, 2022 at 13:37
  • @mickep Yes, the fonts are installed. Oct 23, 2022 at 13:48
  • Sorry, then I cannot help you. By the way, after the next upload, the \definefontfeature line should go away.
    – mickep
    Oct 23, 2022 at 14:16
  • You can add the output from mtxrun --script fonts --list --all stixtwo* to your question to see which font files are found by ConTeXt. Oct 23, 2022 at 14:48
  • @WolfgangSchuster I have added the info to the question Oct 23, 2022 at 15:09

1 Answer 1

4

It seems that you use the names from the typescripts. I tried the following

\definefontfamily [mainface] [rm] [STIXTwoText]
\definefontfamily [mainface] [ss] [DejaVuSans] [rscale=0.85]
\definefontfamily [mainface] [mm] [STIXTwoMath]

\setupbodyfont[mainface]

\starttext

    Hello {\bf world}, {\it what} {\bi is up?}
    
    {\ss Hello {\bf world}, {\it what} {\bi is up?}}
    
    $\sin x = \int_0^x \cos t\dd t$

\stoptext

and got this output:

small example

There might be better ways to force the stixtwo goodie file to be used (I think you want it, try without). Also, I looked in the stixtwo typescript file, and it seems that it has no sans serif font added (but dejavu for mono). I don't know if dejavu is a good match, but it is perhaps better than nothing. I can investigate a bit.

5
  • DejaVu works, but for some reason Stix still gets replaced with Latin Modern. Maybe there is a problem with my installation? Oct 23, 2022 at 12:02
  • Strange. I use the latest update, but I do not think this has changed recently. Do you get any results if you do mtxrun --script fonts --list --all | grep stixtwotext.
    – mickep
    Oct 23, 2022 at 12:12
  • yes, I get a lot of results. I have just installed the MXLT version for arm64 MacOS following the official webpage. If I replace all of the preamble with \setupbodyfont[stixtwo], it works (but \setupbodyfont[stixtwotext] doesn't work). Oct 23, 2022 at 12:20
  • There is no reason why \setupbodyfont[stixtwotext] should work. I suggest that you update your question with the example that I gave, and report the message(s) you get.
    – mickep
    Oct 23, 2022 at 12:55
  • I have updated the question Oct 23, 2022 at 13:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .