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'm looking for having my document set with specific ligatures, such as 's' replaced by 'longs', 's t' by 'longs_t' etc. and using the Linux Libertine G font.

To do this, I'm writing my text normally with 's' and I'm using a font feature file together with the fontspec package and compiling with Lualatex.

This works properly. Here if the font feature file:

#font.fea
languagesystem DFLT dflt ;
languagesystem latn dflt ;

feature oplt {
    @notf = [a b c d e g j k m n o p q r u v w x y z];
    sub s' @notf by longs;
    sub longs longs' by s; # words don't end with longs
    sub f longs' by s;     # end with fs, not f_longs
} oplt;

feature oooo {
    sub s s by longs_s;
    sub s s by germandbls.alt;
    sub s t by longs_t;
    sub s h by longs_h;
    sub s i by longs_i;
    sub s l by longs_l;
    sub s s i by longs_longs_i;
} oooo;

here is a piece of code compiled with Lualatex:

\documentclass{article}
\usepackage{fontspec}
\setmainfont[FeatureFile=font.fea, RawFeature=+oplt,RawFeature=+oooo]{Linux Libertine G Regular}
\begin{document}
  ssi
  \textit{ssi}
\end{document}

The issue I have is, this will fail. Lualatex ends with

 !LuaTeX error (file C:/Windows/Fonts/linlibertineg_it.ttf): Invalid glyph index
  (gid 2335)

My understanding is that the font feature file is applied to the whole font shapes (italic, bold, etc.), but the thing is some of the glyphs I put in the feature file are present in the regular file and not in the italic/bold shapes.

That is the case for the longs_longs_i ligature, which is defined in the regular shape of Linux Libertine Graphite and not in the Italic shape. I didn't clearly find the way to use fontspec to set-up my feature file only for the regular shape and not for the other shapes.

Is there any workaround, apart from embedding the features in the font file ?

share|improve this question
    
Welcome to TeX.SX! –  Papiro Jun 13 '13 at 20:33
add comment

1 Answer

I don’t have Linux Libertine Graphite, but the approach I’ve used with Linux Libertine O will probably work:

\documentclass{article}
\usepackage{filecontents,fontspec}
\begin{filecontents*}{font.fea}
languagesystem DFLT dflt ;
languagesystem latn dflt ;

feature oplt {
    @notf = [a b c d e g j k m n o p q r u v w x y z];
    sub s' @notf by longs;
    sub longs longs' by s; # words don't end with longs
    sub f longs' by s;     # end with fs, not f_longs
} oplt;

feature oooo {
    sub s s by longs_s;
    sub s s by germandbls.alt;
    sub s t by longs_t;
    sub s h by longs_h;
    sub s i by longs_i;
    sub s l by longs_l;
} oooo;

feature zzzz {
    sub s s i by longs_longs_i;
} zzzz;
\end{filecontents*}
\setmainfont[FeatureFile=font.fea,RawFeature=+oplt,RawFeature=+oooo,UprightFeatures={RawFeature=+zzzz}]{Linux Libertine O}
\begin{document}
  ssi
  \textit{ssi}
\end{document}

See section 7.4 of the fontspec manual for explanations.

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.