Posted: Mon Dec 23, 2002 1:33 pm
Restored from previous forum. Originally posted by sk.
While coming from VB I've still have some difficulties in "adapting" PB, specially with this "pointer stuff" ...
Trying to get all installed fonts I used the EnumFontFamilies() function. It would be nice if someone can explain to me how to get the lfFaceName data.
Thanks!
sk
While coming from VB I've still have some difficulties in "adapting" PB, specially with this "pointer stuff" ...

Code: Select all
;// =====================================================================================;// Structure ENUMLOGFONT
;// elfLogFont.LOGFONT 60 Byte
;// elfFullName.b[64] 64 Byte
;// elfStyle.b[32] 32 Byte = 156 Byte
;// EndStructure
;// Structure LOGFONT
;// lfHeight.l 4 Byte
;// lfWidth.l 4 Byte
;// lfEscapement.l 4 Byte
;// lfOrientation.l 4 Byte
;// lfWeight.l 4 Byte
;// lfItalic.b 1 Byte
;// lfUnderline.b 1 Byte
;// lfStrikeOut.b 1 Byte
;// lfCharSet.b 1 Byte
;// lfOutPrecision.b 1 Byte
;// lfClipPrecision.b 1 Byte
;// lfQuality.b 1 Byte
;// lfPitchAndFamily.b 1 Byte
;// lfFaceName.b[32] 32 Byte = 60 Byte
;// EndStructure
;// =====================================================================================
Procedure EnumFontFamProc(*lpelf.ENUMLOGFONT, *lpntm.NEWTEXTMETRIC, FontType, lParam)
;// int CALLBACK EnumFontFamProc(
;// ENUMLOGFONT *lpelf, // logical-font Data
;// NEWTEXTMETRIC *lpntm, // physical-font Data
;// DWORD FontType, // type of font
;// LPARAM lParam // application-defined Data
;// );
;?? access to ??: lpelf\LOGFONT\lfFaceName
Debug PeekS(@lpelf + 29, 32)
ProcedureReturn 1
EndProcedure
Procedure SysInfo_Fonts()
;// int EnumFontFamilies(
;// HDC hdc, // handle To DC
;// LPCTSTR lpszFamily, // font family
;// FONTENUMPROC lpEnumFontFamProc, // callback function
;// LPARAM lParam // additional Data
;// );
hDC.l = GetDC_(GetDesktopWindow_())
EnumFontFamilies_ (hDC.l, 0, @EnumFontFamProc(), lParam)
ReleaseDC_ (hWnd, hDC)
EndProcedure
Thanks!
sk