Cannot load fonts in TTF-format

edited November 2013 in Questions about Code

Hallo, Processing community

I have several fonts in TTF-format, but can't load any of them

I alway get the following error message from the IDE:

'Could not load font .ttf. Make sure that the font has been cope to the data folder of the sketch.

  • the following OutOfBoundsException:
java.lang.ArrayIndexOutOfBoundsException: -1207959509
    at processing.core.PFont.(PFont.java:368)
    at processing.core.PApplet.loadFont(PApplet.java:6376)
    at loading_fonts.setup(loading_fonts.java:23)
    . . .
    . . .

The files, however, are correctly located in the data-folder.

I hope anyone can help me.

Greets, wosap

Tagged:

Answers

  • edited November 2013

    What OS? What version of Processing? What fonts?

    Do you have the problem with any font or only with some?

    I just tried with Processing 2.1, on Windows 7, with a font found on Internet (Magician) and another shipped with Windows (Engraver), and I had no problem.

  • Problem is solved: I had to install the font, then create a VLW-font with 'tools/Create Font ...'

    Nevertheless, i would like to know why it didn't work out at first glance. According to the documentation it should be possible to directly load TTF-fonts located in the data-folder

    And why isn't it possible now to load the font with 'loadFont("filename")' after I created the font with 'tools/create font..', although it appears in the list of fonts generated with PFont.list();

    I am using Processing 2.1 under MacOS X 10.8.5

  • I was also tricked by this but if you read more into the Processing documentation you would see that it is made with a java library called OpenGL. OpenGL can do many things except do anything with loading or displaying fonts. So processing decided that this can't be fair to its users so they added the own bit-map format called vlw. Essentially, its a bunch of pictures of all the symbols in the font. That's why you can't select the text, its really just an image.

    As for why it didn't appear at first this is just because you need to restart processing. It happens sometimes(especially with files it generates)

  • As I wrote, createFont() with a .ttf font in the data folder, not installed on the system, works for me. So it is definitively possible to do that.

Sign In or Register to comment.