SFML community forums

Help => General => Topic started by: abrartanim on September 20, 2020, 01:55:55 am

Title: Failed to load font "arial.ttf" (failed to create the font face)
Post 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
Title: Re: Failed to load font "arial.ttf" (failed to create the font face)
Post by: Stauricus on September 20, 2020, 01:26:35 pm
it seems the font is not in the same place as your cpp files. try changing "arial.ttf" for "Resources/arial.ttf"
Title: Re: Failed to load font "arial.ttf" (failed to create the font face)
Post by: na.mkv on January 03, 2024, 11:45:19 pm
Still doesn't help.

Title: Re: Failed to load font "arial.ttf" (failed to create the font face)
Post by: eXpl0it3r on January 03, 2024, 11:55:16 pm
Make sure the font is valid.
Title: Re: Failed to load font "arial.ttf" (failed to create the font face)
Post by: na.mkv on January 04, 2024, 02:19:46 am
I just copied the Arial.ttf that was built-in by Apple itself. It has to be ok
Title: Re: Failed to load font "arial.ttf" (failed to create the font face)
Post by: na.mkv on January 04, 2024, 02:21:26 am
Make sure the font is valid.

And what do you mean by "valid" exactly?
Title: Re: Failed to load font "arial.ttf" (failed to create the font face)
Post by: kojack on January 04, 2024, 04:54:53 am
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.