home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 4
/
BUGCD1997_05.BIN
/
aplic
/
clip4win
/
clip4win.exe
/
C4W30E.HUF
/
SOURCE
/
FONTENUM.PRG
< prev
next >
Wrap
Text File
|
1995-07-04
|
1KB
|
50 lines
#include "windows.ch"
#include "font.ch"
#define NO_C4WCLASS
#include "commands.ch"
function main()
local oApp, oWnd
CREATE APPLICATION oApp WINDOW oWnd ;
TITLE "Clip-4-Win Font Enumeration Sample" ;
ON WM_PAINT DoFonts(oWnd)
return nil
static function DoFonts(hWnd)
local aFonts := GetFonts(), cNames := "", hDC := GetDC(hWnd), c
aeval(aFonts, {|a| c := a[LF_FaceName], ;
cNames += chr(13) + left(c, at(chr(0), c) - 1)})
DrawText(hDC, cNames)
ReleaseDC(hWnd, hDC)
return nil
static function GetFonts()
local nFonts := 0, aFonts := {}
local hDC := GetDC(0)
EnumFontFamilies(hDC, , {|nFontPtr, nTMPtr, nFontType| ;
aadd(aFonts, GetFontInfo(nFontPtr, nFontType)) })
ReleaseDC(0, hDC)
return aFonts
static function GetFontInfo(nFontPtr, nFontType)
local cLFont, a
if C4W_And(nFontType, 4) != 0 // TrueType
cLFont = C4W_Peek(nFontPtr, NLF_BYTELEN)
a = Bin2A(cLFont, NLF_Bin2A)
else
cLFont = C4W_Peek(nFontPtr, LF_BYTELEN)
a = Bin2A(cLFont, LF_Bin2A)
endif
// change some from BYTE to Clipper LOGIC
aeval({LF_Italic, LF_Underline, LF_StrikeOut}, {|i| a[i] := (a[i] != 0)})
//? left(a[LF_FaceName], at(chr(0), a[LF_FaceName]) - 1)
return a