I want real size of sf::Text
thanks for any inconvenience
SOLVED
f::Font font;
font.loadFromFile("./data/fonts/arial.ttf");
int linespacing = font.getLineSpacing(sfText->getCharacterSize());
int lengthstring=0;
int t;
ifstream file("./data/text/text1.txt");
texto.clear();
for(;file.eof()==false;){
string t1;
file >> t1;
texto = texto+t1+' ';
}
for(int i=0;i<texto.length();i++){
t=font.getGlyph(texto[i], 18, false ).advance;
lengthstring = lengthstring + t;
if(lengthstring>=500){
lengthstring = 0;
for(int j=i;j>0;j--){
if(texto[j]==' '){
texto.replace(j,1,"\n");
i=j;
break;
}
}
}
cout << i << "-" << (int)texto[i] << "-" << t << endl;
}
sfText->setString(texto);
cout << "tamaƱos: "<< lengthstring << endl;
isChange=true;