Typophile

AFDKO and font variants in features files

Pierre Costals0 votes

Hello,

My questions would probably appear quite obvious to you, but I have failed to find any answer around Google or in the AFDKO specs (perhaps because I'm not using the good keywords?)

I'm using a spanish OTF font with (Lua)Latex which shows some minor problems for my language (french, namely) and, for example, comes with very tight-kerned apostrophe. I use a .fea file in Latex to add some space around it, and fix some exotic glyph combinations.

First, I have very few specific problems with the italic variant, and would like to create a my-kerning-it.fea which, first, loads my standard file (namely my-kerning-rm.fea) to apply it to the italics, and, 2nd, adds one or two more positionning lines specificaly made for italics, instead of having to copy and paste from one file to another each time I'm tuning the standard roman .fea file. Is it possible to do so?

Second problem, when I'm writing my file, I'm trying to cover any possible variants of a character, and uses long lists of glyphs, like:

pos L quoteright' 10 [A Aacute Abreve Acircumflex Adieresis Agrave Amacron Aogonek Aring Aringacute Atilde];

Is there any glyph class by default, eg. @A_&_variants like the @smallcaps one cited in the 2.g.ii. part of the AFDKO file syntax help from Adobe? (Note I'm using an old one, for compatibily reason in Latex.)

Thanks for attention,

PC

All names used for classes in the .fea file are lost when the .otf font is generated. I can see no way to access those classes from a .fea file to be used with LuaLaTeX.

If I understand well the other question, you would like a way to include a generic .fea file in other .fea files instead of copying its content for each. According to your reference, there is indeed an include command that should do exactly that but I don't know if LuaTeX implements it or not.

Hi Michel and thanks for your answer.

For the first question, I have found something that help me a little, an .fea class file from another Latex package, Eb Garamond, with a lot of class definitions.

The include command works fine, so the files are linked as I wished. The problem is now how to switch from one variant to another in Luatex without using each time an huge custom command like:
\setmainfont{Fontname}[FeatureFile={my-kerning-it.fea}]
instead ot the standard /textit{} one.

It seems like a problem that could be solved from the .fea file with an Ifdef command, as I see in that one:
ifdef ITALIC
include "italic.fea"
endif

But it's not working for me, and I can't find any documentation about that Ifdef italic command in the AFDKO reference file. I think I'm gonna let the italics standard kerning for now, until I find a way to use it the standard way in Luatex.

I am still not sure I understand what you want. If you simply want to use \textit to switch font and get the proper features, the fontspec package already allows you to do that. You can specify in \setmainfont not only the features for the italic but even the font you want to use as the italic when calling \textit{}. Here is an example where I asked for an c_t ligature in the regular and an s_t ligature in the italic:

\documentclass[12pt]{article}
\usepackage{fontspec}

\setmainfont[
UprightFeatures = {FeatureFile = garreg.fea},
ItalicFont = Garamond Premier Pro Italic,
ItalicFeatures = {FeatureFile = garit.fea}]{Garamond Premier Pro}

\begin{document}
Action station \textit{action station}
\end{document}

And the output is:

As you can see the c_t ligature is active only for the regular and the s_t ligature is active only for the italic, all that with standard LaTeX commands to switch fonts, provided you properly specified your choices in \setmainfont (there are also commands to modify your choices).

Hi and thanks again, Mr Boyer.

You completely understood my problem—and even solved it.

With gratitude,

Costals

Captured from web.archive.org on 1 Jul 2017. view this capture