Strings into Names
RafaŁ Buchner last edited by gferreira
Hi, I'm working on extension that will perform some operations on strings.
My question is:
Is there any way to translate python string object into list of nice names, that later I could use for calling glyphs with those names (with
Thanks in advance for your help
if I understand it correctly, you wish to convert a unicode string into PostScript names?
if so, try this out:
from fontTools.agl import UV2AGL myText = "héllø" myText = myText.decode("utf-8") f = CurrentFont() for char in myText: uni = ord(char) glyphName = UV2AGL.get(uni) if glyphName and glyphName in f: print f[glyphName]
based on this example
let us know if it works!
RafaŁ Buchner last edited by RafaŁ Buchner