How to determine average character width for a font?

  • Thread starter Thread starter Jonathan Eric Miller
  • Start date Start date
J

Jonathan Eric Miller

Does anyone know how to determine what the average width of a character is
for a font?

The reason I want to know is that I want to use it to size my text boxes.
For example, if I know that a text box will always accept 8 characters, I
want to size the text box so that it is roughly the size that will display 8
characters.

Jon
 
* "Jonathan Eric Miller said:
Does anyone know how to determine what the average width of a character is
for a font?

The reason I want to know is that I want to use it to size my text boxes.
For example, if I know that a text box will always accept 8 characters, I
want to size the text box so that it is roughly the size that will display 8
characters.

You can use 'Graphics.MeasureString' to get the width of a character,
nevertheless IMO that doesn't make sense.
 
Hello Jon,

First of all does your font vary in your application. Usally "Tohama" with Font size 8 is the
standard followed.

As far as determing the size of text box goes- the standard is to use "W" equal to number
of characters you want the text box to carry.

Chandrakumar Mudugere

----- Jonathan Eric Miller wrote: -----

Does anyone know how to determine what the average width of a character is
for a font?

The reason I want to know is that I want to use it to size my text boxes.
For example, if I know that a text box will always accept 8 characters, I
want to size the text box so that it is roughly the size that will display 8
characters.

Jon
 
-----Original Message-----
Does anyone know how to determine what the average width of a character is
for a font?

The reason I want to know is that I want to use it to size my text boxes.
For example, if I know that a text box will always accept 8 characters, I
want to size the text box so that it is roughly the size that will display 8
characters.

Jon


.

Check out the Font.Size property which purports to return
the em-size for the font. In my experience this is almost
always much larger than the tmAveCharWidth type value that
you are looking for, but it can be used.

-- TB
 
Back
Top