<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Fontparts, Kerning groups and performance.]]></title><description><![CDATA[<p dir="auto">Hi, everyone!<br />
Since this is not strictly related with RF but Fontparts, I don’t know If here is the correct place to post this. I hope to not be spamming.</p>
<p dir="auto">I made a quick script to change kerning groups and it works on most of the cases, but it hungs up if the font is really big.</p>
<p dir="auto">I really don’t know if I’m doing it correctly. So any help is really appreciated.</p>
<p dir="auto">here a sample code:</p>
<pre><code class="language-python">from fontParts.world import *

fontPath = 'myFont.ufo'
font = OpenFont(fontPath, showInterface=False)
glyphs = font.keys()


def removeGlyphFromKerningGroups(glyph):
    currentGroups = font.groups.findGlyph(glyph.name)
    for groupName in currentGroups:
        group = font.groups[groupName]
        groupList = list(font.groups[groupName])
        groupList.remove(glyph.name)
        font.groups[groupName] = tuple(groupList)

def getKerningGroups(glyphName, side):
    if side == 1:
        groups = font.groups.side1KerningGroups
    else:
        groups = font.groups.side2KerningGroups
    glyphGroups = []
    for key in groups:
        for value in groups[key]:
            if glyphName == value:
                glyphGroups.append(key)
    return glyphGroups


for thisGlyphName in glyphs:
    thisGlyph = font[thisGlyphName]
    if thisGlyphName.endswith(".sc"):
        basename = thisGlyphName.split(".")[0]
        removeGlyphFromKerningGroups(thisGlyph)

        side1Groups = getKerningGroups(basename, 1)
        for side1Group in side1Groups:
            kern1Group = font.groups[side1Group]
            kern1GroupList = list(kern1Group)
            kern1GroupList.append(thisGlyph.name) 
            font.groups[side1Group] = tuple(kern1GroupList)
        
        side2Groups = getKerningGroups(basename, 2)
        for side2Group in side2Groups:
            kern2Group = font.groups[side2Group]
            kern2GroupList = list(kern2Group)
            kern2GroupList.append(thisGlyph.name) 
            font.groups[side2Group] = tuple(kern2GroupList)   
        
          
        currentGroups = font.groups.findGlyph(thisGlyph.name)
        print (thisGlyph.name, currentGroups)
</code></pre>
<p dir="auto">Thanks in advance.</p>
]]></description><link>https://forum.robofont.com/topic/866/fontparts-kerning-groups-and-performance</link><generator>RSS for Node</generator><lastBuildDate>Sat, 09 May 2026 14:33:28 GMT</lastBuildDate><atom:link href="https://forum.robofont.com/topic/866.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 18 May 2020 17:42:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Fontparts, Kerning groups and performance. on Mon, 18 May 2020 19:26:19 GMT]]></title><description><![CDATA[<p dir="auto">Hi, everyone!<br />
Since this is not strictly related with RF but Fontparts, I don’t know If here is the correct place to post this. I hope to not be spamming.</p>
<p dir="auto">I made a quick script to change kerning groups and it works on most of the cases, but it hungs up if the font is really big.</p>
<p dir="auto">I really don’t know if I’m doing it correctly. So any help is really appreciated.</p>
<p dir="auto">here a sample code:</p>
<pre><code class="language-python">from fontParts.world import *

fontPath = 'myFont.ufo'
font = OpenFont(fontPath, showInterface=False)
glyphs = font.keys()


def removeGlyphFromKerningGroups(glyph):
    currentGroups = font.groups.findGlyph(glyph.name)
    for groupName in currentGroups:
        group = font.groups[groupName]
        groupList = list(font.groups[groupName])
        groupList.remove(glyph.name)
        font.groups[groupName] = tuple(groupList)

def getKerningGroups(glyphName, side):
    if side == 1:
        groups = font.groups.side1KerningGroups
    else:
        groups = font.groups.side2KerningGroups
    glyphGroups = []
    for key in groups:
        for value in groups[key]:
            if glyphName == value:
                glyphGroups.append(key)
    return glyphGroups


for thisGlyphName in glyphs:
    thisGlyph = font[thisGlyphName]
    if thisGlyphName.endswith(".sc"):
        basename = thisGlyphName.split(".")[0]
        removeGlyphFromKerningGroups(thisGlyph)

        side1Groups = getKerningGroups(basename, 1)
        for side1Group in side1Groups:
            kern1Group = font.groups[side1Group]
            kern1GroupList = list(kern1Group)
            kern1GroupList.append(thisGlyph.name) 
            font.groups[side1Group] = tuple(kern1GroupList)
        
        side2Groups = getKerningGroups(basename, 2)
        for side2Group in side2Groups:
            kern2Group = font.groups[side2Group]
            kern2GroupList = list(kern2Group)
            kern2GroupList.append(thisGlyph.name) 
            font.groups[side2Group] = tuple(kern2GroupList)   
        
          
        currentGroups = font.groups.findGlyph(thisGlyph.name)
        print (thisGlyph.name, currentGroups)
</code></pre>
<p dir="auto">Thanks in advance.</p>
]]></description><link>https://forum.robofont.com/post/3322</link><guid isPermaLink="true">https://forum.robofont.com/post/3322</guid><dc:creator><![CDATA[guidoferreyra]]></dc:creator><pubDate>Mon, 18 May 2020 19:26:19 GMT</pubDate></item><item><title><![CDATA[Reply to Fontparts, Kerning groups and performance. on Tue, 19 May 2020 10:31:40 GMT]]></title><description><![CDATA[<p dir="auto">explain 'hung' is there a traceback? do you end up in an endless loop</p>
<p dir="auto">can you provide an dummy ufo where this happens?</p>
]]></description><link>https://forum.robofont.com/post/3325</link><guid isPermaLink="true">https://forum.robofont.com/post/3325</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Tue, 19 May 2020 10:31:40 GMT</pubDate></item><item><title><![CDATA[Reply to Fontparts, Kerning groups and performance. on Tue, 19 May 2020 10:51:56 GMT]]></title><description><![CDATA[<p dir="auto">a tip about performance: if you are making a lot of edits, it’s faster to work on pure Python objects and then save the result back into the font when you’re done.</p>
<p dir="auto">you can get a font’s groups as a dict with <code>font.groups.asDict()</code></p>
<p dir="auto">hope that helps!</p>
]]></description><link>https://forum.robofont.com/post/3326</link><guid isPermaLink="true">https://forum.robofont.com/post/3326</guid><dc:creator><![CDATA[gferreira]]></dc:creator><pubDate>Tue, 19 May 2020 10:51:56 GMT</pubDate></item><item><title><![CDATA[Reply to Fontparts, Kerning groups and performance. on Wed, 20 May 2020 15:37:09 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/1">@frederik</a> It just never ends, no tracebacks. If I don’t manage to solve it with <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/22">@gferreira</a>  tip I will try to prepare a dummy ufo and post it here. Thank you both!</p>
]]></description><link>https://forum.robofont.com/post/3340</link><guid isPermaLink="true">https://forum.robofont.com/post/3340</guid><dc:creator><![CDATA[guidoferreyra]]></dc:creator><pubDate>Wed, 20 May 2020 15:37:09 GMT</pubDate></item></channel></rss>