SFML - How to get an expected string width?


How to get the expected sf::String's width when drawn on the window? Currently I only know how to get the sf::String's heigh, with the GetSize() method.

OBS: I'm using SFML v1.6 on Linux.

According to the doc, sf::String has a GetRect member function which returns a sf::Rect< float >, with a GetWidth() member.

float width = str.GetRect().GetWidth();