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

Author Topic: Font load issue...  (Read 2643 times)

0 Members and 1 Guest are viewing this topic.

Christopher Jozwiak

  • Newbie
  • *
  • Posts: 48
    • View Profile
    • Blog
    • Email
Font load issue...
« on: March 03, 2013, 07:44:59 pm »
I can't seem to get my program to load the font. 
CodE:
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <SFML/Network.hpp>
#include <SFML/System.hpp>
#include <iostream>
using namespace std;
int main()
{
        sf::RenderWindow window(sf::VideoMode(800, 600), "SFML works!", sf::Style::Close);     
        bool running = true;
        bool startmenu = true;
        bool ingame = false;
        bool gamemenu = false;

        //Declare Objects
        sf::Font font;
        if (!font.loadFromFile("ubuntu.ttf")){
                cout << "Could not load font..." << endl;
                system("PAUSE");
        }
        sf::Text text("Test", font, 50);
       
        text.setPosition(20,10);
        text.setScale(20,20);
        sf::RectangleShape rect;
        rect.setFillColor(sf::Color::Red);
        rect.setSize(sf::Vector2f(20,20));
        rect.setPosition(40,40);
       
        while (running){               

               


                sf::Event event;
                if (window.pollEvent(event)){

                        if (event.type == sf::Event::Closed)
                                running = false;
                       

                }
       
                window.clear();
                window.draw(text);
                window.draw(rect);
                window.display();
       
       
       
        }
    return 0;
}
 
It shows me failed to load font "tu.ttf" Failed to create font face.

My font is ubuntu.ttf.. Why is it outputting tu.ttf?
Noob C++ Programmer.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Font load issue...
« Reply #1 on: March 04, 2013, 08:59:40 am »
Make sure that you're not using release libraries in debug mode.
Laurent Gomila - SFML developer

Christopher Jozwiak

  • Newbie
  • *
  • Posts: 48
    • View Profile
    • Blog
    • Email
Re: Font load issue...
« Reply #2 on: March 05, 2013, 06:42:04 pm »
I'm in release mode and everything works except loading a font..
Noob C++ Programmer.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Font load issue...
« Reply #3 on: March 05, 2013, 08:13:01 pm »
Quote
I'm in release mode
So make sure that you're not using debug libraries ;D

What's your OS by the way? Can you load other resources such as textures or sounds?
Laurent Gomila - SFML developer

Christopher Jozwiak

  • Newbie
  • *
  • Posts: 48
    • View Profile
    • Blog
    • Email
Re: Font load issue...
« Reply #4 on: March 06, 2013, 03:06:26 am »
Ya.... About those debugging libraries.  Didn't build it in release config.  :-\ My bad.
Noob C++ Programmer.

 

anything