Maybe useful to share: a script to generate a simplified MetricsMachine pair list from an input font and pair list.
ArrowType last edited by
I sometimes make a big pair list, then run through it in one source of a type family, kerning everything that seems to need kerning. But then, I find it annoying to have to skip over every pair that doesn't really need kerning in my next sources. Especially when I'm kerning "optional" / not-typically-kerned items, like numerals to lowercase, I find myself wishing it could be a little faster.
Well, here's a script I've written to simplify a pair list once you've already gone through it:
It may have issues, and it's not super pretty. But, I wanted to share it, and I didn't want to spend any more time on it. :) Hope it helps someone!
Also included: a function to get a kerning value from an arbitrary pair of glyph names. I wish this were a function in FontParts or RoboFont already, but if it is, I couldn't find it!
def findKernValue(font, pair): """ I can't find a method to check for a kern pair in RoboFont, so here's an attempt at one. font is an Rfont object. pair is a tuple of glyph names. """ side1 = font.groups.findGlyph(pair) side2 = font.groups.findGlyph(pair) # check if side1 in a side1 group, otherwise, just use it directly try: side1 = [group for group in side1 if "kern1" in group] except IndexError: side1 = pair try: side2 = [group for group in side2 if "kern2" in group] except IndexError: side2 = pair try: pairKernValue = (font.kerning[(side1, side2)]) return pairKernValue except KeyError: return None
okaytype last edited by