SFML community forums

Help => Graphics => Topic started by: Sicarius43696 on January 21, 2010, 04:01:07 am

Title: SFML 2.0 - Missing letters when drawing sf::Text
Post 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?
Title: SFML 2.0 - Missing letters when drawing sf::Text
Post by: Sicarius43696 on January 21, 2010, 04:18:16 am
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?
Title: SFML 2.0 - Missing letters when drawing sf::Text
Post by: Laurent on January 21, 2010, 07:18:54 am
Quote
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.

Quote
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?
Title: SFML 2.0 - Missing letters when drawing sf::Text
Post by: Sicarius43696 on January 21, 2010, 02:33:47 pm
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 -
Code: [Select]

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 -
Code: [Select]

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.
Title: SFML 2.0 - Missing letters when drawing sf::Text
Post by: Laurent on January 21, 2010, 03:08:07 pm
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?
Title: SFML 2.0 - Missing letters when drawing sf::Text
Post by: Sicarius43696 on January 21, 2010, 08:58:30 pm
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.