SFML community forums

Help => Graphics => Topic started by: Sade_129 on September 30, 2007, 01:19:08 am

Title: Ugly font output
Post by: Sade_129 on September 30, 2007, 01:19:08 am
Hi all. I have an strange problems with fonts. I use this code:

sf::String Text("Hello", "arial.ttf", 50.f);
Text.SetColor(sf::Color(128, 128, 0));

//.....

Window.Draw(Text);

And I get this ugly output:

(http://img503.imageshack.us/img503/3582/hellozw1.th.jpg) (http://img503.imageshack.us/my.php?image=hellozw1.jpg)

Is there a way to fix this?

Thanks in advance!!
Title: Ugly font output
Post by: Henrik.Flink on September 30, 2007, 02:48:24 am
I guess it's the default font, is it correct path to "arial.ttf"?
Title: Ugly font output
Post by: dabo on September 30, 2007, 12:15:50 pm
I'm having a similar problem, the text i draw on screen doesn't look good at all, I'm trying to use verdana.ttf (I know the path is correct).
Title: Ugly font output
Post by: Sade_129 on September 30, 2007, 02:04:16 pm
It doesn't matter the path. SFML has a default buit in font if the path is incorrect, isn't?. The output font of the pong example when you lose o win, also has the same problem.
Title: Ugly font output
Post by: Laurent on September 30, 2007, 03:13:15 pm
This problem can appear when you scale the font (directly or by resizing the window). I recently fixed it (I still need to apply it to the default font, however).
Title: Ugly font output
Post by: Sade_129 on September 30, 2007, 05:15:07 pm
Thanks for the reply Laurent. I made a few tests with others fonts and works fine. I test scaling, resizing the window, and no more ugly output :D. It seems that the problem is with the default font.  

However, I have another minor problem. If I set Font.SetTop to 0, it doesn't put the font on the top of the screen, instead it puts the font at approximately Y = 10. If I want the font at the top of the screen I have to put Font.SetTop(-10). It doesn't matter if I scale the font or not. Font.SetLeft works fine.
Title: Ugly font output
Post by: Laurent on October 01, 2007, 02:54:08 am
I need to check the top parameter. Before, it was matching the baseline, but it is supposed to have changed to match the top of the text.

I'll check this as soon as I get my computer working.
Title: Ugly font output
Post by: dabo on October 03, 2007, 12:59:33 pm
Most of the fonts that I have tried have not looked good (some characters are smooth and some are sharp), can anyone recommend a font that looks good?
Title: Ugly font output
Post by: Sade_129 on October 05, 2007, 03:16:11 am
Look the font that comes with the pong example: cheeseburger. It works nice for me.
Title: Ugly font output
Post by: dabo on October 08, 2007, 08:55:00 pm
Quote from: "Sade_129"
Look the font that comes with the pong example: cheeseburger. It works nice for me.


Yea it looks good using a big size, but if you use 12 or 14 for example none of the fonts I have tried have looked good.