Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML 2.0 - Missing letters when drawing sf::Text  (Read 5225 times)

0 Members and 1 Guest are viewing this topic.

Sicarius43696

  • Newbie
  • *
  • Posts: 16
    • View Profile
SFML 2.0 - Missing letters when drawing sf::Text
« 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?

Sicarius43696

  • Newbie
  • *
  • Posts: 16
    • View Profile
SFML 2.0 - Missing letters when drawing sf::Text
« Reply #1 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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SFML 2.0 - Missing letters when drawing sf::Text
« Reply #2 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?
Laurent Gomila - SFML developer

Sicarius43696

  • Newbie
  • *
  • Posts: 16
    • View Profile
SFML 2.0 - Missing letters when drawing sf::Text
« Reply #3 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SFML 2.0 - Missing letters when drawing sf::Text
« Reply #4 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?
Laurent Gomila - SFML developer

Sicarius43696

  • Newbie
  • *
  • Posts: 16
    • View Profile
SFML 2.0 - Missing letters when drawing sf::Text
« Reply #5 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.