?
Solved

FONT

Posted on 2000-01-18
15
Medium Priority
?
321 Views
Last Modified: 2013-12-02
How can I retreive what size a font supports?
0
Comment
Question by:korky
  • 6
  • 4
  • 4
  • +1
15 Comments
 

Author Comment

by:korky
ID: 2362968
Edited text of question.
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2363253
i am not understanding you.. but try something like this?

control.fontsize = 12

label1.Font = "Times New Roman"
label1.FontSize = 10
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2363259
i meant control = text1, label1, etc.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 

Author Comment

by:korky
ID: 2363427
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.
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2363479
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.
0
 

Author Comment

by:korky
ID: 2363566
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.
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2363620
oh ok.. i am sorry for misunderstanding your problem. any comments/suggestions for korky.

all the best.
0
 
LVL 3

Expert Comment

by:Lewy
ID: 2364468
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
0
 

Author Comment

by:korky
ID: 2367464
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...
0
 
LVL 3

Expert Comment

by:Lewy
ID: 2367478
Tell me more about this list?
0
 

Author Comment

by:korky
ID: 2369921
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.
0
 

Expert Comment

by:yschoong
ID: 2477021
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
Next
Text1.Font.size = 1
Text1.Text = size

End Sub
0
 
LVL 3

Expert Comment

by:Lewy
ID: 2479973
See http://www.vietnam411.com/Computer_Tips/vbasic/0019.html

There's a function to Enum Fonts.
0
 

Author Comment

by:korky
ID: 2481202
This was very nice but not really what I was looking for...
For "system" I get:
 10
 20
 29
 39
 49
 58
 68
 78
While all I should get should be: 10


0
 
LVL 3

Accepted Solution

by:
Lewy earned 140 total points
ID: 2482374
The System font (Bit Mapped) can be Scaled. Note the relation:
 10
 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.

0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question