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

Author Topic: Failed to load font "arial.ttf" (failed to create the font face)  (Read 4791 times)

0 Members and 1 Guest are viewing this topic.

abrartanim

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Failed to load font "arial.ttf" (failed to create the font face)
« 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

Stauricus

  • Sr. Member
  • ****
  • Posts: 369
    • View Profile
    • A Mafia Graphic Novel
    • Email
Re: Failed to load font "arial.ttf" (failed to create the font face)
« Reply #1 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"
Visit my game site (and hopefully help funding it? )
Website | IndieDB

na.mkv

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Failed to load font "arial.ttf" (failed to create the font face)
« Reply #2 on: January 03, 2024, 11:45:19 pm »
Still doesn't help.


eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10846
    • View Profile
    • development blog
    • Email
Re: Failed to load font "arial.ttf" (failed to create the font face)
« Reply #3 on: January 03, 2024, 11:55:16 pm »
Make sure the font is valid.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

na.mkv

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Failed to load font "arial.ttf" (failed to create the font face)
« Reply #4 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

na.mkv

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Failed to load font "arial.ttf" (failed to create the font face)
« Reply #5 on: January 04, 2024, 02:21:26 am »
Make sure the font is valid.

And what do you mean by "valid" exactly?

kojack

  • Sr. Member
  • ****
  • Posts: 327
  • C++/C# game dev teacher.
    • View Profile
Re: Failed to load font "arial.ttf" (failed to create the font face)
« Reply #6 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.