SFML community forums
Help => Graphics => Topic started 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!!
-
I guess it's the default font, is it correct path to "arial.ttf"?
-
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).
-
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.
-
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).
-
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.
-
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.
-
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?
-
Look the font that comes with the pong example: cheeseburger. It works nice for me.
-
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.