我正在尝试为 Minion3 创建一个包含所有光学尺寸的字体规范定义文件。当我在一个defaultfontfeatures
定义中定义所有内容时,它就可以正常工作:
\defaultfontfeatures[Minion3]
{
UprightFont = Minion3-Regular,
BoldFont = Minion3-Bold,
ItalicFont = Minion3-Italic,
BoldItalicFont = Minion3-BoldItalic,
%Numbers = {Proportional,OldStyle},
Numbers = {Proportional},
SizeFeatures = {
{ Size = -9.9, Font = Minion 3 Caption },
{ Size = 9.9-13.9 },
{ Size = 13.9-25.9, Font = Minion 3 Subhead},
{ Size = 25.9-, Font = Minion 3 Display},
},
BoldFeatures = {
SizeFeatures = {
{ Size = -9.9, Font = Minion 3 Caption Bold},
{ Size = 9.9-13.9 },
{ Size = 13.9-25.9, Font = Minion 3 Subhead Bold},
{ Size = 25.9-, Font = Minion 3 Display Bold},
},
},
ItalicFeatures = {
SizeFeatures = {
{ Size = -9.9, Font = Minion 3 Caption Italic},
{ Size = 9.9-13.9 },
{ Size = 13.9-25.9, Font = Minion 3 Subhead Italic},
{ Size = 25.9-, Font = Minion 3 Display Italic},
},
},
BoldItalicFeatures = {
SizeFeatures = {
{ Size = -9.9, Font = Minion 3 Caption Bold Italic},
{ Size = 9.9-13.9 },
{ Size = 13.9-25.9, Font = Minion 3 Subhead Bold Italic},
{ Size = 25.9-, Font = Minion 3 Display Bold Italic},
},
},
}
但是,根据 fontspec 手册(第 12-13 页),我应该能够在同一个文件中为每种 Regular、Bold、Italic 和 BoldItalic 字体添加一个声明,如下所示:
\defaultfontfeatures[Minion3]{
UprightFont = {Minion3R},
BoldFont = {Minion3B},
ItalicFont = {Minion3I},
BoldItalicFont = {Minion3BI},
%Numbers = {Proportional,OldStyle},
Numbers = {Proportional},
}
\defaultfontfeatures[Minion3R]{
Extension = .otf,
Font = Minion3-Regular,
SizeFeatures = {
{ Size = -9.9, Font = Minion3Caption-Regular },
{ Size = 9.9-13.9 },
{ Size = 13.9-25.9, Font = Minion3Subhead-Regular},
{ Size = 25.9-, Font = Minion3Display-Regular},
},
}
\defaultfontfeatures[Minion3B]{
Font = Minion3-Bold,
SizeFeatures = {
{ Size = -9.9, Font = Minion3Caption-Bold },
{ Size = 9.9-13.9 },
{ Size = 13.9-25.9, Font = Minion3Subhead-Bold},
{ Size = 25.9-, Font = Minion3Display-Bold},
},
}
\defaultfontfeatures[Minion3I]{
Font = Minion3-Italic,
SizeFeatures = {
{ Size = -9.9, Font = Minion3Caption-Italic },
{ Size = 9.9-13.9 },
{ Size = 13.9-25.9, Font = Minion3Subhead-Italic},
{ Size = 25.9-, Font = Minion3Display-Italic},
},
}
\defaultfontfeatures[Minion3BI]{
Font = Minion3-BoldItalic,
SizeFeatures = {
{ Size = -9.9, Font = Minion3Caption-BoldItalic },
{ Size = 9.9-13.9 },
{ Size = 13.9-25.9, Font = Minion3Subhead-BoldItalic},
{ Size = 25.9-, Font = Minion3Display-BoldItalic},
},
}
不幸的是,第二个版本不起作用,编译失败并出现错误
!包 fontspec 错误:找不到字体“Minion3R”。
fontspec 定义文件名为 Minion3.fontspec
并取自一个用于演示这些功能的测试 tex 文件http://tex.stackexchange.com/q/126096/14066(https://bitbucket.org/phg/lua-la-tex-tests/src/default/latex/ltx-fontspec-optical-size-3.tex):
\documentclass [12pt] {article}
\usepackage {fontspec}
%% set your font here
%\setmainfont {Arno Pro}
\setmainfont{Minion3}
%% helper for extracting the font name name, please ignore
\def\fontinfo{%
\directlua {
local f = fonts.hashes.identifiers [font.current ()]
if f then
tex.sprint (f.fullname, " ", string.sub (tostring (f.size / 2^16), 1, 4), "pt")
end
}%
}
%% testing macro
\def\test#1{%
#1\section {\detokenize {#1}}
\begin {itemize}
\item {\rmfamily \upshape \fontinfo}
\item {\rmfamily \upshape \bfseries \fontinfo}
\item {\rmfamily \itshape \fontinfo}
\item {\rmfamily \itshape \bfseries \fontinfo}
\item {\rmfamily \scshape \fontinfo}
\end {itemize}
}
\begin {document}
testing family ``\rmdefault'' ...\par\vskip1cm
\test\tiny
\test\scriptsize
\test\small
\test\normalsize
\test\large
\test\Large
\test\LARGE
\test\Huge
\end {document}
我确信我遗漏了一些明显的东西,但却无法弄清楚是什么。
编辑:
由于这不是Minion3
问题,而且此字体是专有的,因此可能很难复制。此问题目前在没有的情况下也可以重现SizeFeatures
,因此我添加了一个新MyXCharter.fontspec
文件,该文件使用 texlive 附带的字体集重现了第一个障碍:
\defaultfontfeatures[MyXCharter]{
UprightFont = {XCharterR},
BoldFont = {XCharterB},
ItalicFont = {XCharterI},
BoldItalicFont = {XCharterBI},
SlantedFont = {XCharterS},
BoldSlantedFont = {XCharterBS},
%Numbers = {Proportional,OldStyle},
Numbers = {Proportional},
}
\defaultfontfeatures[XCharterR]{
Extension = .otf,
Font = XCharter-Roman,
}
\defaultfontfeatures[XCharterB]{
Extension = .otf,
Font = XCharter-Bold,
}
\defaultfontfeatures[XCharterI]{
Extension = .otf,
Font = XCharter-Italic,
}
\defaultfontfeatures[XCharterBI]{
Extension = .otf,
Font = XCharter-BoldItalic,
}
\defaultfontfeatures[XCharterS]{
Extension = .otf,
Font = XCharter-Slanted,
}
\defaultfontfeatures[XCharterBS]{
Extension = .otf,
Font = XCharter-BoldSlanted,
}