我目前正在处理一个文档,该文档是在多台计算机上编辑的,两台计算机都运行 Windows 10。在这两种情况下,我都使用 Miktex (x64)。但是,当我尝试编译以下 MWE 时,其中一台机器上出现了问题:
\documentclass{book}
\usepackage{fontspec}
\setmainfont{Arial}
\usepackage{lipsum}
\begin{document}
\lipsum[1-5]
\end{document}
使用 XeLaTeX,PDF 看起来符合预期,Arial 显示为嵌入字体。但是,当我尝试使用 Lualatex 时,PDF 实际上使用的是字体的窄版本。
Xelatex 的输出如下:
.................................................
. fontspec info: "defining-font"
.
. Font family 'Arial(0)' created for font 'Arial' with options
. [Ligatures=TeX].
.
. This font family consists of the following NFSS series/shapes:
. - 'normal' (m/n) with NFSS spec.:
. <->"Arial/OT:script=latn;language=DFLT;mapping=tex-text;"
. - 'small caps' (m/sc) with NFSS spec.:
. <->"Arial/OT:script=latn;language=DFLT;mapping=tex-text;+smcp;"- 'bold'
. (bx/n) with NFSS spec.:
. <->"Arial/B/OT:script=latn;language=DFLT;mapping=tex-text;"
. - 'bold small caps' (bx/sc) with NFSS spec.:
. <->"Arial/B/OT:script=latn;language=DFLT;mapping=tex-text;+smcp;"- 'italic'
. (m/it) with NFSS spec.:
. <->"Arial/I/OT:script=latn;language=DFLT;mapping=tex-text;"
. - 'italic small caps' (m/itsc) with NFSS spec.:
. <->"Arial/I/OT:script=latn;language=DFLT;mapping=tex-text;+smcp;"- 'bold
. italic' (bx/it) with NFSS spec.:
. <->"Arial/BI/OT:script=latn;language=DFLT;mapping=tex-text;"
. - 'bold italic small caps' (bx/itsc) with NFSS spec.:
. <->"Arial/BI/OT:script=latn;language=DFLT;mapping=tex-text;+smcp;"
.................................................
Lualatex 的输出是:
.................................................
. fontspec info: "defining-font"
.
. Font family 'Arial(0)' created for font 'Arial' with options
. [Ligatures=TeX].
.
. This font family consists of the following NFSS series/shapes:
. - 'normal' (m/n) with NFSS spec.: <->"Arial:mode=node;+tlig;"
. - 'small caps' (m/sc) with NFSS spec.: - 'bold' (bx/n) with NFSS spec.:
. <->"Arial/B:mode=node;+tlig;"
. - 'bold small caps' (bx/sc) with NFSS spec.: - 'italic' (m/it) with NFSS
. spec.: <->"Arial/I:mode=node;+tlig;"
. - 'italic small caps' (m/itsc) with NFSS spec.: - 'bold italic' (bx/it)
. with NFSS spec.: <->"Arial/BI:mode=node;+tlig;"
. - 'bold italic small caps' (bx/itsc) with NFSS spec.:
.................................................
我怀疑 Lualatex 实际上默认使用的是窄字体,而不是常规字体。运行luaotfload-tool --find="Arial"
后输出如下
luaotfload | resolve : Font "Arial" found!
luaotfload | resolve : Resolved file name "c:/windows/fonts/arialn.ttf
在我看来,查找实际上是错误的。我尝试使用cache=purge
、force
和flush-lookup
选项,但无济于事。有没有办法可以手动修改查找以指向正确的文件?
答案1
这可以提供帮助,直到问题被修复并上传到发行版。
\documentclass{book}
\usepackage{fontspec}
\setmainfont{arial}[ %Need such long loading because of luaotfload issue
Extension = .ttf,
UprightFont = *,
BoldFont = *bd,
ItalicFont = *i,
BoldItalicFont = *bi]
\newfontfamily\cyrillicfont{arial}[ %for Cyrillic users
Extension = .ttf ,
UprightFont = *,
BoldFont = *bd,
ItalicFont = *i,
BoldItalicFont = *bi]
\usepackage{lipsum}
\begin{document}
\lipsum[1-5]
\end{document}
Idea 可用于受影响的字体。可以检查
luaotfload-tool --find="Arial"
指向arialn.ttf
哪个是 Arial Narrow,
luaotfload-tool --find="DejaVuSerif"
指向dejavuserifcondensed.ttf
的是DejaVuSerifCondensed。
问题至少是一个月大。