Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I've have the following example where i try to enable ligatures for the font Kaffeesatz

\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

The typesetting works, the font is used in the document but the ligatures are missing. Did i miss something important in the type-script or is

liga=yes

enough?

The specimen of the font shows exactly those five ligatures shown above in the code.

The used ConTeXt version is:

mtx-context     | current version: 2012.04.19 23:18
share|improve this question
2  
The font has a broken liga feature, I don’t think it works anywhere. –  Khaled Hosny May 15 '12 at 20:50
1  
I contacted the developer of the font and he confirmed the bug. Even on his system he doesn't get the ligatures. I don't know if/when he is willing to release a fixed version. –  Marco May 16 '12 at 16:49
add comment

1 Answer

up vote 5 down vote accepted

Here is the code to fix the missing ligatures and a more complete typescript:

\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

The \startbuffer code simply writes the content to a file. You can also take the content of the buffer and save it in an external file. The filename is passed to featurefile. This corrects the missing ligatures.

The rest is a normal typescript which takes into account that the Yanone-Kaffeesatz has three weights. I specified latin modern as fallback for math and monotype. You can/should change that and use the fonts you want to combine with Yanone-Kaffeesatz.

When you don't use the \s! shortcuts you can also remove the \protect and \unprotect. Here is how it looks like:

result

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.