Features update
-
Hi,
I’m trying to build a script for my features.
I open (or make) thefeatures.fea
file and write stuff into the file.
The problem is: it’s not updated in the features UI.
f.update()
doesn’t to the trick.Who can help?
Thanks!
my sketch:
f = CurrentFont() g = CurrentGlyph() path = f._get_path() + "/features.fea" fea = open(path, "w") liga = "feature liga { \n" for g in f: if g.name == 'fi': liga+= " sub f i by fi;\n" if g.name == 'ffi': liga+= " sub f f i by ffi;\n" if g.name == 'fl': liga+= " sub f l by fl;\n" liga += "} liga;\n\n" fea.write(liga) fea.close()
-
Yes, this is easier and does exactly what I want!
Thanks Frederik!
-
mm, why would you rewrite the source file?
RoboFont will see this change only when you jumped to an other application and back to RoboFont.But I strongly encourage you not to do it like this :)
f = CurrentFont() ## get the fea text feaText = f.features.text for i in range(100): feaText += "# halleluja\n" f.features.text = feaText
ps: also strongly advised: never ever use private callback, private callbacks are callbacks starting with an
_
(underscore) those allows developers to change underlaying API stuff with bothering the top level API.so:
f = CurrentFont() print f.path
thanks