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

Author Topic: SFML 2.0 Missing text characters in Linux.  (Read 3521 times)

0 Members and 1 Guest are viewing this topic.

Zapfyr

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • Email
SFML 2.0 Missing text characters in Linux.
« on: October 02, 2012, 11:51:13 am »
Hi,

I have downloaded the latest SFML source and built it on both Linux and Windows. On Linux some characters; å, ä and ö (from the Swedish alphabet) are missing and a box is drawn instead of the character.

When drawing large texts boxes around the characters appear, I read some where that is a known bug, will that be solved soon?

// Zap

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.0 Missing text characters in Linux.
« Reply #1 on: October 02, 2012, 11:58:57 am »
Can you show your code and the output that you get?
Laurent Gomila - SFML developer

Qix

  • Full Member
  • ***
  • Posts: 139
  • I am Qix!
    • View Profile
    • Natoga Technologies
Re: SFML 2.0 Missing text characters in Linux.
« Reply #2 on: October 02, 2012, 02:40:21 pm »
It sounds as if your typeface is missing those characters. Have you tried with other fonts?
~ Qix
Creator of Rippl Studio
Code: [Select]
<danharibo> iostream: I don't do enough drugs to think that's a good idea.

Zapfyr

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • Email
Re: SFML 2.0 Missing text characters in Linux.
« Reply #3 on: October 02, 2012, 08:37:40 pm »
Here is the code:
#include <SFML/Graphics.hpp>

#include <string>

int main()
{
    // Create the main window
    sf::RenderWindow App(sf::VideoMode(800, 600), "SFML window");

    // Load a sprite to display
    sf::Font font;
    if (!font.loadFromFile("arial.ttf"))
        return EXIT_FAILURE;

    std::string alpha = "a      b       c       d       e\n";
    alpha += "f g       h       i       j\n";
    alpha += "k l       m   n   o\n";
    alpha += "p q       r       s       t\n";
    alpha += "u v       w       x       y\n";
    alpha += "z å      ä      ö\n";
    alpha += "A B   C   D   E\n";
    alpha += "F G   H   I   J\n";
    alpha += "K L   M   N   O\n";
    alpha += "P Q   R   S   T\n";
    alpha += "U V   W   X   Y\n";
    alpha += "Z Å   Ä   Ö";

    sf::Text text(alpha, font, 70);
    text.setPosition(10, 10);

        // Start the game loop
    while (App.isOpen())
    {
        // Clear screen
        App.clear();

        // Draw the sprite
        App.draw(text);

        // Update the window
        App.display();
    }

    return EXIT_SUCCESS;
}
 

The result:


I have tried multiple fonts (such as arial, the ubuntu font and some random fonts from the net), and all give me the same result on Linux. On Windows it seams to work fine with arial (the same ttf that I tried with on Linux), I experimented briefly on Windows so I did not have time to test the "box problem" that occur with lager texts.

Thanks for the fast response by the way. :)

// Zap

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.0 Missing text characters in Linux.
« Reply #4 on: October 02, 2012, 08:58:12 pm »
The garbage around characters is a known bug. For missing non-ASCII characters, use std::wstring (and wide string literals L"").
Laurent Gomila - SFML developer

Zapfyr

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • Email
Re: SFML 2.0 Missing text characters in Linux.
« Reply #5 on: October 02, 2012, 09:07:29 pm »
Thanks man, that worked beautifully. :)

I'm sorry to ask but what is the status on the "garbage around characters" bug?

// Zap

Grimlen

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • Email
Re: SFML 2.0 Missing text characters in Linux.
« Reply #6 on: October 02, 2012, 11:08:50 pm »
Thanks!