SFML community forums

Help => Graphics => Topic started by: BlueMagic on September 11, 2011, 07:53:27 pm

Title: Font smoothing in SFML 1.6
Post by: BlueMagic on September 11, 2011, 07:53:27 pm
Hey, I've been having troubles with fonts in SFML lately. I can't seem to properly disable the smoothing that SFML does by default.

There's nothing weird with my code. First I do this:

Code: [Select]

currentFont->LoadFromFile("test.ttf");
((sf::Image&)currentFont->GetImage()).SetSmooth(false);


and then I add some test text so I can try it out. No matter what the size of the font (and the text) is, most (and only one font worked correctly) of the fonts look ugly with smoothed edges. I want them to be pixelated since I'm going for that pixely-retro look.

Thanks a lot for reading.
Title: Re: Font smoothing in SFML 1.6
Post by: Haikarainen on September 11, 2011, 07:59:22 pm
Quote from: "BlueMagic"
Hey, I've been having troubles with fonts in SFML lately. I can't seem to properly disable the smoothing that SFML does by default.

There's nothing weird with my code. First I do this:

Code: [Select]

currentFont->LoadFromFile("test.ttf");
((sf::Image&)currentFont->GetImage()).SetSmooth(false);


and then I add some test text so I can try it out. No matter what the size of the font (and the text) is, most (and only one font worked correctly) of the fonts look ugly with smoothed edges. I want them to be pixelated since I'm going for that pixely-retro look.

Thanks a lot for reading.


You have to specify the size.

Code: [Select]
this->Text_Small.LoadFromFile("./data/smallfont.ttf");
((sf::Image&)this->Text_Small.GetImage(10)).SetSmooth(false);


That only disables smoothing on size 10. so you have to repeat the blabla.SetSmooth()blabla as many times as fontsizes youre using
Title: Font smoothing in SFML 1.6
Post by: BlueMagic on September 11, 2011, 08:13:17 pm
GetImage() doesn't take any arguments, not on 1.6 at least.