kernFeatureWriter

class ufo2fdk.kernFeatureWriter.KernFeatureWriter(font, groupNamePrefix='')

This object will create a kerning feature in FDK syntax using the kerning in the given font. The only external method is ufo2fdk.tools.kernFeatureWriter.write().

This object does what it can to create the best possible kerning feature, but because it doesn’t know anything about how the raw kerning data was created, it has to make some educated guesses about a few things. This happens with regards to finding kerning groups that are not referenced by any kerning pairs. This is only an issue when attempting to decompose certain types of exception pairs. The default implementation of this object finds unreferenced groups in the getUnreferencedGroups. These groups will be studied when attempting to decompose these special exceptions. This is as accurate as it can be, but it is not foolproof. Passing a groupNamePrefix that defines a prefix that all referenced kerning groups will start with. If this is known, it will help remove the ambiguities described above.

write(headerText=None)

Write the feature text. If headerText is provided it will inserted after the feature kern { line.

getReferencedGroups()

Get two dictionaries representing groups referenced on the left and right of pairs. You should not call this method directly.

getUnreferencedGroups()

Get a dictionary representing kerning groups that are not referenced in any kerning pairs. You should not call this method directly.

getPairs()

Get a dictionary containing all kerning pairs. This should filter out pairs containing empty groups and groups/glyphs that are not in the font. You should not call this method directly.

getFlatGroups()

Get three dictionaries keyed by glyph names with group names as values for left, right and unreferenced groups. You should not call this method directly.

isHigherLevelPairPossible((left, right))

Determine if there is a higher level pair possible. This doesn’t indicate that the pair exists, it simply indicates that something higher than (left, right) can exist. You should not call this method directly.

getSeparatedPairs(pairs)

Organize pair into the following groups:

  • glyph, glyph
  • glyph, group (decomposed)
  • group, glyph (decomposed)
  • glyph, group
  • group, glyph
  • group, group

You should not call this method directly.

getClassDefinitionsForGroups(groups)

Write class definitions to a list of strings. You should not call this method directly.

getFeatureRulesForPairs(pairs)

Write pair rules to a list of strings. You should not call this method directly.