fontspec
我希望在编译完成后使用适当的设置,根据字体大小对小型大写字母间距进行不同的设置XeLaTeX
。到目前为止,我还没有成功。这是我的 MWE:
\documentclass[12pt]{memoir}
\usepackage{xcolor,fontspec}
\setmainfont[
UprightFont = *-Regular,
BoldFont = *-Bold,
SizeFeatures = {
{
Size = { -10},
Color = green,
SmallCapsFeatures = {
LetterSpace = 30.0,
WordSpace = { 1.5, 1.5, 1.5 },
},
},
{
Size = {10-14},
Color = red,
SmallCapsFeatures = {
LetterSpace = 9.0,
WordSpace = { 1.5, 1.5, 1.5 },
},
},
{
Size = {14- },
Color = yellow,
SmallCapsFeatures = {
LetterSpace = 6.0,
WordSpace = { 1.5, 1.5, 1.5 },
},
}
}] {BulmerMTStd} %<- Any OpenType font of your choice
\pagestyle{empty}
\begin{document}
\noindent\scshape
{\tiny A tiny line.}\\
{\normalsize A normalsize line.}\\
{\LARGE A LARGE line.}
\end{document}
颜色只是为了识别尺寸范围,字母间距值的设置只是为了清楚地区分。
我尝试过不同的字体,但总是得到相同的结果,即字母间距似乎适合“中等”和“大”尺寸,但不适合“最小”尺寸(根本没有明显的字母间距)。我想我做错了什么。实现我想要的正确方法是什么?
编辑:实际上,通过使用键值LetterSpace
并明确关闭键中Size
从下方或上方的开放范围,我得到了不同种类的明显奇怪的行为,表现为字母间距混合在不同的字体大小范围之间。
答案1
我不知道为什么字体规格就是这样,但这里有一个解决方法:添加另一个尺寸特征,这样每个尺寸SmallCapsFeatures
都会适用于下一个尺寸。MWE:
\documentclass[12pt]{article}
\usepackage{xcolor,fontspec}
\setmainfont[
SizeFeatures = {
{
Size = { -1},
Color = blue,
SmallCapsFeatures = {
LetterSpace=200.0, % <-- These features will apply to the next font size
WordSpace={1.5,1.5,1.5 },% <-- These features will apply to the next font size
},
},
{
Size = { -10},
Color = green,
SmallCapsFeatures = {
LetterSpace=9.0,% <-- These features will apply to the next font size
WordSpace={1.5,1.5,1.5},% <-- These features will apply to the next font size
},
},
{
Size = {10-14},
Color = red,
SmallCapsFeatures = {
LetterSpace=9.0,% <-- These features will apply to the next font size
WordSpace={1.5,1.5,1.5},% <-- These features will apply to the next font size
},
},
{
Size = {14- },
Color = yellow,
SmallCapsFeatures = {
LetterSpace = 6.0,
WordSpace = { 1.5, 1.5, 1.5 },
},
}
}] {Minion Pro} %<- Any OpenType font of your choice
\begin{document}
\noindent\scshape
{\tiny A tiny line.}\\
{\normalsize A normalsize line.}\\
{\Huge A LARGE line.}
\end{document}