我正在尝试让小写字母与鸽子字体。它是一种 OpenType 字体,支持 UppercaseSmallCaps 和 SmallCaps(如果我没记错的话,是c2sc
& smcp
)。不幸的是,当我尝试实际使用小写字母时(无论是使用\textsc
还是手动),只有实际的大写字母是小写字母,而小写字母仍为小写字母。
以下是一个例子:
\documentclass{article}
\usepackage[TU]{fontenc}
\usepackage{fontspec}
\setmainfont[Renderer=ICU]{Doves Type}
\begin{document}
This is not Small Caps text.
\textsc{This is Small Caps text}.
{\fontspec{Doves Type}THIS SENTENCE no verb}
{\fontspec[Letters=SmallCaps]{Doves Type}THIS SENTENCE no verb}
{\fontspec[Letters=UppercaseSmallCaps]{Doves Type}THIS SENTENCE no verb}
{\fontspec[Letters=SmallCaps]{Linux Libertine O}THIS SENTENCE no verb}
{\fontspec[Letters=SmallCaps]{Junicode}THIS SENTENCE no verb}
\end{document}
输出如下:
或者,将其渲染为纯文本,效果会稍微差一些:
This is not Small Caps text.
This is Small Caps text.
THIS SENTENCE no verb
THIS SENTENCE no verb
THIS SENTENCE no verb
THIS SENTENCE NO VERB
THIS SENTENCE NO VERB
我认为它可能是默认设置为 c2sc,但我不确定这是否真的是内部发生的。有什么想法可以让我得到正确的小型大写字母吗?我尝试过谷歌搜索并查看小型大写字母标签下的问题,但没有成功。
答案1
消息:截至 2019-06-17,设计师已修复该
smcp
功能。现在只需编写\setmainfont{Doves Type}[SmallCapsFeatures={Ligatures={NoCommon,NoRare}}]
,这个问题之所以有趣,只是因为它是诊断字体问题并使用 动态修复它们的一个例子\directlua{...}
。
让我首先更清楚地展示这个问题:
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Doves Type}
\begin{document}
This is not Small Caps text.
\textsc{This is Small Caps text, WRONGLY affecting only caps.}
{\addfontfeatures{Letters=SmallCaps}This is Small Caps text, WRONGLY affecting only caps.}
{\addfontfeatures{Letters=UppercaseSmallCaps}This is Small Caps text, RIGHTLY affecting only caps.}
\end{document}
(请注意使用\addfontfeatures{...}
而不是效率较低的重复\fontspec{...}
,手册中描述该命令通常不推荐。)
为什么会出现这个问题?因为这个smcp
特征的定义方式与 完全相同c2sc
,这是错误的。也就是说,它A
用替换了A.sc
,而它应该用 替换a
,A.sc
字母表的其余部分也是如此。
该怎么办?我很少使用xelatex
,所以我需要更多时间来思考解决方案(其他人可能会做得更好)。但是对于lualatex
,解决方案是使用\directlua{...}
将正确的替换添加到smcp
:
\documentclass{article}
\usepackage{fontspec}
\directlua{
fonts.handlers.otf.addfeature{
name = "smcp",
type = "substitution",
data = {
a = "A.sc",
b = "B.sc",
c = "C.sc",
d = "D.sc",
e = "E.sc",
f = "F.sc",
g = "G.sc",
h = "H.sc",
i = "I.sc",
j = "J.sc",
k = "K.sc",
l = "L.sc",
m = "M.sc",
n = "N.sc",
o = "O.sc",
p = "P.sc",
q = "Q.sc",
r = "R.sc",
s = "S.sc",
t = "T.sc",
u = "U.sc",
v = "V.sc",
w = "W.sc",
x = "X.sc",
y = "Y.sc",
z = "Z.sc",
},
}
}
\setmainfont{Doves Type}
\begin{document}
This is not Small Caps text.
\textsc{This is Small Caps text, WRONGLY affecting only caps.}
{\addfontfeatures{Letters=SmallCaps}This is Small Caps text, WRONGLY affecting only caps.}
{\addfontfeatures{Letters=UppercaseSmallCaps}This is Small Caps text, RIGHTLY affecting only caps.}
\end{document}
如您所见,这不是一个完整的解决方案:首先,它给出了“c2sc
加号smcp
”结果(您可能想要也可能不想要),其次,它会导致连字。我将尝试改进我的解决方案,并在稍后更新此答案。
更好的解决方案是联系设计师,指出这个问题,并询问他是否可以smcp
在下一版字体中修复 的定义。(为了方便使用,最好重命名花体 Q 等字形并修复其编码:现在,Q 位于 ✓ 应该在的位置,并且它的名称也与之相符。)根据我的经验,大多数设计师都希望了解任何缺陷,以便他们可以修复它们。
更新
要修复连字问题,请关闭小型大写字母;并将小型大写字母仅应用于小写字母,替换A
等A.sc
,如下所示:
\documentclass{article}
\usepackage{fontspec}
\directlua{
fonts.handlers.otf.addfeature{
name = "smcp",
type = "substitution",
data = {
["A.sc"] = "A",
a = "A.sc",
["B.sc"] = "B",
b = "B.sc",
["C.sc"] = "C",
c = "C.sc",
["D.sc"] = "D",
d = "D.sc",
["E.sc"] = "E",
e = "E.sc",
["F.sc"] = "F",
f = "F.sc",
["G.sc"] = "G",
g = "G.sc",
["H.sc"] = "H",
h = "H.sc",
["I.sc"] = "I",
i = "I.sc",
["J.sc"] = "J",
j = "J.sc",
["K.sc"] = "K",
k = "K.sc",
["L.sc"] = "L",
l = "L.sc",
["M.sc"] = "M",
m = "M.sc",
["N.sc"] = "N",
n = "N.sc",
["O.sc"] = "O",
o = "O.sc",
["P.sc"] = "P",
p = "P.sc",
["Q.sc"] = "Q",
q = "Q.sc",
["R.sc"] = "R",
r = "R.sc",
["S.sc"] = "S",
s = "S.sc",
["T.sc"] = "T",
t = "T.sc",
["U.sc"] = "U",
u = "U.sc",
["V.sc"] = "V",
v = "V.sc",
["W.sc"] = "W",
w = "W.sc",
["X.sc"] = "X",
x = "X.sc",
["Y.sc"] = "Y",
y = "Y.sc",
["Z.sc"] = "Z",
z = "Z.sc",
},
}
}
\setmainfont{Doves Type}[
SmallCapsFeatures={Ligatures={NoCommon,NoRare}}]
\begin{document}
This is not Small Caps text.
\textsc{This is Small Caps text, WRONGLY affecting only caps.}
{\addfontfeatures{Letters=SmallCaps,Ligatures={NoCommon,NoRare}}This is Small Caps text, WRONGLY AFFECTING only caps.}
{\addfontfeatures{Letters=UppercaseSmallCaps}This is Small Caps text, RIGHTLY AFFECTING only caps.}
\end{document}
对于较旧的安装
对于较旧版本的luaotfload
,请尝试此较旧的语法(请参阅luaotfload 或 fontspec、otf 最近有变化吗?和如何调整LuaTeX 中的字体功能?):
\directlua{
fonts.handlers.otf.addfeature{
name = "smcp",
{
type = "substitution",
data = {
["A.sc"] = "A",
a = "A.sc",
}
},
"correction of smcp feature"
}
}