Declare Function PPFontFam Lib "PPFONT.DLL" (ByVal hwnd As Integer, alf As NEWLOGFONT, atm As NEWTEXTMETRIC, aft As Integer) As Integer
Declare Function PPFontFamNum Lib "PPFONT.DLL" (ByVal hwnd As Integer) As Integer
Declare Function PPFont Lib "PPFONT.DLL" (ByVal hwnd As Integer, alf As NEWLOGFONT, atm As NEWTEXTMETRIC, aft As Integer, ByVal acharset As String) As Integer
Declare Function PPFontNum Lib "PPFONT.DLL" (ByVal hwnd As Integer, ByVal acharset As String) As Integer
Function chst (testitem As String)
Select Case Asc(testitem)
Case 0
chst = "ANSI"
Case 1
chst = "Default"
Case 2
chst = "Symbol"
Case 128
chst = "SHIFTJIS"
Case 129
chst = "HANGEUL"
Case 136
chst = "ChineseBig5"
Case 255
chst = "OEM"
Case Else
chst = "Unknown"
End Select
End Function
Function clipprecision (testitem As String)
Select Case Asc(testitem)
Case 0
clipprecision = "Default"
Case 1
clipprecision = "Character"
Case 2
clipprecision = "Stroke"
Case &HF
clipprecision = "Mask"
Case &H10
clipprecision = "LH Angles"
Case &H20
clipprecision = "TT Angles"
Case &H80
clipprecision = "Embedded"
Case Else
clipprecision = "Unknown"
End Select
End Function
Function family (testitem As String)
f% = Asc(testitem) / 16
Select Case f%
Case 0
family = "Don't Care"
Case 1
family = "Roman"
Case 2
family = "Swiss"
Case 3
family = "Modern"
Case 4
family = "Script"
Case 5
family = "Decorative"
Case Else
family = "Unknown"
End Select
End Function
Sub Form_Load ()
Static lf() As NEWLOGFONT
Static tm() As NEWTEXTMETRIC
Static ftype() As Integer
n = PPFontFamNum(hwnd)
ReDim lf(n), tm(n), ftype(n)
i = PPFontFam(hwnd, lf(1), tm(1), ftype(1))
For j = 1 To i
If ftype(j) And DEVICE_FONTTYPE Then
ft$ = "Device "
Else
ft$ = "GDI "
End If
If ftype(j) And TRUETYPE_FONTTYPE Then
ft$ = ft$ + "TrueType"
Else
If ftype(j) And RASTER_FONTTYPE Then
ft$ = ft$ + "Raster"
Else
ft$ = ft$ + "Vector"
End If
End If
font$ = lf(j).lfFacename
For k = 1 To LF_FACESIZE
If Asc(Mid$(font$, k, 1)) = 0 Then
Exit For
End If
Next
font$ = Mid$(font$, 1, k - 1)
l = Len(ft$)
list1.AddItem font$ + " * " + ft$
Next
list1.ListIndex = 4
List1_Click
End Sub
Sub List1_Click ()
Static lf() As NEWLOGFONT
Static tm() As NEWTEXTMETRIC
Static ftype() As Integer
list2.Clear
list3.Clear
list4.Clear
list5.Clear
selfont$ = list1.List(list1.ListIndex)
n = InStr(selfont$, "*")
selfont$ = Trim(Mid$(selfont$, 1, n - 4))
n = PPFontNum(hwnd, selfont$)
ReDim lf(n), tm(n), ftype(n)
i = PPFont(hwnd, lf(1), tm(1), ftype(1), selfont$)