How can I retreive what size a font supports?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

korkyAuthor Commented:
Edited text of question.
i am not understanding you.. but try something like this?

control.fontsize = 12

label1.Font = "Times New Roman"
label1.FontSize = 10
i meant control = text1, label1, etc.
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

korkyAuthor Commented:
What I mean is:
When I, for exemple in WordPad want to change the fontsize of a selected word, I am proposed a list of available size. System has only one size: 10 when Times New Roman has from 8 to 72...
What I am lookink for is a way to get that list.
try to give you a comment.

get any control from the toolbox on the form. click one time on that control so it brings the property window. click on the font. you will see the list of the fontsize.
korkyAuthor Commented:
You still don't get it I want to get the list to show it to my users so they can format their text in a rich edit control.
oh ok.. i am sorry for misunderstanding your problem. any comments/suggestions for korky.

all the best.
Most Fonts are True-Type fonts. Basically it means that they are scaleable. So any size is OK within the range up to 2160. A practical limit is 8 to 72 points like Word or Excel. You can use the TextWidth function to see what sizes will cause a change in the width of the text. There may be some differences based on the object (Picture1, Screen or Printer).

    Dim I As Integer
    For I = 0 To Screen.FontCount - 1
        Picture1.Font = Screen.Fonts(I)
        Debug.Print Picture1.Font, Picture1.FontSize
        z = Picture1.TextWidth("X")
        For x = 7 To 72
            Picture1.FontSize = x
            If Picture1.TextWidth("X") <> z Then
                Debug.Print Picture1.FontSize
                z = Picture1.TextWidth("X")
            End If
        Next x
    Next I
korkyAuthor Commented:
That's not really what I'm looking for... But thanks for your time.
I know the list exists but don't know how to make it work...
Tell me more about this list?
korkyAuthor Commented:
Take a look at wordpad:
- Write Something
- Select it
- Change the font to system
- And take a look at the font size combo...
The only proposed size is 10. On the other hand if you had chosen Times New Roman you would have found list from 8 to 72 font size combo.
That list is what I am looking for.
Hi! This(the program below) is not very practical...but you can modify it.
I display the list of font size in a text box(text1) with multiline=true. You can change
this into combo box or whatever you want.

Dim info(100) As Integer
lfcr = Chr(13) + Chr(10)

Text1.Font.size = 1
info(0) = Text1.Font.size
For i = 2 To 100 Step 1
    Text1.Font.size = i
    info(i) = Text1.Font.size
    If info(i) <> info(i - 1) Then
        size = size + Str(info(i)) + lfcr
    End If
Text1.Font.size = 1
Text1.Text = size

End Sub

There's a function to Enum Fonts.
korkyAuthor Commented:
This was very nice but not really what I was looking for...
For "system" I get:
While all I should get should be: 10

The System font (Bit Mapped) can be Scaled. Note the relation:
 20 X2
 29 ~X3
 39 ~X4
 49 ~X5
 58 ~X6
 68 ~X7
 78 ~X8

I've noticed that a font dialog for System font will show only one choice for 10 but will allow you to enter other values and attempt to scale to that size. It will change to the nearest size that it can scale.

So, for non true-type (FontType = TRUETYPE_FONTTYPE) only use the smallest size number. You may still want to allow the user to enter other values.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Fonts Typography

From novice to tech pro — start learning today.