issmallfonts function from conference

This forum is for ideas and or code to be contributed for general use.
Post Reply
Message
Author
bwolfsohn
Posts: 648
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

issmallfonts function from conference

#1 Post by bwolfsohn »

*********************
function issmallfonts(lDisplay)
*********************
// Pixels per inch if small or large font is active
#define SMALLFONT 96
#define LARGEFONT 120
// DeviceCap ID to retrieve device pix/inch attribute
#define LOGPIXELSX 88
#define LOGPIXELSY 90

LOCAL oDesktop := AppDesktop()
LOCAL hWND
LOCAL hDC
LOCAL nLogPix,cMsg
default lDisplay:=.f.
IF(ValType(oDesktop)!="O" .AND. !oDesktop:IsDerivedFrom("XbpIWindow"))
// Non GUI mode
RETURN(NIL)
ENDIF
hWND := oDesktop:GetHWND()
hDC := GetDC(hWND)
IF(hDC==-1)
// could not aquire device
RETURN(NIL)
ENDIF
nLogPix := GetDeviceCaps(hDC,LOGPIXELSX)
ReleaseDC(hWND,hDC)
IF lDisplay
cMsg:="Font Size is "+dc_xtoc(nLogPix)+" DPI"
cMsg+=". 96 DPI is the only DPI setting compatible with CUS Software"
dc_msgbox(cMsg)
ENDIF

RETURN(nLogPix== SMALLFONT)

DLLFUNCTION GetDC( nHWND ) USING STDCALL FROM USER32.DLL
DLLFUNCTION ReleaseDC( nHWND, nHDC ) USING STDCALL FROM USER32.DLL
DLLFUNCTION GetDeviceCaps( nHWND, nIndex ) USING STDCALL FROM GDI32.DLL
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

Post Reply