SFML community forums

Help => General => Topic started by: dabo on February 06, 2008, 10:01:56 pm

Title: Character/string width in pixels
Post by: dabo on February 06, 2008, 10:01:56 pm
Hi, is there a way to get the width of a character or a string in pixels? like if there were functions like this:

Code: [Select]
int i;
i = widthInPixels("a");
i = widthInPixels("SFML is great!");


I know you would need to take font size etc. into consideration too but still.
Title: Character/string width in pixels
Post by: Mindiell on February 07, 2008, 07:40:39 am
You can maybe simply use the GetRect function ?
Title: Character/string width in pixels
Post by: dabo on February 08, 2008, 05:43:18 pm
Quote from: "Mindiell"
You can maybe simply use the GetRect function ?
Ok, good idea.