Font error once python sketch is exported (Mac)

As the title implies, this problem did not occur before the sketch was exported.

The specific error is:

java.lang.RuntimeException: Could not load font typewrite.vlw. Make sure that the font has been copied to the data folder of your sketch.

The setup code is:

def setup():
size(700,755)
global MAP
MAP = systemFileMapper()
f = loadFont(“typewrite.vlw”)
textFont(f)

After testing, it seems as if it has nothing to do with the specific font file, and looking into the created application, the data file does contain the “typewrite.vlw”.

Other exported python sketches have been able to run with no problem before (although they didn’t have any fonts in them), so it is something to do directly with Processing’s font system once exported.

Thanks.

1 Like

Have you tried to place a TTF/OTF font file in the data sub-directory? Then load it like this:

f = createFont('<font_name.ttf>', 20)

* I’m afraid I haven’t tested this (no Mac access right now)

2 Likes

Thank you!
After seeing you use the createFont() method, I decided to do the same, however I kept the “typewrite.vlw” file, and that seems to be the solution :smiley:
So in the end, it seems that perhaps the loadFont() method isn’t quite supported once exported.

1 Like