SFML community forums

Help => Graphics => Topic started by: Paki Programmer on May 03, 2012, 12:06:43 am

Title: 2.0 RC sf::Text bug
Post by: Paki Programmer on May 03, 2012, 12:06:43 am
When using sf::Text, there seems to be a bug where the letters of the string seem to be surrounded by a light blue outline. I took a screen print to show you what i mean. Any clues why this is happening or how to fix it? Or is it really just a bug in the API?



[attachment deleted by admin]
Title: Re: 2.0 RC sf::Text bug
Post by: Lo-X on May 03, 2012, 01:38:40 am
It's a known bug, there is a topic from yesterday about that :
http://en.sfml-dev.org/forums/index.php?topic=7787.0

Dunno if it's in the tracker but it assume it is

Note that it doesn't always appears (I have no idea about what is causing this)
Title: Re: 2.0 RC sf::Text bug
Post by: Laurent on May 03, 2012, 07:57:53 am
Yes, it's a known bug but there's no issue in the tracker.

Could you please post a complete and minimal code that reproduces the problem?
Title: Re: 2.0 RC sf::Text bug
Post by: Paki Programmer on May 04, 2012, 01:02:53 am
Here is the code:


Code: [Select]

void Game::g_About()
{
sf::Text a_Title;
a_Title.setCharacterSize(75);
a_Title.setString("ABOUT");
a_Title.setPosition((SCREEN_W/4), 50);

sf::Text info;
info.setCharacterSize(M_TEXT_SIZE);
info.setString("This product was made and developed \nby Devil Theory Entertainment");
info.setPosition((SCREEN_W/5), (SCREEN_H/3));

sf::Text copyright;
copyright.setCharacterSize(25);
copyright.setString("Copyright 2012...All rights reserved.");
copyright.setPosition((SCREEN_W/5), 500);

sf::Text esc;
esc.setCharacterSize(20);
esc.setString("ESC - Go back to main menu");
esc.setPosition(0, (SCREEN_H - (esc.getCharacterSize() + 10)));

if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
{
this -> game_state = mainmenu;
}

this -> window -> clear();
this -> window -> draw(a_Title);
this -> window -> draw(info);
this -> window -> draw(copyright);
this -> window -> draw(esc);
this -> window -> display();
}

Title: Re: 2.0 RC sf::Text bug
Post by: Laurent on May 04, 2012, 07:53:35 am
Thanks, but if I say complete and minimal it's not just for fun ;)
Title: Re: 2.0 RC sf::Text bug
Post by: Paki Programmer on May 04, 2012, 12:29:58 pm
I thought that's all you would need that's why lol ill post the entire code when I get home
Title: Re: 2.0 RC sf::Text bug
Post by: Laurent on May 04, 2012, 01:24:22 pm
You should read this first:
http://en.sfml-dev.org/forums/index.php?topic=5559.msg36368#msg36368
Title: Re: 2.0 RC sf::Text bug
Post by: Paki Programmer on May 05, 2012, 12:33:16 am
Ok, so i managed to recreate the bug within a simple little program. The problem seems to be when you set the size of the text past a certain number the blue lines begin to show up. Here's the code:



#include <SFML/Graphics.hpp>

int main()
{
        sf::RenderWindow *window = new sf::RenderWindow(sf::VideoMode(800, 600), "Text Bug");

        sf::Text text;
        text.setCharacterSize(75);
        text.setString("This is a test string");
        text.setPosition(100, 300);

        while (window -> isOpen())
        {
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
                {
                        window -> close();
                }

                window -> clear();
                window -> draw(text);
                window -> display();
        }

        return 0;
}

 

Ran this on Windows 7 64bit, SFML 2.0 RC, and Visual Studio 2010.

Another note that I discovered while attempting to recreate the bug; if you don't make sf::RenderWindow() a pointer like I did in the above code, then the program will crash when you close the window. This is also caused by sf::Text for some reason. 

[attachment deleted by admin]
Title: Re: 2.0 RC sf::Text bug
Post by: Laurent on May 05, 2012, 09:52:27 am
Thanks a lot :)

Quote
if you don't make sf::RenderWindow() a pointer like I did in the above code, then the program will crash when you close the window
It's a known bug (see the issue tracker).
And you didn't solve it by making the window a pointer, you just avoided it by not destroying the window (so you turned the bug into a memory leak instead).
Title: Re: 2.0 RC sf::Text bug
Post by: Laurent on May 05, 2012, 10:31:12 am
Unfortunately I can't reproduce the bug with this code :(

What's your graphics card?
Title: Re: 2.0 RC sf::Text bug
Post by: Paki Programmer on May 06, 2012, 04:20:19 pm
ATI Radeon HD 3200 Graphics