Appending a glyph to a FormattedString does not work well when fontVariations are set
-
I am having problems with a drawBot script to proof all glyphs in a variable font.
I am adding all glyphs from the list generated by listFontGlyphNames() to a FormattedString with appendGlyph, but it stops working whenever I set any value to fontVariations. (Exactly the same behavior reported here https://github.com/typemytype/drawbot/issues/402, so I discarded any problems with the font I'm using)
I was wondering if there are any workarounds to this problem or if this is still impossible at this time.
Here's the code I'm using:
pageSize = 'A4' fPath = '/Users/renan/Desktop/ABCDiatypePlusVariable.ttf' border = 20 class fontInstance: def __init__(self, name, axisValues): self.axisValues = axisValues self.name = name instanceList = listNamedInstances(fPath) instances = [] for i in instanceList: instanceName = i axisValues = instanceList[i] instance = fontInstance(instanceName, axisValues) instances.append(instance) txt = FormattedString() txt.font(fPath) txt.fontSize(20) glyphNameList = txt.listFontGlyphNames() for g in glyphNameList: for i in instances: txt.fontVariations(**i.axisValues) txt.appendGlyph(g) txt.append('\n') while txt: newPage(pageSize) txt = textBox(txt, (border, border, width() - border*2, height() - border*2))
-
added your example to the issue on github...
-
follow it up here: https://github.com/typemytype/drawbot/pull/433
-
-
Wow thanks a lot for such a fast fix!
That is a lifesaver function for glyph proofing