0 Members and 3 Guests are viewing this topic.
A bit of a blind guess, but since I was browsing the sf::Text code recently and it might save someone some time: Could this be because sf::Font calls setSmooth(true) on the texture it uses to render glyphs? (https://github.com/SFML/SFML/blob/master/src/SFML/Graphics/Font.cpp#L716) I assume that's correct in most cases but maybe it should be configurable?
Well, const_casting like that is probably undefined behavior so no surprises. Even if it did work that'd just be a hack around SFML not providing proper access to that option.https://github.com/SFML/SFML/issues/254 appears to have a lot of relevant discussion about the actual issue here.
My game is enlarged 3 times, so one pixel becomes 9.
QuoteMy game is enlarged 3 times, so one pixel becomes 9.That's what causes the problem. Font rendering is exact, and thus not blurry, as long as nothing is stretched. But if one texel = several pixels, texture filtering applies and you get the antialiased result.The const_cast is an ugly hack, but you can use it to check if disabling texture smoothing would indeed give you the expected result. This would allow us to progress on this issue: if the result is ok then we can discuss the addition of this feature to the public API, and if it's not then it means there's a problem somewhere else that may be fixed / improved.
Is the final position of the text rounded, or decimal?
Can you provide a complete and minimal example that reproduces the problem?
Thanks.To get the pixelated look, I had to disable texture smoothing and render glyphs in mono mode (2-color bitmaps). So this is indeed a case not covered by the latest modifications in sf::Font.This brings back the idea of providing a "mode" when loading a font: antialiased or pixelated. This could also apply to fonts that are not natively pixelated.