Fonts can't be seen on canvas

Hi there,

while trying the Hello World example from Josh Noble’s Programming Interactivity, I noticed that the fonts can’t be seen, just the white background. The code compiles perfectly and I followed every single step form the book, checked every line and compared them. Yet the “Hello world” caption does not appear. Any ideas why?

testApp.h

#ifndef _TEST_APP
#define _TEST_APP

#include “ofMain.h”

class testApp : public ofBaseApp{

public:
void setup();
void draw();

ofTrueTypeFont franklin;
};

#endif

testApp.cpp

#include “testApp.h”

void testApp::setup(){
franklin.loadFont(“frabk.ttf”,32);
ofBackground(255,255,255);
}
void testApp::draw(){
ofSetColor(0,0,0);
franklin.drawString(“HELLOWORLD”, 100,380);
}

main.cpp

#include “ofMain.h”
#include “testApp.h”
#include “ofAppGlutWindow.h”

int main( ){

ofAppGlutWindow window;
ofSetupOpenGL(&window, 1024,768, OF_WINDOW); // <-------- setup the GL context

// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
// pass in width and height too:
ofRunApp( new testApp());

}

Thanks for your help in advance!

do you have franklin.ttf in the bin/data directory?

Not sure. How can I check them?

Found them! No, there’s nothing there.

According to the book there must be a ttf file there. How should I proceed? Thanks for your help!

copy it from the fontsExample

Thanks! Working! Just for future reference, how should I load fonts to that folder? What if I want to use different other fonts than frankilin and verdana?

If you want to load an asset (image/video/font/etc) to your program it has to be on the data folder (/bin/data/) so if you want to use more fonts, just put them on this folder.

When you do

  
  
 franklin.loadFont("frabk.ttf",32)  
  

It looks for the asset on the data folder

But where are the other fonts? You’re saying I have to put the ttf file manually to the bin/data folder. What if I want to use other fonts the franklin? Where are the other ttfs stored?

They are stored on the Internet or you can check your c:/Windows/Fonts or in /Library/Fonts on Mac

Hey I had the same problem as you!..but in my case none of the fonts examplew work, I’ve checked the bin/data files and the fonts are there, all the programs seems to be running fine, but the strings just do not appear in the canvas. ??? ??? ??? ???