Can we calculate the width of a space

Joined
May 31, 2007
Messages
7
Programming Experience
1-3
Hi,
I am calculating the width using TextRenderer.MeasureText() which take font as parameter, but for the space (" "), it doesn't have any font size. Can anyone suggest the procedure to calculate the width of space(" ").

TIA

Regards
Abhinandan
 
A space is just a character like any other, and it will be rendered differently by each font just like any other character. You measure its width in exactly the same way as any other character.
 
You're trying to complicate something that is very simple. Like I said, a space is simply a character like any other character. The amount of space it occupies will vary between different fonts and different font sizes, exactly as any other character would. If you want to measure the amount of space occupied by a character then of course you have to specify the font and the size because the result will differ depending on those. Nothing changes because the character is a space.
 
Back
Top