![TeX Gyre Pagella 和 XeLaTeX 的小写字母](https://linux22.com/image/348520/TeX%20Gyre%20Pagella%20%E5%92%8C%20XeLaTeX%20%E7%9A%84%E5%B0%8F%E5%86%99%E5%AD%97%E6%AF%8D.png)
这个问题已经问过了这里,但接受的答案又恢复为 pdflatex,这对该项目不起作用。
我最初指定 Palatino 字体\usepackage[sc, osf]{mathpazo}
,但是我有学到了由于polyglossia
我需要各种国际语言的字体,fontspec
因此我会使用我从\setmainfont{TeX Gyre Pagella}
加拿大运输安全局下载。
TeX Gyre Pagella
似乎不包含小型大写字母,因此我下载并安装,Palatino Small Caps & Old Style Figures.ttf
如下所示:
fc-list | grep Palatino
/Users/mikekilmer/Library/Fonts/Palatino Small Caps & Old Style Figures.ttf: Palatino Small Caps & Old Style,Palatino:style=Regular,Small Caps & Old Style Figures
/System/Library/Fonts/Palatino.ttc: Palatino:style=Bold
/System/Library/Fonts/Palatino.ttc: Palatino:style=Regular
/System/Library/Fonts/Palatino.ttc: Palatino:style=Bold Italic
/System/Library/Fonts/Palatino.ttc: Palatino:style=Italic
据我从以下字体信息所知,Palatino-SC 将是值得参考使用的名称:
otfinfo -i '~/Library/Fonts/Palatino Small Caps & Old Style Figures.ttf'
Family: Palatino Small Caps & Old Style
Subfamily: Regular
Full name: Palatino-SC
PostScript name: Palatino-SC
Version: 001.001
Unique ID: Palatino Small Caps & Old Style Figures:1178633258
Copyright: Copyright (c) 1985, 1987, 1989, 1990, 1991 Adobe Systems Incorporated. All Rights Reserved.Palatino is a trademark of Linotype AG and/or its subsidiaries.
但在此示例中,没有显示小型大写字母:
\documentclass[a5paper,twoside,11pt]{extbook}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont[Numbers=OldStyle,
SmallCapsFont={Palatino-SC},
SmallCapsFeatures={Letters=SmallCaps}
]{TeX Gyre Pagella}
\begin{document}
\textsc{Once upon a time} we had a story. Once upon a time.
\end{document}
有效的是以下fontspec
字体系列替换:
\newfontfamily\scshape[Letters=SmallCaps,Scale=1.15]{Palatino-SC}
有人能解释一下 1. 为什么setmainfont
参数不起作用以及 2. 如何显示 OldStyleNums 吗?
答案1
XeLaTeX 中的字体定义取决于您如何安装它们。
如果 TeX Gyre Pagella 可用作系统字体,则
\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setmainfont{TeX Gyre Pagella}[
Numbers=OldStyle,
]
\begin{document}
\textsc{Once upon a time} we had a story. Once upon a time.
1234567890
\end{document}
就足够了。否则,您需要使用稍微复杂一点的方法使用 TeX Live 发行版中的字体。
如果我使用 运行示例xelatex -output-driver="xdvipdfmx -vv"
,我会在终端上得到以下输出:
DVI Comment: XeTeX output 2017.01.29:2158
<AGL:texglyphlist.txt><AGL:pdfglyphlist.txt><AGL:glyphlist.txt>[1</Library/Fonts/tex-gyre/[email protected]<NATIVE-FONTMAP:/Library/Fonts/tex-gyre/texgyrepagella-regular.otf/0/H/65536/0/0>
fontmap: /Library/Fonts/tex-gyre/texgyrepagella-regular.otf/0/H/65536/0/0 -> /Library/Fonts/tex-gyre/texgyrepagella-regular.otf(Identity-H)
pdf_font>> Input encoding "Identity-H" requires at least 2 bytes.
pdf_font>> The -m <00> option will be assumed for "/Library/Fonts/tex-gyre/texgyrepagella-regular.otf".
(CID:TeXGyrePagella-Regular)
pdf_font>> Type0 font "/Library/Fonts/tex-gyre/texgyrepagella-regular.otf" cmap_id=<Identity-H,0> opened at font_id=</Library/Fonts/tex-gyre/texgyrepagella-regular.otf/0/H/65536/0/0,0>.
></Library/Fonts/tex-gyre/[email protected]>]
otf_cmap>> Creating ToUnicode CMap for "/Library/Fonts/tex-gyre/texgyrepagella-regular.otf"...
(CID:/Library/Fonts/tex-gyre/texgyrepagella-regular.otf[SMRJXI+TeXGyrePagella-Regular][CIDFontType0][39 glyphs][5175 bytes])
这表明我安装了 TeX Gyre 字体,/Library/Fonts
并且这些字体被使用xdvipdfmx
。
稍微复杂一点的版本是
\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setmainfont{texgyrepagella}[
Extension=.otf,
UprightFont=*-regular,
ItalicFont=*-italic,
BoldFont=*-bold,
BoldItalicFont=*-bolditalic,
Numbers=OldStyle,
]
\begin{document}
\textsc{Once upon a time} we had a story. Once upon a time.
1234567890
\end{document}
详细输出变为
DVI Comment: XeTeX output 2017.01.29:2202
<AGL:texglyphlist.txt><AGL:pdfglyphlist.txt><AGL:glyphlist.txt>[1</usr/local/texlive/2016/texmf-dist/fonts/opentype/public/tex-gyre/[email protected]<NATIVE-FONTMAP:/usr/local/texlive/2016/texmf-dist/fonts/opentype/public/tex-gyre/texgyrepagella-regular.otf/0/H/65536/0/0>
fontmap: /usr/local/texlive/2016/texmf-dist/fonts/opentype/public/tex-gyre/texgyrepagella-regular.otf/0/H/65536/0/0 -> /usr/local/texlive/2016/texmf-dist/fonts/opentype/public/tex-gyre/texgyrepagella-regular.otf(Identity-H)
pdf_font>> Input encoding "Identity-H" requires at least 2 bytes.
pdf_font>> The -m <00> option will be assumed for "/usr/local/texlive/2016/texmf-dist/fonts/opentype/public/tex-gyre/texgyrepagella-regular.otf".
(CID:TeXGyrePagella-Regular)
pdf_font>> Type0 font "/usr/local/texlive/2016/texmf-dist/fonts/opentype/public/tex-gyre/texgyrepagella-regular.otf" cmap_id=<Identity-H,0> opened at font_id=</usr/local/texlive/2016/texmf-dist/fonts/opentype/public/tex-gyre/texgyrepagella-regular.otf/0/H/65536/0/0,0>.
></usr/local/texlive/2016/texmf-dist/fonts/opentype/public/tex-gyre/[email protected]>]
otf_cmap>> Creating ToUnicode CMap for "/usr/local/texlive/2016/texmf-dist/fonts/opentype/public/tex-gyre/texgyrepagella-regular.otf"...
(CID:/usr/local/texlive/2016/texmf-dist/fonts/opentype/public/tex-gyre/texgyrepagella-regular.otf[KRFMAA+TeXGyrePagella-Regular][CIDFontType0][39 glyphs][5175 bytes])
表明 TeX Live 目录已被使用。
两种情况下的输出是相同的。
正如您所见,小型大写字母受到尊重。