我将 XeTeX PDF 生成从 Debian 9 系统迁移到了 CentOS 7。XeTeX 的 Red Hat 软件包已经完全过时了,我不得不将它们全部删除,才能安装最新的 TeX Live 版本。
安装后,我已将 TeX Live 字体添加到操作系统配置中:
# cp $(kpsewhich -var-value TEXMFSYSVAR)/fonts/conf/texlive-fontconfig.conf /etc/fonts/conf.d/09-texlive.conf
# fc-cache -fsv
并且 CMU Sans Serif Bold 字体可以通过 fontconfig 来识别:
$ fc-list |grep CMU | grep Sans | grep Bold | grep -v Extended
/usr/local/texlive/2019/texmf-dist/fonts/opentype/public/cm-unicode/cmunso.otf: CMU Sans Serif:style=BoldOblique
/usr/local/texlive/2019/texmf-dist/fonts/opentype/public/cm-unicode/cmunsx.otf: CMU Sans Serif:style=Bold
在我的 Debian 系统上,我这样使用粗体字体:
\font\tenbf="CMU Sans Serif/B" at 14pt
已在此推荐回答。
但这在新系统上不再起作用。而且我没有收到任何错误。定义被默默忽略。而且我得到的不是粗体字体,而是普通字体。
但是当我指定正确的字体文件名称时,它会得到正确的粗体字体:
\font\tenbf="[cmunsx]" at 14pt
如果我使用字体名称而不是文件名称,如何找出字体选择不起作用的原因?
更新
我尝试遵循 Ulrike 的评论,但仍然没有看到错误。
这是我的测试文件bf.tex
:
\XeTeXtracingfonts=1
\font\tenrm="CMU Sans Serif"
\tenrm RM
\font\tenbf="CMU Sans Serif/B"
\tenbf BF
\bye
这是输出xetex
:
$ xetex --no-pdf bf.tex
This is XeTeX, Version 3.14159265-2.6-0.999991 (TeX Live 2019) (preloaded format=xetex)
restricted \write18 enabled.
entering extended mode
(./bf.tex [1] )
(see the transcript file for additional information)
Output written on bf.xdv (1 page, 452 bytes).
Transcript written on bf.log.
这是日志:
This is XeTeX, Version 3.14159265-2.6-0.999991 (TeX Live 2019) (preloaded format=xetex 2019.7.4) 5 JUL 2019 09:39
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**bf.tex
(./bf.tex
Requested font "CMU Sans Serif" scaled 1000
-> /usr/local/texlive/2019/texmf-dist/fonts/opentype/public/cm-unicode/cmunss.
otf
Requested font "CMU Sans Serif/B" scaled 1000
-> /usr/local/texlive/2019/texmf-dist/fonts/opentype/public/cm-unicode/cmunss.
otf
[1] )
Output written on bf.xdv (1 page, 452 bytes).
这是输出xdvipdfmx
:
$ xdvipdfmx -vv bf.xdv
<FONTMAP:/usr/local/texlive/2019/texmf-var/fonts/map/pdftex/updmap/pdftex.map><FONTMAP:/usr/local/texlive/2019/texmf-var/fonts/map/dvipdfmx/updmap/kanjix.map><FONTMAP:/usr/local/texlive/2019/texmf-dist/fonts/map/dvipdfmx/ckx.map>bf.xdv -> bf.pdf
DVI Comment: XeTeX output 2019.07.05:0939
<AGL:texglyphlist.txt><AGL:pdfglyphlist.txt><AGL:glyphlist.txt>[1</usr/local/texlive/2019/texmf-dist/fonts/opentype/public/cm-unicode/[email protected]<NATIVE-FONTMAP:/usr/local/texlive/2019/texmf-dist/fonts/opentype/public/cm-unicode/cmunss.otf/0/H/65536/0/0>
fontmap: /usr/local/texlive/2019/texmf-dist/fonts/opentype/public/cm-unicode/cmunss.otf/0/H/65536/0/0 -> /usr/local/texlive/2019/texmf-dist/fonts/opentype/public/cm-unicode/cmunss.otf(Identity-H)
pdf_font>> Input encoding "Identity-H" requires at least 2 bytes.
pdf_font>> The -m <00> option will be assumed for "/usr/local/texlive/2019/texmf-dist/fonts/opentype/public/cm-unicode/cmunss.otf".
(CID:CMUSansSerif)
pdf_font>> Type0 font "/usr/local/texlive/2019/texmf-dist/fonts/opentype/public/cm-unicode/cmunss.otf" cmap_id=<Identity-H,0> opened at font_id=</usr/local/texlive/2019/texmf-dist/fonts/opentype/public/cm-unicode/cmunss.otf/0/H/65536/0/0,0>.
>]
otf_cmap>> Creating ToUnicode CMap for "/usr/local/texlive/2019/texmf-dist/fonts/opentype/public/cm-unicode/cmunss.otf"...
(CID:/usr/local/texlive/2019/texmf-dist/fonts/opentype/public/cm-unicode/cmunss.otf[VSJZVN+CMUSansSerif][CIDFontType0][6 glyphs][753 bytes])
Compression saved 465 bytes
2360 bytes written
我发现两种情况下都使用了相同的字体文件。但我仍然不明白为什么。
答案1
我能够通过指定字体的文件名来解决这个问题。
\font\bf="[cmunsx]" at 14pt
\font\rm="[cmunss]" at 11pt
\font\tt="[cmuntt]" at 11pt