编译此简单代码以在本地应用特定的样式集:
\documentclass{article}
\usepackage{fontspec}
\usepackage[italian]{babel}
\babelfont{rm}[Numbers={Proportional,OldStyle},RawFeature=+calt]{EBGaramond}
\newfontfamily\myfont[Numbers={Proportional,OldStyle},RawFeature={+calt,+ss06}]{EBGaramond}
\begin{document}
Q \textsc{Q} \textsc{q}
\myfont{Q \textsc{Q} \textsc{q}}
\end{document}
我收到:
Package babel Info: The current font is not a babel standard family:
(babel) EBGaramond:mode=node;script=latn;language=dflt;+pnum;+onum;
+calt,+ss06;
(babel) There is nothing intrinsically wrong with this warning, and
(babel) you can ignore it altogether if you do not need these
(babel) families. But if they are used in the document, you should
be
(babel) aware 'babel' will no set Script and Language for them, so
(babel) you may consider defining a new family with \babelfont.
我该如何改正\newfontfamily
?
谢谢
答案1
在这种情况下,您可以切换到标准字体并添加字体功能。您似乎希望命令更改括号内的文本,但命令\myfont
实际上所做的是从那时起将字体更改为 EB Garamond 样式集 6。因此,这里有一个演示如何以三种不同的方式执行此操作:
- 命令
\textswash
,例如\textsc
或\textsf
- 命令
\swashstyle
,例如\scshape
或\sffamily
\Qswash
大写扁平 Q 和\qswash
小写扁平 Q 的命令
\documentclass{article}
\usepackage[italian]{babel}
\usepackage{fontspec}
\babelfont{rm}[Numbers={Proportional,OldStyle},RawFeature=+calt]{EBGaramond}
\newcommand\swashstyle{\rmfamily\addfontfeature{StylisticSet=6}}
\DeclareTextFontCommand\textswash{\swashstyle}
\newcommand\Qswash{\textswash{Q}}
\newcommand\qswash{\textswash{\scshape q}}
\begin{document}
\noindent Q \textsc{Q} \textsc{q} \\
\textswash{Q \textsc{Q} \textsc{q}} \\
\Qswash \textsc{\Qswash} \qswash \\
{\swashstyle Q \textsc{Q} \textsc{q}}
\end{document}
您也可以忽略该警告。正如消息所述,它是无害的。
答案2
编辑:查看 babel 文档第 25-26 页,我发现了这种方法:
\documentclass{article}
\usepackage{fontspec}
\usepackage[italian]{babel}
\babelfont{rm}[Numbers={Proportional,OldStyle},RawFeature=+calt]{EB Garamond}
\babelfont{myfont}[Numbers={Proportional,OldStyle},RawFeature={+calt,+ss06}]{EB Garamond}
\begin{document}
Q \textsc{Q} \textsc{q}
\textmyfont{Q} {\myfontfamily \textsc{Q} \textsc{q}}
\end{document}
另一种方法:使用polyglossia
而不是babel
。然后使用\addfontfeature
来激活该+ss06
功能。
\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{italian}
\setmainfont[Numbers={Proportional,OldStyle},RawFeature={+calt}]{EB Garamond}
\begin{document}
Q \textsc{Q} \textsc{q}
{\addfontfeature{RawFeature=+ss06} Q \textsc{Q} \textsc{q}}
\end{document}