How to import kerning classes(ufo) to Glyphs?

any source file hacks or scripts would be helpful.
Thank you.

Select the relevant master, then File > Import > Metrics. See 15.4.2 in the handbook.

thank you, i tried that and not working because in my case there is no kerning.plist file. kernings are in features.fea as some lookups. (ufo exported from fontforge)

You might have more luck importing a .otf exported from fontForge.

i couldn’t import metrics directly from otf via gui(import from otf format is disabled(i have the latest Glyphs app)), also tried mekkablue script for kerning(Steal Kerning Groups from Font) and not working for me.

Make sure the glyph names are in sync before you import. Just open the UFO and the glyphs file and run the script. Perhaps you need to select all the glyphs first.

not working.

even ufo itself(from both native fontforge export and sfd2ufo) or any format from fontforge, have no visual kerning in glyphs gui but kernings are in features tab(this one is sfd2ufo’s ufo export):

Kerning classes are not imported into the features. They are attached to the glyphs directly.
This “A” is part of group “A” for the left side.
Screen Shot 2022-12-23 at 21.29.32

yes,i know. screenshot is from primary ufo. i thought it might be helpful to clarify.

Could be done with a simple python script. Do you need help with that?

yes please, thank you.

You can step through the classes with:

for thisClass in Glyphs.font.classes:
    glyphNames = []
    for thisLine in thisClass.lines:
        if "#" in thisLine:
             thisLine = thisLine[thisLine.find("#"):]
        glyphNames += thisLine.split()
    for glyphName in glyphNames:
        glyph = Glyphs.font.glyphs[glyphName]
        if glyph:
            if "first" in
                glyph.rightKerningGroup =
                glyph.leftKerningGroup =

… should get you started. Please adapt to your needs. You can run it from Window > Macro Window or from the Script menu (if installed in the Scripts folder).

1 Like

thank you so much :))

i run the script from the marco panel(to record: there was a small problem in the end of line 3: thisClass.Lines should changed to thisClass.code)
kerning groups are in Glyphs now:

although i didn’t generate the font it’s logically true with the values on prefix. but it would be better to bring kernings on Glyphs natively to have tuning access via GUI. an idea could be to run a script with regex line comparator for classes name to find the values on prefix and import them to the native Glyphs kerning. unfortunately i can’t go for it right now but until then if you are or anyone interested or had a better idea ill be glad to know about.(or to clarify if there is some miss-understands from me). thanks.

Usually, when opening an .ufo, there is a kerning file. It contains the data as defined by the user. The kern feature is usually generated from user defined kerning and the processing is messing with the data (e.g. decomposing classes) So you always like to import the kerning file not the feature.

Can you send me a .ufo that I can have a look at it and maybe I’m able to improve the import.

problem solved! i was checking only the ufo from sfd2ufo output(beacuse it’s much better than the fontforge’s native one in many aspects), but apparently Glyphs could read kerning by classes from fontforge native ufo export already! sorry for making trouble before checking completely.

this is walkthrough for their who wants to follow(apparently working for kerning by classes only and kerning pairs not working, it needs more check):
1- open sfd in fontforge, generate font as ufo.
2- open ufo with Glyphs and export Metrics.
3- open Glyphs file and import Metrics.

yes, i know. it’s the fontforge way to export kernings (composed in features.fea).
problem have solved but i don’t know you still want me to send the file or not(there is no problem in sending), so if you want to check, please let me know. thank you.

If you found a way to solve the problem and I don’t need to spend time on it, I’m fine. :wink:

1 Like

Understood :sweat_smile::+1: