我尝试使用该Ubuntu
字体打印 SmallCaps 格式的文本,但是它不起作用。
代码:
% !TeX program = lualatex
\documentclass[ebook,11pt,twoside,openright,showtrims]{memoir}
% -------------------------------------------------------Packages
\usepackage{fontspec}
\usepackage{xcolor}
\begin{document}
\mainmatter
\setmainfont{Ubuntu}
\textsc{Lorem not working}
\scshape{Lorem not working}
\setmainfont{Free Sans}
\textsc{Lorem working}
\scshape{Lorem working}
\end{document}
输出
日志中说 Ubuntu 有小型大写字母,那么为什么它不起作用呢?
. fontspec info: "defining-font"
.
. Font family 'Ubuntu(0)' created for font 'Ubuntu' with options
. [Ligatures=TeX].
.
. This font family consists of the following NFSS series/shapes:
.
. - 'normal' (m/n) with NFSS spec.:
. <->"Ubuntu:mode=node;script=latn;language=DFLT;+tlig;"
. - 'small caps' (m/sc) with NFSS spec.:
. - 'bold' (bx/n) with NFSS spec.:
. <->"Ubuntu/B:mode=node;script=latn;language=DFLT;+tlig;"
. - 'bold small caps' (bx/sc) with NFSS spec.:
. - 'italic' (m/it) with NFSS spec.:
. <->"Ubuntu/I:mode=node;script=latn;language=DFLT;+tlig;"
. - 'italic small caps' (m/itsc) with NFSS spec.:
. - 'bold italic' (bx/it) with NFSS spec.:
. <->"Ubuntu/BI:mode=node;script=latn;language=DFLT;+tlig;"
. - 'bold italic small caps' (bx/itsc) with NFSS spec.:
.................................................
LaTeX Info: Redefining \rmfamily on input line 11.
答案1
如果我运行简化代码(通过文件名选择字体,因为我没有将其安装为系统字体,但这无关紧要)
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Ubuntu}[
Extension=.ttf,
UprightFont=*-Regular,
BoldFont=*-Bold,
ItalicFont=*-Italic,
BoldItalicFont=*-BoldItalic,
]
\begin{document}
\textsc{Lorem not working}
\end{document}
我在日志文件中看到
Package fontspec Info: Font family 'Ubuntu(0)' created for font 'Ubuntu' with
(fontspec) options
(fontspec) [Ligatures=TeX,Extension=.ttf,UprightFont=*-Regular,Bold
Font=*-Bold,ItalicFont=*-Italic,BoldItalicFont=*-BoldItalic].
(fontspec)
(fontspec) This font family consists of the following NFSS
(fontspec) series/shapes:
(fontspec)
(fontspec) - 'normal' (m/n) with NFSS spec.:
(fontspec) <->"[Ubuntu-Regular.ttf]/OT:script=latn;language=dflt;ma
pping=tex-text;"
(fontspec) - 'small caps' (m/sc) with NFSS spec.:
(fontspec) - 'bold' (b/n) with NFSS spec.:
(fontspec) <->"[Ubuntu-Bold.ttf]/OT:script=latn;language=dflt;mappi
ng=tex-text;"
(fontspec) - 'bold small caps' (b/sc) with NFSS spec.:
(fontspec) - 'italic' (m/it) with NFSS spec.:
(fontspec) <->"[Ubuntu-Italic.ttf]/OT:script=latn;language=dflt;map
ping=tex-text;"
(fontspec) - 'italic small caps' (m/scit) with NFSS spec.:
(fontspec) - 'bold italic' (b/it) with NFSS spec.:
(fontspec) <->"[Ubuntu-BoldItalic.ttf]/OT:script=latn;language=dflt
;mapping=tex-text;"
(fontspec) - 'bold italic small caps' (b/scit) with NFSS spec.:
但是也
LaTeX Font Warning: Font shape `TU/Ubuntu(0)/m/sc' undefined
(Font) using `TU/Ubuntu(0)/m/n' instead on input line 14.
scmp
它只是告诉你该字体没有功能。以下信息证实了这一点otfinfo
:
> otfinfo -f Ubuntu-Regular.ttf
case Case-Sensitive Forms
dnom Denominators
frac Fractions
kern Kerning
liga Standard Ligatures
numr Numerators
ordn Ordinals
pnum Proportional Figures
salt Stylistic Alternates
sinf Scientific Inferiors
ss01 Stylistic Set 1
subs Subscript
sups Superscript
tnum Tabular Figures