SFML community forums
Help => General => Topic started by: abrartanim on September 20, 2020, 01:55:55 am
-
I am running SMFL on VSC and the SMFL vesion is 2.5.1. I have tested the 'SMFL works!' code and it works perfectly fine. I am stuck with this font problem. It is failing to load fonts
-
it seems the font is not in the same place as your cpp files. try changing "arial.ttf" for "Resources/arial.ttf"
-
Still doesn't help.
-
Make sure the font is valid.
-
I just copied the Arial.ttf that was built-in by Apple itself. It has to be ok
-
Make sure the font is valid.
And what do you mean by "valid" exactly?
-
I don't use VSCode so I don't know where the option would be, but what is your working directory for running from within VSCode?
When you run an executable directly (like clicking on it in explorer) the working directory is where the executable is. Your executable is at bin/debug/myproject.exe, so trying to load "arial.ttf" will look for bin/debug/arial.ttf.
Visual Studio defaults the working directory (when run from inside of VS) to the location of the .vcxproj file, which is really annoying since that won't be valid when you distribute the app to others. VSCode may be doing something similar.