Is there a trick to getting .otf fonts to work?


Working on a project using the “Bookmania” font. It is an .otf font and I am on Windows 10 using Processing 3. For whatever reason it works fine on Mac OSX…

When I run the code to printArray all of the fonts it is listed as “Bookmania-Regular”. However, when I run it the terminal says it is not found and will use another instead.

Is this to be expected?

I even included the file in the data folder.

Any work arounds here?

Thank you for any tips!


PFont myFont;

void setup() {
size(200, 200);
// Uncomment the following two lines to see the available fonts
//String[] fontList = PFont.list();
myFont = createFont(“Bookmania-Regular”, 32);
textAlign(CENTER, CENTER);
text("!@#$%", width/2, height/2);

Have you tried to load the font from the data sub-directory, using the full filename? Like this:

myFont = createFont("font_name.otf", 32);

Great hunch that totally worked you are my hero!

To be sure I had typed it as “Bookmania Regular.otf” and that worked.

When I do the printArray of all the fonts it comes up as “Bookmania-Regular” … note the hyphen. I had to be sure to drag it into the sketch AND specify the .otf.

Works great now I thank you very much!