Hi SFML team,
I'm trying to setup a simple example where text will not have any aliasing applied. I notice in 2.6.x we add the ability to setSmooth(false) on a given sf::Font
Unfortunately, this is making little to no difference to me, Will provide a minimal example below and a desired outcome. I have also tried some of the usual, earier tricks ive seen suggested online. Let me know if font file would help.
(https://i.imgur.com/edLO1lC.png)
Top is desired (notice no aliasing), bottom is what the code produces. Note I have zoomed in here
Can use below code to reproduce in SFML 2.6.0 , I am using a windows 10 operating system
#include <SFML/Graphics.hpp>
int main() {
sf::RenderWindow myWindow{sf::VideoMode{800, 600}, "Demo", sf::Style::Close};
myWindow.setFramerateLimit(60);
static constexpr uint32_t TEXT_SIZE = 14;
const sf::Font myTimesNewRomanFont = [](){
sf::Font myFont;
myFont.setSmooth(false);
myFont.loadFromFile("playground/fonts/times.ttf");
const_cast<sf::Texture&>(myFont.getTexture(TEXT_SIZE)).setSmooth(false);
return myFont;
}();
sf::Text myText{"English", myTimesNewRomanFont, TEXT_SIZE};
while (myWindow.isOpen()) {
myWindow.clear(sf::Color::White);
myText.setFillColor(sf::Color::Black);
myText.setPosition(sf::Vector2f{(int)200.f, (int)200.f});
myWindow.draw(myText);
myWindow.display();
sf::Event myEvent;
while (myWindow.pollEvent(myEvent)) {
switch (myEvent.type) {
case sf::Event::Closed:
myWindow.close();
break;
default:
break;
}
}
}
return 0;
}