Use an External File for Contextual Kerning

I’m implementing some contextual kerning in each instance of a typeface family right now, I’m working from some .fea files which I then copy paste into the custom parameter in each instance. I wonder if its possible to link to an external file for this parameter? Since it’s easier to edit that in another place than Glyphs app right now.

You can use the import(filename.fea); statement. And place the file next to your .glyphs file.

1 Like

Oh wow that’s what I need!
So I put that in the ‘Replace Feature’ custom parameter for each instance then?

And put a # Automatic Code End in the first line of your .fea file. That way, your code and the context code can coexist.

Am I doing something wrong here, it’s not working – to be clear I want to import a different .fea file for every instance… when I tried to add kern; to the first line of the Replace Feature custom parameter, it throws up an error because the feature code block is empty… :


You put the import statement in the code in Font Info. Otherwise it never gets triggered. And your feature is empty.

The kern; line must be the first line of the Replace Feature Parameter value, otherwise it does not know which feature to replace. It cannot be part of the feature code itself.

I had a look at his files.
Importing a external file that contains a lookup directly in the kern feature doesn’t work. In the end I put the import into a prefix (and replaced that one per instance) and called the lookup from the kern feature.

Just to document it for others who want to use a different external .fea file for each instance’s contextual kerning:

In the Features tab, create the kern feature, inside :

# Automatic Code End
lookup contextualKerning;

In the instance, create a custom parameter Replace Prefix :

# Automatic Code End

Where light.fea is a .fea file in the same folder as the .glyphs file.

Then the format of the light.fea is as follows:

lookup contextualKerning {
pos A' -500 B' -500 C;
} contextualKerning;

Hello everyone! Just was wondering if that option is possible on Glyphs 3? I have the same Instance Kerning process on a project. It works fine this way on Glyphs 2. But now I cannot keep it while transfering my work in glyphs 3. Or Maybe there is better option in Glyphs 3 to add particular kern for instances? Thanks!

What exactly are you trying to do?

Hi Georg, thanks for replying! I need to modify some kerning values in my instances.
I have 2 masters (condensed, extended), and because of the design I have different kind of kerning comportments between both (Typical case is a lowercase which can go under the /T in one master and not in the other one…) So kerning values are not as I would like on the several instances because of linear interpolation.

On Glyphs2 I fixed it with the methodology of this topic.
I created several external .fea files for each instances and adjust the kerning for a list of concerned glyphs according to the design of each instance. (So I have external .fea files + empty kern feature + empty Private prefix and in the instances menu I use “Replace Prefix” to include the external files + “Replace feature” to modify the kern feature and call the “specialKern” lookup I have in my external files)

I am trying to switch my workflow to Glyphs3. But this method doesn’t work anymore.
I also tried to define my special lookups straight In the “Replace Prefix” custom parameter but it doesn’t work either.

Would you have any suggestion to achieve this objective of adding special kerning values for instances?


If the file is not too big, you could put it directly into an “Add Feature” parameter in each instance.

1 Like

So the idea is to add an “Add Feature” custom parameter instead of replacing an existing empty feature?
I tried to do so but no rules is taken into account. I tried to reduce my file with only one gpos rule to make sure it is not a size matter but it doesn’t seems to be that. The specific rule is never present in the .fea file in the temp folder! I tried several options (inside a lookup, simple block) but it never goes to the temp… Is there something in the features that should be done too?

It seems to work for me. Can you check the .fea in the Temp folder if your rules made it into the file?

I tried several ways to add kern rules via “Add feature” or “Replace Feature” custom parameter, but the feature never made it into the .fea in temp folder, there is only the kerning set normally with the UI…
I can remove kern rules set in kern feature, with “Remove feature” but adding any rule doesn’t seems to work on my hand.
Is there something more to do while using the Add feature custom parameter?
Thanks if u have suggestion!

Where did you add the parameter?
And what version of Glyphs do you have?
And what did you add exactly?

I add the custom parameters “Add Feature” in Font Info > Export Tab and I chose the instances where I want to affect kerning values.
As you suggested, maybe my rules from external file were a bit heavy, so I tried with a test single one to make sure:

pos A V -155;

But it doesn’t make it to the temp folder either. Is there something wrong with the syntax? I also tried to write my rule inside a lookup but the add feature doesn’t seems to have any effect.
I work under the last version 3.0.3

I fixed it for the next slightly bigger update as it required bigger changes.

Thank you very much! It is really helpful :pray:


I was wondering if Leo’s point is already implemented in 3.1.

I can’t bring neither Add Feature nor Replace Feature custom parameters to work for the kern feature in 3133. If I add custom code in the kern feature (Font Info > Features > kern), it is exported properly as a lookup at the end of the kern feature. But I can’t replace or delete that additional code in the instances.

The Remove Feature custom parameter works fine with the kern feature but it removes the whole feature. So is there a possibility to just delete/replace my custom part of the kern feature, but not the automatically generated kern feature code?

Thank you very much.