我有以下示例,我尝试为字体启用连字咖啡情结
\definefontfeature[yanone-default][mode=node, kern=yes, liga=yes, dlig=yes]
\starttypescript [sans] [yanone]
\setups[font:fallback:sans]
\definefontsynonym [Sans] [Yanone-Regular] [features=default]
\stoptypescript
\starttypescript [sans] [yanone]
\definefontsynonym [Yanone-Regular][name:yanonekaffeesatzregular][features=yanone-default]
\stoptypescript
\starttypescript [yanone]
\definetypeface [yanone][ss][sans][yanone][default]
\stoptypescript
%--------------------------------------------------------------------------------
\usetypescript [sans] [yanone]
\setupbodyfont [yanone,36pt]
\starttext
fi fl ff ffi ffl
\stoptext
排版成功,文档中用到了字体,但缺少连字符。我是不是漏掉了打字稿中的重要内容,还是
liga=yes
足够的?
这标本字体恰好显示了代码中上面显示的五个连字符。
使用的 ConTeXt 版本是:
mtx-context | current version: 2012.04.19 23:18
答案1
以下是修复缺失连字符和更完整的打字稿的代码:
\startbuffer [yanone-feature]
lookup fligatures {
lookupflag 0;
sub \f \i by \fi;
sub \f \l by \fl;
sub \f \l by \fl;
sub \f \f \i by \ffi;
sub \f \f \l by \ffl;
} fligatures;
feature liga {
script DFLT;
language dflt;
lookup fligatures;
script latn;
language dflt;
lookup fligatures;
} liga;
\stopbuffer
\savebuffer [yanone-feature]
\unprotect
\starttypescriptcollection [yanone]
\starttypescript [\s!sans] [yanonesans] [\s!name]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans] [\s!name:yanonekaffeesatzregular] [\s!features=yanone]
\definefontsynonym [\s!SansBold] [\s!name:yanonekaffeesatzbold] [\s!features=yanone]
\stoptypescript
\starttypescript [\s!sans] [yanonesanslight] [\s!name]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans] [\s!name:yanonekaffeesatzlight] [\s!features=yanone]
\definefontsynonym [\s!SansBold] [\s!name:yanonekaffeesatzregular] [\s!features=yanone]
\stoptypescript
\starttypescript [\s!sans] [yanonesansthin] [\s!name]
\setups[\s!font:\s!fallback:\s!sans]
\definefontsynonym [\s!Sans] [\s!name:yanonekaffeesatzthin] [\s!features=yanone]
\definefontsynonym [\s!SansBold] [\s!name:yanonekaffeesatzlight] [\s!features=yanone]
\stoptypescript
\starttypescript [yanone]
\definetypeface [yanone] [\s!rm] [\s!serif] [modern] [yanone]
\definetypeface [yanone] [\s!ss] [\s!sans] [yanonesans] [yanone]
\definetypeface [yanone] [\s!tt] [\s!mono] [modern] [yanone]
\definetypeface [yanone] [\s!mm] [\s!math] [modern] [yanone]
\stoptypescript
\starttypescript [yanonelight]
\definetypeface [yanonelight] [\s!rm] [\s!serif] [modern] [yanone]
\definetypeface [yanonelight] [\s!ss] [\s!sans] [yanonesanslight] [yanone]
\definetypeface [yanonelight] [\s!tt] [\s!mono] [modern] [yanone]
\definetypeface [yanonelight] [\s!mm] [\s!math] [modern] [yanone]
\stoptypescript
\starttypescript [yanonethin]
\definetypeface [yanonethin] [\s!rm] [\s!serif] [modern] [yanone]
\definetypeface [yanonethin] [\s!ss] [\s!sans] [yanonesansthin] [yanone]
\definetypeface [yanonethin] [\s!tt] [\s!mono] [modern] [yanone]
\definetypeface [yanonethin] [\s!mm] [\s!math] [modern] [yanone]
\stoptypescript
\stoptypescriptcollection
\protect
\definefontfeature [yanone] [default] [featurefile=\jobname-yanone-feature.tmp]
\setupbodyfont [52pt]
\starttext
\switchtobodyfont [yanone, sans]
fi fl ff ffi ffl - -- ---
\switchtobodyfont [yanonelight, sans]
fi fl ff ffi ffl - -- ---
\switchtobodyfont [yanonethin, sans]
fi fl ff ffi ffl - -- ---
\stoptext
代码\startbuffer
只是将内容写入文件。您还可以获取缓冲区的内容并将其保存在外部文件中。文件名传递给featurefile
。这可以纠正缺失的连字符。
其余部分是正常的打字稿,考虑到 Yanone-Kaffeesatz 有三种粗细。我指定 latin modern 作为 math 和 monotype 的后备。您可以/应该更改它并使用您想要与 Yanone-Kaffeesatz 结合的字体。
当你不使用\s!
快捷键时,你也可以删除\protect
和\unprotect
。它看起来像这样: