我正在嘗試使用 Times with XeLaTeX 來排版我的文件。由於 Times 不包含小型大寫字母,因此我只想將 TeX Gyre Termes 用於小型大寫字母。我試過這個方法,但沒有成功。發出警告並且輸出不是小型大寫字母。
問題:
- 怎麼了?
- 我怎樣才能做到這一點?
這是一個 MWE:
\documentclass{article}
\usepackage{fontspec}
\setmainfont[
SmallCapsFont={TeX Gyre Termes},
SmallCapsFeatures={Letters=SmallCaps},
]{Times}
\begin{document}
Hello!
\textsc{Hello!}
\end{document}
和警告:
*************************************************
* fontspec warning: "aat-feature-not-exist-in-font"
*
* AAT feature 'Letters=SmallCaps' (3,3) not available in font 'TeX Gyre
* Termes'.
*************************************************
我嘗試過的:
- 我嘗試使用 LuaLaTeX 進行排版,結果很好,沒有任何警告。
- 我更換
Times
了Times New Roman
,沒有問題。 - 我添加了
Renderer=ICU
,警告更改為icu-feature-not-exist-in-font
。看來fontspec可以.dfont
跟ICU一起使用? - 我更換了
Times
另一種.dfont
字體Helvetica Neue
,問題就消失了。因此並非所有.dfont
字體都會導致問題...
我在 OS X Mountain Lion 上使用 MacTeX 2013。
更新
根據@KhaledHosny的建議,我嘗試添加\the\XeTeXfonttype\font
before 和 after \textsc{
,並且都返回1
(AAT字體)。他們Render=ICU
返回了2
(OpenType 字體),但我沒有得到小型大寫字母。 XeTeX 似乎可以將 Times 視為 OpenType,但即使這樣也SmallCapsFeatures
不起作用。
答案1
我發現這可以透過 NFSS 來實現。
首先,Times 和 TeX Gyre Termes 分別載入。然後覆蓋 NFSS 中 Times 小寫字母的定義,使其重定向到 TeX Gyre Termes 小寫字母。
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Times}
\newfontfamily\tgtermes{TeX Gyre Termes}
\makeatletter
\begingroup
\tgtermes
\DeclareFontShape{\f@encoding}{\rmdefault}{m}{sc}{%
<-> ssub * \f@family/m/sc}{}
\DeclareFontShape{\f@encoding}{\rmdefault}{bx}{sc}{%
<-> ssub * \f@family/bx/sc}{}
\endgroup
\makeatother
\begin{document}
Hello!
\textsc{Hello!}
\end{document}
答案2
也許最簡單的方法如下:
在範例中,深紅文字沒有小型大寫字母,但是赤紅做。 (在這種情況下,此處使用的比例僅與外觀較好的輸出有關。)
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Crimson Text}
\newfontinstance\scshape[Letters=SmallCaps,Scale=1.15]{Crimson}
\begin{document}
Text \textsc{Text}
\end{document}
如前所述更新這裡,\newfontinstance
不再起作用,替換為\newfontfamily
。