How to determine average character width for a font?

  • Thread starter Jonathan Eric Miller
  • 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
 
H

Herfried K. Wagner [MVP]

* "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.
 
G

Guest

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
 
T

Thomas W. Brown

-----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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top