Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Font is failing to load  (Read 1965 times)

0 Members and 1 Guest are viewing this topic.

MrSnappingTurtle

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Email
Font is failing to load
« on: December 23, 2014, 03:15:28 am »
Hey!

I have the following code:
if(!font_.loadFromFile("arial.ttf"));
        std::cout << "Failed to load font." << std::endl;

I have the following file structure:


The end result is one of pain and suffering(look at the console):


Does anyone know why this is happening? The font is in the same directory as the exe. Thanks!

cepro

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Font is failing to load
« Reply #1 on: December 23, 2014, 04:28:33 am »
You need to remove the semicolon after your "if" statement otherwise you will always get that error message! 
if(!font_.loadFromFile("arial.ttf"));// The problem is here! Remove the semicolon!
        std::cout << "Failed to load font." << std::endl;
 

MrSnappingTurtle

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Email
Re: Font is failing to load
« Reply #2 on: December 23, 2014, 04:58:21 am »
You need to remove the semicolon after your "if" statement otherwise you will always get that error message! 
if(!font_.loadFromFile("arial.ttf"));// The problem is here! Remove the semicolon!
        std::cout << "Failed to load font." << std::endl;
 

I...I don't even know how I managed to do that, lol. Thanks.

cepro

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Font is failing to load
« Reply #3 on: December 23, 2014, 10:42:15 pm »
You're welcome :)