home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
PMFONT.ZIP
/
FNTS.C
next >
Wrap
Text File
|
1991-06-27
|
1KB
|
48 lines
#define INCL_DEV
#define INCL_DOSMEMMGR
#define INCL_GPILCIDS
#define INCL_WINWINDOWMGR
#define INCL_WINLISTBOXES
#include <os2.h>
#include <stdio.h>
VOID EXPENTRY FntQueryList(hwnd)
HWND hwnd; // listbox handle
{
PFONTMETRICS pfm;
HDC hdc;
HPS hps;
LONG alDevInfo[2];
LONG lFonts;
LONG lFontCnt = 0L;
CHAR pch[64];
SEL sel;
USHORT i;
hdc = WinOpenWindowDC(hwnd);
DevQueryCaps(hdc, CAPS_HORIZONTAL_FONT_RES, 2L, alDevInfo);
hps = WinGetPS(hwnd);
lFonts = GpiQueryFonts(hps, QF_PUBLIC, (PSZ)0, &lFontCnt,
(LONG)sizeof(FONTMETRICS), (PFONTMETRICS)0 );
DosAllocSeg((USHORT)lFonts * sizeof(FONTMETRICS), &sel, SEG_NONSHARED);
pfm = (PFONTMETRICS)MAKEP(sel, 0);
GpiQueryFonts(hps, QF_PUBLIC, (PSZ)0, &lFonts,
(LONG)sizeof(FONTMETRICS), pfm );
for (i = 0; i < (USHORT)lFonts; i++) {
if (!(pfm[i].fsDefn & FM_DEFN_OUTLINE)) {
if ((pfm[i].sXDeviceRes == (SHORT)alDevInfo[0]) &&
(pfm[i].sYDeviceRes == (SHORT)alDevInfo[1]) ) {
sprintf(pch,
"%2d.%s",
pfm[i].sNominalPointSize / 10,
pfm[i].szFacename );
WinSendMsg(hwnd, LM_INSERTITEM,
MPFROMSHORT(LIT_END), MPFROMP(pch) );
}
}
}
DosFreeSeg(sel);
WinReleasePS(hps);
return;
}