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