1
\$\begingroup\$

This is my code.

    TextRenderer->setString(pCurrentUnit->getCHAR()->getNAME());
    TextRenderer->setCharacterSize(16);
    TextSanitizer::CenterOrigin(TextRenderer);
    TextRenderer->setPosition(108, 34);
    pWindow->draw(*TextRenderer);

    TextRenderer->setString(pCurrentUnit->getCLASS()->GetNAME());
    TextSanitizer::CenterOrigin(TextRenderer);
    TextRenderer->setPosition(242, 34);
    pWindow->draw(*TextRenderer);

Text blurriness

The font draws perfectly fine with certain texts and other times its really blurry. I've read on the SFML Forum it had something to do with non-rounded positions but mine are already int's.

Is there any way to fix this? It also doesn't matter if I draw the second text first, it's the string it displays that causes the blurriness.

EDIT: It's not the font, I've tested about 10 other fonts and all of them get screwed up in one way or another when below 20px.

\$\endgroup\$
0
\$\begingroup\$

There must be some transformation you're applying to rendered primitives.
It doesn't matter if you give integer coordinates to text line, if later some transformation will make those coordinates fractional.
To have sharp texts, you must get text line primitive's texels fit exactly into screen pixels, after all transformations was applied. That might even require fractional coords set to initial text, if those coords will be transformed to integer later.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.