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

Author Topic: Default font removed in SFML 2  (Read 21471 times)

0 Members and 1 Guest are viewing this topic.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Default font removed in SFML 2
« on: August 04, 2012, 12:10:31 am »
Hi :)

I finally removed the default font and all its problems in SFML 2.

Its only use was for debugging and prototyping, any serious application loads a custom font anyway.

People that previously used it can just copy the arial.ttf file from their system font folder.
Laurent Gomila - SFML developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: Default font removed in SFML 2
« Reply #1 on: August 04, 2012, 12:47:53 am »
Quite a drastic change! This will probably break 80% of the 'applications' developed with SFML 2... ;D

Anyways I like the change (no crashes, problems, errors, etc., smaller library size and no copyright problem regarding Arial)! ;)

What does now happen if you try to run an application without loading a font?

Will you consider an implementation for system fonts?
« Last Edit: August 04, 2012, 12:50:21 am by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

argoneus

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Default font removed in SFML 2
« Reply #2 on: August 04, 2012, 03:21:30 am »
Hi,
I have no idea what this changes since I am just getting started, but as of now it's impossible to compile (out of the box) SFML because of the redundant line 7 in https://github.com/SFML/SFML/blob/master/src/SFML/Graphics/CMakeLists.txt
Just a heads up.

Bocaj

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Default font removed in SFML 2
« Reply #3 on: August 04, 2012, 03:36:49 am »
Hi,
I have no idea what this changes since I am just getting started, but as of now it's impossible to compile (out of the box) SFML because of the redundant line 7 in https://github.com/SFML/SFML/blob/master/src/SFML/Graphics/CMakeLists.txt
Just a heads up.
Just delete that line yourself until it is updated.

argoneus

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Default font removed in SFML 2
« Reply #4 on: August 04, 2012, 04:12:48 am »
Hi,
I have no idea what this changes since I am just getting started, but as of now it's impossible to compile (out of the box) SFML because of the redundant line 7 in https://github.com/SFML/SFML/blob/master/src/SFML/Graphics/CMakeLists.txt
Just a heads up.
Just delete that line yourself until it is updated.

What makes you think I didn't? I was just trying to point it out.

Bocaj

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Default font removed in SFML 2
« Reply #5 on: August 04, 2012, 05:38:24 am »
Quote
What makes you think I didn't? I was just trying to point it out.
I wrote what I wrote for those who are confused.
« Last Edit: August 04, 2012, 02:10:44 pm by Laurent »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Default font removed in SFML 2
« Reply #6 on: August 04, 2012, 11:24:40 am »
Quote
What does now happen if you try to run an application without loading a font?
I assume that you mean "what happens if you try to draw a sf::Text with no font" ;D
The same as a sprite with no texture: nothing shows.

Quote
Will you consider an implementation for system fonts?
Maybe in a far future :D

Quote
I have no idea what this changes since I am just getting started, but as of now it's impossible to compile (out of the box) SFML because of the redundant line 7 in https://github.com/SFML/SFML/blob/master/src/SFML/Graphics/CMakeLists.txt
Oh, thanks! That's what happens for working after midnight...
Laurent Gomila - SFML developer

argoneus

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Default font removed in SFML 2
« Reply #7 on: August 04, 2012, 01:30:29 pm »

Quote
What makes you think I didn't? I was just trying to point it out.

I wrote what I wrote for those who are confused.

Oh I misinterpreted you. My apologies.
« Last Edit: August 04, 2012, 02:10:57 pm by Laurent »

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Re: Default font removed in SFML 2
« Reply #8 on: August 05, 2012, 09:30:19 pm »
You added this in getFont(): “If the text has no font attached, a NULL pointer is returned”.
As far as I can tell, it's impossible to create a text with no font. When does this case apply?

Edit: maybe it would be nice to be able to specify the default font, so you don't have to pass your font every time you create some text.

Edit 2: I'm stupid, I didn't notice the no-parameters constructor.

Edit 3: if it's still possible to create a Text object with no font by calling the no-parameters constructors, why isn't it possible anymore to create one with a string but no font?
« Last Edit: August 05, 2012, 09:58:09 pm by bastien »
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Default font removed in SFML 2
« Reply #9 on: August 05, 2012, 10:14:35 pm »
Quote
if it's still possible to create a Text object with no font by calling the no-parameters constructors, why isn't it possible anymore to create one with a string but no font?
Why would such a constructor be needed?
Laurent Gomila - SFML developer

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Re: Default font removed in SFML 2
« Reply #10 on: August 05, 2012, 10:47:10 pm »
Quote
if it's still possible to create a Text object with no font by calling the no-parameters constructors, why isn't it possible anymore to create one with a string but no font?
Why would such a constructor be needed?

For consistency. And because it may make sense to delay the font assignment. For example, you create your text objects, add them to a list, then some function or class that manages the fonts assigns the fonts to the texts based on the configuration or the OS.
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: Default font removed in SFML 2
« Reply #11 on: August 05, 2012, 10:50:22 pm »
For consistency. And because it may make sense to delay the font assignment. For example, you create your text objects, add them to a list, then some function or class that manages the fonts assigns the fonts to the texts based on the configuration or the OS.
So basically you'd iterate through the texts twice which is bad design and shouldn't be used.
I think it's okay to force people to use a font at creation, because text can't exist without a font and if you just want to pass around strings, then use std::string (or sf::String). ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Default font removed in SFML 2
« Reply #12 on: August 05, 2012, 11:02:29 pm »
What's wrong with using the setString function? In fact the set of available constructors is not that important.
Laurent Gomila - SFML developer

mateandmetal

  • Full Member
  • ***
  • Posts: 171
  • The bird is the word
    • View Profile
    • my blog
Re: Default font removed in SFML 2
« Reply #13 on: August 06, 2012, 02:49:16 am »
I finally removed the default font and all its problems in SFML 2.

Great! ... No more local temp sf::Text objects in my draw methods! .. No more ATI bugs..  8) 8) 8)
- Mate (beverage) addict
- Heavy metal addict _lml
- SFML 2 addict
- My first (and free) game: BichingISH!

Foaly

  • Sr. Member
  • ****
  • Posts: 453
    • View Profile
Re: Default font removed in SFML 2
« Reply #14 on: August 06, 2012, 06:27:29 pm »
Awesome! That means no more font bugs on my old windows  :D