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

Author Topic: (SOLVED) Can´t load Font files under Linux  (Read 7849 times)

0 Members and 1 Guest are viewing this topic.

mateandmetal

  • Full Member
  • ***
  • Posts: 171
  • The bird is the word
    • View Profile
    • my blog
(SOLVED) Can´t load Font files under Linux
« on: February 25, 2013, 10:07:22 pm »
Hi there!
I´m trying to get my game working under Fedora 18 x64
Im using C++ and SFML 2.0 from GitHub (very recent version)

I have created a folder where my font files are stored. Under win7, I load the files as usual:

if (!myFont.loadFromFile ("fonts//asd.ttf"))
// ...
 

And it works fine.
However, under Linux, this doesn´t work. The game compiles fine, but when I run it, I get this error message:

Failed to load font <filename>  (failed to create the font face)

The font files seems to work fine (I can open them from Dolphin, the KDE file explorer)

I tried changing the file path:
  • ./fonts//name.ttf
  • .//fonts//name.ttf
  • fonts//name.ttf

I can open (read and write) simple text files created by me using std::fstream. It works. Even files inside a folder (like "./config/engine.cfg")

Am I doing something wrong? Do I need to specify the full path to the files under Linux? SFML bug?
 :-\


EDIT:: Solved
« Last Edit: February 28, 2013, 12:39:41 am by mateandmetal »
- Mate (beverage) addict
- Heavy metal addict _lml
- SFML 2 addict
- My first (and free) game: BichingISH!

Gan

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
Re: Can´t load Font files under Linux
« Reply #1 on: February 25, 2013, 10:33:12 pm »
For mac you have to get the resource path and appent the font folder to the resource path.
You might have to do the same for Linux.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Can´t load Font files under Linux
« Reply #2 on: February 25, 2013, 10:49:16 pm »
I'm not quite sure, but why would you use double forward slashes? ???
I mean it makes sense to use double backward slashes, since one backward slash is reserved for excaping stuff (e.g. \t or \n), but for forward slashes, there isn't really a use, not on Windows and not on Linux, maybe you can try it without and see if that works?

Also make sure that it's really relative to the current working directory. Otherwise you might think about installing stuff into the shared directory.

You might have to do the same for Linux.
Not really...
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

vivo

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
    • Email
Re: Can´t load Font files under Linux
« Reply #3 on: February 26, 2013, 01:35:36 pm »
Hi, using linux and rbSFML i do:
@@font = Font.new(Fonts_path.to_s + 'ilits.ttf')
 
I had problems with the loadFromFile method too, try with the constructor as I did

CodingMadeEasy

  • Newbie
  • *
  • Posts: 38
    • MSN Messenger - petetheheat_represent@msn.com
    • AOL Instant Messenger - 622+Amaretto+Ave
    • Yahoo Instant Messenger - petetheheat_baller@yahoo.com
    • View Profile
    • http://www.youtube.com/CodingMadeEasy
Re: Can´t load Font files under Linux
« Reply #4 on: February 27, 2013, 09:43:47 am »
Why not try one forward slash instead of 2?

mateandmetal

  • Full Member
  • ***
  • Posts: 171
  • The bird is the word
    • View Profile
    • my blog
Re: Can´t load Font files under Linux
« Reply #5 on: February 28, 2013, 12:38:30 am »
Problem solved

The font file extension was .TTF (uppercase)  :-[
I didn't notice until I run ls from the console..  :-[

Btw, the classic path format "./fonts/myfont.ttf" works fine  8)
No absolute path needed

Thanks!  ;)
- Mate (beverage) addict
- Heavy metal addict _lml
- SFML 2 addict
- My first (and free) game: BichingISH!