Trying to load a font...

Hello Community! I have been trying to create a font all morning, looked through various sites and everything, but it still wont work. I downloaded a font I called "gamefont(.ttf)", but now when I put in my code:

createFont(gamefont, 20);

I get the error: "Cannot find anything named "gamefont".".
For test purposed I let processing create a new font, using its own tool, but the programm wont even load that font. Of course the fonts are in the sketch's data folder.

Can anyone tell me what I am doing wrong?

Thanks for a short answer in advance!

Answers

  • Answer ✓

    see the createfont example

    // Uncomment the following two lines to see the available fonts 
    //String[] fontList = PFont.list();
    //println(fontList);
    

    so uncomment those lines, see if your font is appearing in the list. if it's not in there then your font is not correctly installed. (installation details depend on operating system, which you haven't specified)

    myFont = createFont("Georgia", 32);
    

    note the quotes around the name...

  • edited June 2015

    Thanks for your reply. My font is not showing up in the list. My operating system is Windows Professional (ungenuine). So far my file sitting in: C\Users\XX\Desktop\Game\Data

  • Answer ✓

    (actually, i think you can load a font from the data directory, or from anywhere else by supplying the full path. can't test it though - not a windows user)

  • Thanks for your fast help, I got it installed and loaded now!

Sign In or Register to comment.