- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsIs there any way i can difeerentiate whether the given font is a TrueType Font or not. If Yes then How?
Thank You
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: daffyduck14milPosted on 2003-02-18 at 07:08:06ID: 7974580
Hi,
---------- -
tedFont.hd c, tMetrics) And TMPF_TRUETYPE) <> 0 Then
And TMPF_VECTOR) <> 0 Then
And TMPF_DEVICE) <> 0 Then
And TMPF_FIXED_PITCH) <> 0 Then
Font.hdc, lSize, sBuffer)
Yes, you can inspect if a given font is a true type font. Use the textmetrics and inspect the tmPitchAndFamily mask of the textmetric structure. In the sample code below, you use a picturebox (picSelectedFont) that has the font you require the info from. Next, the cmdGetInfo button retrieves the name and type of the font.
Option Explicit
Private Const TMPF_DEVICE = &H8
Private Const TMPF_FIXED_PITCH = &H1
Private Const TMPF_TRUETYPE = &H4
Private Const TMPF_VECTOR = &H2
Private Type TEXTMETRIC
tmHeight As Long
tmAscent As Long
tmDescent As Long
tmInternalLeading As Long
tmExternalLeading As Long
tmAveCharWidth As Long
tmMaxCharWidth As Long
tmWeight As Long
tmOverhang As Long
tmDigitizedAspectX As Long
tmDigitizedAspectY As Long
tmFirstChar As Byte
tmLastChar As Byte
tmDefaultChar As Byte
tmBreakChar As Byte
tmItalic As Byte
tmUnderlined As Byte
tmStruckOut As Byte
tmPitchAndFamily As Byte
tmCharSet As Byte
End Type
Private Declare Function winGetTextMetrics Lib "gdi32" Alias "GetTextMetricsA" (ByVal hdc As Long, lpMetrics As TEXTMETRIC) As Long
Private Declare Function winGetTextFace Lib "gdi32" Alias "GetTextFaceA" (ByVal hdc As Long, ByVal nCount As Long, ByVal lpFacename As String) As Long
Private Sub cmdGetInfo_Click()
Dim tMetrics As TEXTMETRIC
Dim lReturn As Long
Dim sBuffer As String
Dim lSize As Long
Dim sReturn As String
' --------------------------
On Error GoTo PROC_ERR
lReturn = winGetTextMetrics(picSelec
If (tMetrics.tmPitchAndFamily
sReturn = sReturn & "...The font is a truetype font" & vbCrLf
End If
If (tMetrics.tmPitchAndFamily
sReturn = sReturn & "...The font is a Vector font" & vbCrLf
End If
If (tMetrics.tmPitchAndFamily
sReturn = sReturn & "...The font is a device font" & vbCrLf
End If
If (tMetrics.tmPitchAndFamily
sReturn = sReturn & "...The font is a variable pitch font" & vbCrLf
Else
sReturn = sReturn & "...The font is a fixed pitch font" & vbCrLf
End If
sBuffer = String$(255, Chr$(0))
lSize = Len(sBuffer)
lReturn = winGetTextFace(picSelected
MsgBox VBA.Left$(sBuffer, lReturn) & vbCrLf & sReturn
PROC_ERR:
Select Case Err.Number
Case Is <> 0
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdGetInfo_Click of Form frmMain"
Err.Clear
End Select
End Sub
Is this what you wanted to know?
Grtz.©
D.