我有以下代码片段
\usemodule [simplefonts][size=12pt]
\setmainfont[DejaVu Sans]
\starttext
Test text
Тестовый текст
\stoptext
这很好用。ConTeXt 编译它并且字体正确。但如果我将字体更改为
\usemodule [simplefonts][size=12pt]
\setmainfont[Liberation Sans]
\starttext
Test text
Тестовый текст
\stoptext
那么结果将是错误的字体并且不会呈现俄语文本。
字体名称取自fc-list
程序输出(Linux)。ConTeXt 从 texlive 安装,版本为
mtx-context | ConTeXt Process Management 0.60
mtx-context |
mtx-context | main context file: /usr/share/texmf-dist/tex/context/base/context.mkiv
mtx-context | current version: 2013.05.28 00:36
答案1
ConTeXt MkIV 不依赖系统字体机制来获取字体名称。因此返回的信息fc-cache
是无用的。而是使用mtx-fonts
脚本来查找字体的名称。
跑步
mtxrun --script fonts --list --pattern=liberation --all
这使
liberationmono liberationmono LiberationMono-Regular.ttf liberationmonobold liberationmonobold LiberationMono-Bold.ttf liberationmonobolditalic liberationmonobolditalic LiberationMono-BoldItalic.ttf liberationmonoitalic liberationmonoitalic LiberationMono-Italic.ttf liberationmononormal liberationmono LiberationMono-Regular.ttf liberationsans liberationsans LiberationSans-Regular.ttf liberationsansbold liberationsansbold LiberationSans-Bold.ttf liberationsansbolditalic liberationsansbolditalic LiberationSans-BoldItalic.ttf liberationsansitalic liberationsansitalic LiberationSans-Italic.ttf liberationsansnarrow liberationsansnarrow LiberationSansNarrow-Regular.ttf liberationsansnarrowbold liberationsansnarrowbold LiberationSansNarrow-Bold.ttf liberationsansnarrowbolditalic liberationsansnarrowbolditalic LiberationSansNarrow-BoldItalic.ttf liberationsansnarrowitalic liberationsansnarrowitalic LiberationSansNarrow-Italic.ttf liberationsansnarrownormal liberationsansnarrowitalic LiberationSansNarrow-Italic.ttf liberationsansnormal liberationsans LiberationSans-Regular.ttf liberationserif liberationserif LiberationSerif-Regular.ttf liberationserifbold liberationserifbold LiberationSerif-Bold.ttf liberationserifbolditalic liberationserifbolditalic LiberationSerif-BoldItalic.ttf liberationserifitalic liberationserifitalic LiberationSerif-Italic.ttf liberationserifnormal liberationserifitalic LiberationSerif-Italic.ttf
如果上面没有列出字体,请重新生成字体数据库。
mtxrun --script font --reload --force
如果字体仍未列出,请检查
OSFONTDIR
使用的值mtxrun --expand-var OSFONTDIR
您可以使用以下方式强制搜索路径
OSFONTDIR=/path/to/font mtxrun --script font --reload --force