SFML community forums
Help => Graphics => Topic started by: Sicarius43696 on January 21, 2010, 04:01:07 am
-
I recently switched to SFML 2.0 to see if there was a performance increase, however, I'm having trouble with my sf::Text classes. When I attempt to draw certain letters it instead just draws a space. If I print out the actual string, it prints correctly, however when I use SetString(string), the text that is drawn on the string is broken.
Is there something new with SFML 2.0 and text that I'm missing?
-
I narrowed this down to an issue with the SetString method.
If I set the text by constructor, it works fine. But if I use the SetString method, I get the broken text.
Edit:: This is due to the default font not supporting the character size of 16 I guess? What sizes does it support?
-
If I set the text by constructor, it works fine. But if I use the SetString method, I get the broken text.
Well, the constructor simply calls SetString.
Edit:: This is due to the default font not supporting the character size of 16 I guess? What sizes does it support?
Why do you think so? The default font (and all fonts) support any character size.
Could you extract a complete and minimal example that reproduces the problem?
-
I attempted to make a sample program that displayed this issue, but I found it only happened in the context of my program.
My original code was this -
sf::Text sfString;
sfString.SetCharacterSize(16);
sfString.SetPosition(inventory.sprite.GetPosition().x+55, inventory.sprite.GetPosition().y+9);
sfString.SetString("Bindle");
window->Draw(sfString);
And that resulted in broken text.
When I switched to this -
sf::Text sfString;
sfString.SetScale(0.533333333, 0.533333333);
sfString.SetPosition(inventory.sprite.GetPosition().x+55, inventory.sprite.GetPosition().y+9);
sfString.SetString("Bindle");
window->Draw(sfString);
It works just fine.
-
Weird.
Do you have any error message on the standard error output?
What about sizes other than 16? Is it the only one that produces this bug? Did you try with another font?
-
It works with size 14.
I can't test it now because I'm at work, but I did have several error messages, mostly involving opengl errors in sf::Image.
I can post them once I get home.