SFML community forums

General => General discussions => Topic started by: Laurent on August 04, 2012, 12:10:31 am

Title: Default font removed in SFML 2
Post by: Laurent 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.
Title: Re: Default font removed in SFML 2
Post by: eXpl0it3r 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?
Title: Re: Default font removed in SFML 2
Post by: argoneus 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.
Title: Re: Default font removed in SFML 2
Post by: Bocaj 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.
Title: Re: Default font removed in SFML 2
Post by: argoneus 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.
Title: Re: Default font removed in SFML 2
Post by: Bocaj 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.
Title: Re: Default font removed in SFML 2
Post by: Laurent 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...
Title: Re: Default font removed in SFML 2
Post by: argoneus 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.
Title: Re: Default font removed in SFML 2
Post by: bastien 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?
Title: Re: Default font removed in SFML 2
Post by: Laurent 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?
Title: Re: Default font removed in SFML 2
Post by: bastien 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.
Title: Re: Default font removed in SFML 2
Post by: eXpl0it3r 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). ;)
Title: Re: Default font removed in SFML 2
Post by: Laurent 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.
Title: Re: Default font removed in SFML 2
Post by: mateandmetal 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)
Title: Re: Default font removed in SFML 2
Post by: Foaly on August 06, 2012, 06:27:29 pm
Awesome! That means no more font bugs on my old windows  :D
Title: Re: Default font removed in SFML 2
Post by: Wizzard on December 19, 2012, 11:33:49 pm
Please update the documentation to reflect this. It confused me for a few minutes.
Title: Re: Default font removed in SFML 2
Post by: eXpl0it3r on December 19, 2012, 11:38:28 pm
Please update the documentation to reflect this. It confused me for a few minutes.
Unfortunately the documentation is frozen to the SFML 2 RC release, not sure if Laurent wants to update it or create a second section for SFML 2 (current)...
Title: Re: Default font removed in SFML 2
Post by: Laurent on December 20, 2012, 07:54:30 am
The online documentation matches the latest online release. If you compile SFML yourself, then compile the documentation too.