(备注:这个问题最初是在 TeX 方面的大新闻即将从 TeXLive2013 过渡到 TeXLive2014 时发布的。由于此帖子中发现的问题在 TeXLive2015 中仍然存在,因此我选择相应地更新帖子的标题。)
考虑以下 MWE:
% !TEX TS-program = lualatex
\documentclass{article}
\listfiles
\usepackage{fontspec}
\setmainfont[Ligatures={Common,Rare}]{Hoefler Text}
\begin{document}
ff fi fl ffi ffl fj ct st
\end{document}
当我在我的系统(MacOSX 10.9.2、MacTeX2013、luatex 0.76.0)上使用 LuaLaTeX 编译该程序时,我得到了预期的结果,即所有连字符都正确生成:
但是,如果我切换到 TeXLive2014(目前处于高级测试阶段), 采用 luatex 0.79.1, 因此不会创建连字:
如果我 (i) 在 XeLaTeX 而不是 LuaLaTeX 下编译 MWE,或者 (ii) 使用不同的字体,例如,,或,,则在 TeXLive2014 下不会出现此问题。Adobe Garamond Pro
(Garamond Premier Pro
当然Latin Modern Roman
,后一种字体不具备 fj、ct 和 st 的连字,但具备连字是为 ff、fi、fl、ffi 和 ffl 生成。
使用时是否需要调整设置以启用连字Hoefler Text
?
为了完整起见,以下是 LuaLaTeX/TeXLive2014 运行使用的文件:
LuaTeX, Version beta-0.79.1 (TeX Live 2014/dev) (rev 4971) (format=lualatex 2014.4.24)
*File List*
article.cls 2007/10/19 v1.4h Standard LaTeX document class
size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
fontspec.sty 2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX
expl3.sty 2014/01/07 v4646 L3 Experimental code bundle wrapper
l3names.sty 2014/01/04 v4640 L3 Namespace for primitives
l3bootstrap.sty 2014/01/04 v4640 L3 Experimental bootstrap code
luatex.sty 2010/03/09 v0.4 LuaTeX basic definition package (HO)
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/error messages (HO)
ifluatex.sty 2010/03/01 v1.3 Provides the ifluatex switch (HO)
etex.sty 1998/03/26 v2.0 eTeX basic definition package (PEB)
luatex-loader.sty 2010/03/09 v0.4 Lua module loader (HO)
pdftexcmds.sty 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
ltxcmds.sty 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
ifpdf.sty 2011/01/30 v2.3 Provides the ifpdf switch (HO)
l3basics.sty 2014/01/04 v4642 L3 Basic definitions
l3expan.sty 2014/01/04 v4642 L3 Argument expansion
l3tl.sty 2013/12/27 v4625 L3 Token lists
l3seq.sty 2013/12/14 v4623 L3 Sequences and stacks
l3int.sty 2013/08/02 v4583 L3 Integers
l3quark.sty 2013/12/14 v4623 L3 Quarks
l3prg.sty 2014/01/04 v4642 L3 Control structures
l3clist.sty 2013/07/28 v4581 L3 Comma separated lists
l3token.sty 2013/08/25 v4587 L3 Experimental token manipulation
l3prop.sty 2013/12/14 v4623 L3 Property lists
l3msg.sty 2013/07/28 v4581 L3 Messages
l3file.sty 2013/10/13 v4596 L3 File and I/O operations
l3skip.sty 2013/07/28 v4581 L3 Dimensions and skips
l3keys.sty 2013/12/08 v4614 L3 Experimental key-value interfaces
l3fp.sty 2014/01/04 v4642 L3 Floating points
l3box.sty 2013/07/28 v4581 L3 Experimental boxes
l3coffins.sty 2013/12/14 v4624 L3 Coffin code layer
l3color.sty 2012/08/29 v4156 L3 Experimental color support
l3luatex.sty 2013/07/28 v4581 L3 Experimental LuaTeX-specific functions
l3candidates.sty 2014/01/06 v4643 L3 Experimental additions to l3kernel
xparse.sty 2013/12/31 v4634 L3 Experimental document command parser
luaotfload.sty 2014/02/05 v2.4-3 OpenType layout system
luatexbase.sty 2013/05/11 v0.6 Resource management for the LuaTeX macro progr
ammer
luatexbase-compat.sty 2011/05/24 v0.4 Compatibility tools for LuaTeX
luatexbase-modutils.sty 2013/05/11 v0.6 Module utilities for LuaTeX
luatexbase-loader.sty 2013/05/11 v0.6 Lua module loader for LuaTeX
luatexbase-regs.sty 2011/05/24 v0.4 Registers allocation for LuaTeX
luatexbase-attr.sty 2013/05/11 v0.6 Attributes allocation for LuaTeX
luatexbase-cctb.sty 2013/05/11 v0.6 Catcodetable allocation for LuaTeX
luatexbase-mcb.sty 2013/05/11 v0.6 Callback management for LuaTeX
fontspec-patches.sty 2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX
fixltx2e.sty 2006/09/13 v1.1m fixes to LaTeX
fontspec-luatex.sty 2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX
fontenc.sty
eu2enc.def 2010/05/27 v0.1h Experimental Unicode font encodings
eu2lmr.fd 2009/10/30 v1.6 Font defs for Latin Modern
xunicode.sty 2011/09/09 v0.981 provides access to latin accents and many othe
r characters in Unicode lower plane
eu2lmss.fd 2009/10/30 v1.6 Font defs for Latin Modern
graphicx.sty 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
graphics.sty 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
trig.sty 1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live
pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
fontspec.cfg
t3cmr.fd 2001/12/31 TIPA font definitions
supp-pdf.mkii
epstopdf-base.sty 2010/02/09 v2.5 Base part for package epstopdf
grfext.sty 2010/08/19 v1.1 Manage graphics extensions (HO)
kvdefinekeys.sty 2011/04/07 v1.3 Define keys (HO)
kvoptions.sty 2011/06/30 v3.11 Key value format for package options (HO)
kvsetkeys.sty 2012/04/25 v1.16 Key value parser (HO)
etexcmds.sty 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
***********
答案1
随着 MacTeX2014 的出现以及 MacTeX2015 的继续——并且很可能持续到无限的未来 :-( -- Lua(La)TeX 不再能够直接访问某些字体功能,例如连字、如果该字体是系统字体,其连字相关属性采用 AAT 编码,而非 OpenType 编码。Hoefler Text
、Didot
和Baskerville
就是三种这样的字体。(相比之下,XeLaTeX 仍然能够直接访问连字相关功能。)
通过设置一个或多个“功能文件”来说明应执行哪些连字替换,可以在使用高于 0.77 版本的 LuaLaTeX 时恢复连字。
下面显示的代码的输出具有以下特点:生成第一行前功能文件已加载;请注意,尽管在通过语句加载Ligatures=Common
字体(在本例中)时指定了选项 option,但它缺少连字符。第二行是生成的Hoefler Text
\setmainfont
后该特征文件通过指令加载\addfontfeature
,包含所有预期的连字符。
附言:(i) 该示例使用filecontents
自包含的包。实际上,只需创建功能文件“addligs.fea”一次并将其存储在 TeX 发行版搜索的目录中。(ii)此处显示的功能文件具有(双关语……)相当多的连字替换,因为具有大量连字。对于其他功能较少的字体,“标准五”连字——、、、和Hoefler Text
——ff
可能就是您需要采取的全部。fi
fl
ffi
ffl
% !TEX TS-program = lualatex
\RequirePackage{filecontents}
\begin{filecontents*}{addligs.fea}
languagesystem DFLT dflt;
languagesystem latn dflt;
# Ligatures
feature liga {
sub f f by f_f;
sub f i by f_i;
sub f j by f_j;
sub f k by f_k;
sub f l by f_l;
sub f f i by f_f_i;
sub f f l by f_f_l;
sub s t by s_t;
sub c t by c_t;
} liga;
\end{filecontents*}
\documentclass{article}
\usepackage{fontspec}
\setmainfont[Ligatures=Common]{Hoefler Text}
\newcommand\wordlist{off fit fjord Kafka fly office baffle stop act}
\begin{document}
\wordlist
\addfontfeature{FeatureFile=addligs.fea}
\wordlist
\end{document}
附录:这是一个稍微复杂一点的例子,它根据字体是直立还是斜体使用两个不同的功能文件。它利用了fontspec
为直立、粗体、斜体和粗斜体字体指定不同功能的能力。斜体和非斜体情况的单独处理是必要的,因为Hoefler Text
斜体字体有额外的连字符(尤其是“sp”和“Th”)。
% !TEX TS-program = lualatex
\RequirePackage{filecontents}
\begin{filecontents*}{AddligsHoeflerUpright.fea}
languagesystem DFLT dflt;
languagesystem latn dflt;
# Ligatures
feature liga {
sub f b by f_b;
sub f f by f_f;
sub f h by f_h;
sub f i by f_i;
sub f j by f_j;
sub f k by f_k;
sub f l by f_l;
sub f f b by f_f_b;
sub f f h by f_f_h;
sub f f i by f_f_i;
sub f f k by f_f_k;
sub f f l by f_f_l;
sub c t by c_t;
sub s t by s_t;
} liga;
\end{filecontents*}
\begin{filecontents*}{AddligsHoeflerItalic.fea}
languagesystem DFLT dflt;
languagesystem latn dflt;
# Ligatures
feature liga {
sub f b by f_b;
sub f f by f_f;
sub f h by f_h;
sub f i by f_i;
sub f j by f_j;
sub f k by f_k;
sub f l by f_l;
sub f f b by f_f_b;
sub f f h by f_f_h;
sub f f i by f_f_i;
sub f f k by f_f_k;
sub f f l by f_f_l;
sub c t by c_t;
sub s t by s_t;
sub s p by s_p;
sub T h by T_h;
sub a s by a_s;
} liga;
\end{filecontents*}
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Hoefler Text}[
Ligatures = {Common,Rare},
ItalicFont = Hoefler Text Italic,
BoldFont = Hoefler Text Black,
BoldItalicFont = Hoefler Text Black Italic]
\newcommand\words{fb ff fh fi fj fk fl ffb ffh ffk ffl ct st, sp Th}
\begin{document}
ligatures missing:
\words\par
\textbf{\words}\par
\textit{\words}\par
\textbf{\textit{\words}}
\addfontfeature{%
UprightFeatures = {FeatureFile=AddligsHoeflerUpright.fea},
BoldFeatures = {FeatureFile=AddligsHoeflerUpright.fea},
ItalicFeatures = {FeatureFile=AddligsHoeflerItalic.fea},
BoldItalicFeatures = {FeatureFile=AddligsHoeflerItalic.fea}}
\medskip
ligatures restored/activated:
\words\par
\textbf{\words}\par
\textit{\words}\par
\textbf{\textit{\words}}
\end{document}