帶有 TeX Gyre Pagella 和 XeLaTeX 的小型大寫字母

帶有 TeX Gyre Pagella 和 XeLaTeX 的小型大寫字母

這個問題已經被問過這裡,但接受的答案恢復為 pdflatex,這不適用於該項目。

我最初指定 Palatino 字體為\usepackage[sc, osf]{mathpazo},但是我有學到了由於polyglossia,我需要各種國際語言,隱式加載fontspec,我改為使用\setmainfont{TeX Gyre Pagella},我手動安裝在(OS X)系統上的字體CTAN下載。

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 目錄。

兩種情況下的輸出是相同的。

在此輸入影像描述

如您所見,小型大寫字母受到尊重。

相關內容