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

Author Topic: Can't get different font  (Read 4869 times)

0 Members and 1 Guest are viewing this topic.

NPS

  • Newbie
  • *
  • Posts: 31
    • View Profile
Can't get different font
« on: January 16, 2013, 09:39:44 pm »
I'm loading a font with Font::LoadFromFile() and it returns true but when i Draw it on the screen, the font is always the same (the default one, I guess). What's wrong?

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: Can't get different font
« Reply #1 on: January 16, 2013, 09:44:57 pm »
If you don't use sf::Text::setFont (or provide your font in sf::Text constructor), the text is drawn with the default font indeed.

Note that in recent versions (on github) of SFML , there isn't a default font anymore.
« Last Edit: January 16, 2013, 09:46:53 pm by G. »

masskiller

  • Sr. Member
  • ****
  • Posts: 284
  • Pointers to Functions rock!
    • MSN Messenger - kyogre_jb@hotmail.com
    • View Profile
    • Email
Re: Can't get different font
« Reply #2 on: January 16, 2013, 09:46:40 pm »
Read this: http://en.sfml-dev.org/forums/index.php?topic=5559.0

There is almost no information in there, so we can't help you unless you show us some code.

Correct me if I am wrong on this.

It's my guess that you are using SFML 1.6 due to the capital letter in the function. SFML 1.6 hasn't been touched in two years and it won't be worked with any further, while SFML 2.0 has bug fixes and overall nice features in the Graphics module. The switch is the best option.
« Last Edit: January 16, 2013, 09:48:37 pm by masskiller »
Programmer, Artist, Composer and Storyline/Script Writer of "Origin of Magic". If all goes well this could turn into a commercial project!

Finally back into the programming world!

NPS

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Can't get different font
« Reply #3 on: January 16, 2013, 10:01:29 pm »
Eh... my inadvertence. You're right, G., I didn't actually set the font to sf::String.

As for the version - I notices a couple of topics tagged with "[2.0]" so I asumed every other topic was concerning 1.6.

One more question about fonts - is there a way to load system fonts (without having to copy font files into the application directory)? Is the only way of doing that providing the full path (e.g. "C:/Windows/Fonts")?

And a little offtopic - the SFML page states that 1.6 is the "current" version. Somewhere I read that 2.0 is a little bugged or something, anyway - it's not fully stable/done. Are you saying it's not true (and everyone should use 2.0)? If so, imo the web page should state that explicitly.

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: Can't get different font
« Reply #4 on: January 16, 2013, 10:16:05 pm »
Yeah, I didn't notice it was 1.6. ^^

Using 2.0 is perfectly fine, it's actually the recommended version and yes you should use it.
There are a few threads about this. The website will be updated when 2.0 is officially released.
« Last Edit: January 16, 2013, 10:17:47 pm by G. »

NPS

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Can't get different font
« Reply #5 on: January 17, 2013, 01:45:12 pm »
I've changed the version of SFML to 2.0 and I regret that already. The tutorials section is only like stated and misses most of the functionality so I have to read through whole documentation and compare both versions to discover by myself what changed (class names/functions/whole functionalities). In what universe is it "recommended" to use undocumented version of a library?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10896
    • View Profile
    • development blog
    • Email
Re: Can't get different font
« Reply #6 on: January 17, 2013, 01:58:18 pm »
It's not undocumented as you've already said yourself... ;)
The documentation is fully complete, the tutorials aren't yet. But most of the parts are every similar and if you understand the SFML 1.6 tutorials you should also understand how to use SFML 2, while keeping an eye on the documentation.
Tutorials are anyway only interesting in the beginning, once you understand the concept you'll always deal with the documentation directly.

You can also take a look at the also incomplete FAQ, which is maintained by the community.

Thus just because some tutorials are lacking for a newer and better version, doesn't mean that the old version is still recommended. It's 3 years old and has some serious bugs. On top of that most of the community members can't help much with directly related SFML 1.6 problems, since they haven't touched it in years... ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

NPS

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Can't get different font
« Reply #7 on: January 17, 2013, 02:12:49 pm »
Still - reading tutorials to the previous version and then looking (by oneself) for all the differences between the versions is not the way to go.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10896
    • View Profile
    • development blog
    • Email
Re: Can't get different font
« Reply #8 on: January 17, 2013, 02:30:42 pm »
Nobody forces you to do anything, if you feel better with SFML 1.6 go for it, but don't get angry when people point you towards SFML 2 (which happens nearly every time someone posts some SFML 1.6 code). ;)

The tutorials are in the work - you should remember that SFML is written by one guy in his freetime, side by side to his real life, which involves family + work and everything is done for free and even with a zlib license on it. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

NPS

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Can't get different font
« Reply #9 on: January 17, 2013, 02:40:48 pm »
I do realize the latter and I'm not complaining whatsoever. I just wanted to point out that the recommended version of a library should not only have full API documentation but also its usage fully described (tutorials/samples). Which I did.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10896
    • View Profile
    • development blog
    • Email
Re: Can't get different font
« Reply #10 on: January 17, 2013, 03:03:38 pm »
I just wanted to point out that the recommended version of a library should not only have full API documentation but also its usage fully described (tutorials/samples).
Seeing that the documentation is complete and that all the examples exist and that 2/3 of the tutorials are already written, I just can't value an outdated, buggy and feature-lacking version more than a few missing tutorials next to a shiny new library, which has a nicer overall code design, runs more stable and brings an evolving community mostly surrounded around this version. ;)

Good luck then on your SFML 1.6 journey and have fun rewriting/relearning everything anyways once SFML 2 gets officially released. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

NPS

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Can't get different font
« Reply #11 on: January 17, 2013, 04:37:40 pm »
Gee, why are you such a hater?

And I think you're exaggerating with all that, I can't say I have much experience with SFML 1.6 but I've never had any problem with that library.

Btw where exactly do all these examples exist?

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: Can't get different font
« Reply #12 on: January 17, 2013, 04:40:43 pm »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10896
    • View Profile
    • development blog
    • Email
Re: Can't get different font
« Reply #13 on: January 17, 2013, 04:47:17 pm »
Gee, why are you such a hater?
Why am I a hater? I don't hate you. I don't hate SFML 1.6. I also don't hate you for using SFML 1.6. Not sure what you're getting at here. :)

And I think you're exaggerating with all that
If I may ask: How? Or what seems to be exaggerated?
As an example: If you don't link SFML 1.6 statically into your application, around 50% of the users won't be able to run your application due to the ATI bug. I wouldn't call that stable at all... ;)

I can't say I have much experience with SFML 1.6 but I've never had any problem with that library.
Well many here, who say SFML 2 is better, have been around when SFML 1.6 was the only version to go at, thus they have more experience and can often tell better where the up and down sides are. I've only slightly touched SFML 1.6, then ran into the ATI bug on my system and moved on to an early version of SFML 2, so yes maybe my judgement isn't the best, so don't listen to me. ;D
« Last Edit: January 17, 2013, 04:49:44 pm by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

NPS

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Can't get different font
« Reply #14 on: January 17, 2013, 05:08:27 pm »
Oh, you're a hater all right. This sentence alone proves it: "Good luck then on your SFML 1.6 journey and have fun rewriting/relearning everything anyways once SFML 2 gets officially released."

Hmm... ok, I guess I'm done with the offtopic. :P

 

anything