Font not allocated error


#1

how do i use the loadfont() function. should i be directly be pasting the .ttf file in the data folder i m working in linux and in terminal

  
OF: OF_LOG_ERROR: ofTrueTypeFont::drawString - Error : font not allocated -- line 726 in ../../../openFrameworks/graphics/ofTrueTypeFont.cpp  

please help i m stuck


#2

please see examples/fontsExample and copy style to make sure you’re doing it right


#3

Thanks a lot done :slight_smile:


#4

hey great! if you could post exactly what you were doing wrong, that will help other people in the future who have the same problem :slight_smile:


#5

Hey swaroop.pal101088,

I’m running to the same issue. The fontsExample compiles and runs fine but my code produces this error. After stepping through the code in debug mode I found that the font is unloaded after each iteration, so I have to continuely call myfont.load(…).

The difference between my code and the example is that I’m declaring the ofTryeTypeFont object as a member of a class.

How did you solve this issue?

Cheers,