*!* typedef struct tagTEXTMETRIC { *!* LONG tmHeight; *!* LONG tmAscent; *!* LONG tmDescent; *!* LONG tmInternalLeading; *!* LONG tmExternalLeading; *!* LONG tmAveCharWidth; *!* LONG tmMaxCharWidth; *!* LONG tmWeight; *!* LONG tmOverhang; *!* LONG tmDigitizedAspectX; *!* LONG tmDigitizedAspectY; *!* TCHAR tmFirstChar; *!* TCHAR tmLastChar; *!* TCHAR tmDefaultChar; *!* TCHAR tmBreakChar; *!* BYTE tmItalic; *!* BYTE tmUnderlined; *!* BYTE tmStruckOut; *!* BYTE tmPitchAndFamily; *!* BYTE tmCharSet; *!* } TEXTMETRIC, *PTEXTMETRIC; *!* tmPitchAndFamily *!* Specifies information about the pitch, the technology, and the family of a physical font. *!* The four low-order bits of this member specify information about the pitch and the *!* technology of the font. A constant is defined for each of the four bits. #Define TMPF_FIXED_PITCH 0x1 && 0001 #Define TMPF_VECTOR 0x2 && 0010 #Define TMPF_TRUETYPE 0x4 && 0100 #Define TMPF_DEVICE 0x8 && 1000 ?'IsFontTrueType("Arial")',IsFontTrueType("Arial") ?'IsFontTrueType("Courier")',IsFontTrueType("Courier") *!* IsFontTrueType(cFontName) Procedure IsFontTrueType Lparameters pcFontName As String Declare Integer CreateDC In gdi32; String lpDriverName,; String lpDeviceName,; String lpOutput,; String @lpInitData Declare Integer CreateFont In gdi32; Integer nHeight, ; Integer nWidth, ; Integer nEscapement, ; Integer nOrientation, ; Integer fnWeight, ; Integer fdwItalic, ; Integer fdwUnderline, ; Integer fdwStrikeOut, ; Integer fdwCharSet, ; Integer fdwOutputPrecision, ; Integer fdwClipPrecision, ; Integer fdwQuality, ; Integer fdwPitchAndFamily, ; String lpszFace Declare Integer SelectObject In gdi32; Integer hdc,; Integer hObject Declare Integer DeleteDC In gdi32; Integer hdc Declare Integer DeleteObject In gdi32; Integer hObject Declare Integer GetTextMetrics In gdi32; Integer hdc,; String @lpMetrics Local ; lnDC As Integer, ; lnFont As Integer, ; lnOriginalFont As Integer, ; lcTextMetric As String, ; lnPitchAndFamily As Integer, ; llResult As Boolean m.lnDC = CreateDC("DISPLAY",0,0,0) m.lnFont = CreateFont(0,0,0,0,0,0,0,0,0,0,0,0,0, m.pcFontName) m.lnOriginalFont = SelectObject(m.lnDC, m.lnFont) m.lcTextMetric = Replicate(Chr(0), 54) GetTextMetrics(m.lnDC, @m.lcTextMetric) *!* Get tmPitchAndFamily Byte m.lnPitchAndFamily = Asc(Substr(m.lcTextMetric, 52, 1)) m.llResult = Bitand(m.lnPitchAndFamily, TMPF_TRUETYPE) = TMPF_TRUETYPE *!* Follow MSDN intructions: SelectObject(m.lnDC, m.lnOriginalFont) DeleteDC(m.lnDC) DeleteObject(m.lnFont) Return m.llResultOR:
if Afont(aFontInfo, "Arial") then return aFontInfo(1) = -1 else return .f. endifCarlos Alloatti