我正在关注这个页面:https://wiki.contextgarden.net/Command/definefontfamily
由于某种原因,代码
\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
生成一个包含 Latin Modern 的文件。问题似乎是:
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
我该如何修复它?
更新:@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
不适用于 Stix,并出现以下错误:
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
而是使用现代。
编辑:
mtxrun --script fonts --list --all | grep stixtwotext
命令的结果
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
答案1
看来您使用了打字稿中的名称。我尝试了以下方法
\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
并得到以下输出:
可能有更好的方法强制使用 stixtwo goodie 文件(我想你会想要它,试试不用它)。另外,我查看了 stixtwo typescript 文件,似乎没有添加 sans serif 字体(但有 dejavu for mono)。我不知道 dejavu 是否合适,但也许总比没有好。我可以调查一下。