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

Author Topic: Yet another Failed to load font problem.  (Read 1630 times)

0 Members and 1 Guest are viewing this topic.

lehthanis

  • Newbie
  • *
  • Posts: 6
    • View Profile
Yet another Failed to load font problem.
« on: July 28, 2017, 07:45:23 pm »
I'm having a hard time getting a font loaded.  I'm sure it's not a working directory problem because I've checked in my code that I'm manually applying the full path.  The error I get is:

S:\Documents\Visual Studio 2015\Projects\UDPJoySend\x64\Debug\arial.ttf
000007FEFA591120Failed to load font "

string workingdir()
{
        char buf[256];
        GetCurrentDirectoryA(256, buf);
        return string(buf) + '\\';
}

int main(int argc, char *argv[])
{
        RenderWindow window(VideoMode(800, 600), "UDP Joystick Sender");
        window.setFramerateLimit(10);
        string fontfile = workingdir() + "arial.ttf";
        cout << fontfile << "\n";
        if (!font.loadFromFile(fontfile))
        {
                cout << err;
                return 0;
        }

.......
        cout << "Exiting\n";
        return 0;
}

 

As you can see it's not telling me WHAT file name it's failing to load.  I've tried it with just the name of the font, and this working dir option.  The font exists in the path shown in the cout line before the error.  Thoughts?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Yet another Failed to load font problem.
« Reply #1 on: July 28, 2017, 08:10:30 pm »
Are you mixing debug and release mode?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

lehthanis

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Yet another Failed to load font problem.
« Reply #2 on: July 28, 2017, 09:12:03 pm »
yeah I think I am...I'm running in debug mode but using non-debug sfml...would that do it?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Yet another Failed to load font problem.
« Reply #3 on: July 28, 2017, 09:16:21 pm »
Yes, that will cause issues.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything