> -------------- GetTextSize.PowerPro -------------------------------
> args sString,sFaceName,nHeight,bold,italic
> local hWnd,hDC,hFont,hForg,tLogFont,aSize,_1_
>
> _1_=esc(?"\x01",?"\")
>
> hWnd=0
> hDC=dll.call("GetDC|ui",hWnd)
> nHeight=0-dll.call("MulDiv|i i i",;;+
> nHeight,dll.call("GetDeviceCaps|ui i",hDC,90),72)
>
> tLogFont=dll.create_struct("i i i i i uc uc uc uc uc uc uc uc s",;;+
> nHeight,0,0,0,400+300*bold,;;+
> if(italic,_1_),"","",_1_,"","","","",sFaceName)
> hFont=dll.call("CreateFontIndirect|t* ui",tLogFont)
> hForg=dll.call("SelectObject|ui ui",hDC,hFont)
>
> aSize=dll.create_array(2,"i")
> dll.call("GetTextExtentPoint32|ui s i a* b",;;+
> hDC,sString,length(sString),aSize)
>
> dll.call("SelectObject|ui ui",hDC,hForg)
> dll.call("DeleteObject|ui",hFont)
> dll.call("ReleaseDC|ui ui",hWnd,hDC)
>
> win.debug("Width:"++aSize[1],"Height:"++aSize[2])
> quit
> ---------------------------------------------------------------------
BTW, it's still ignorant of font names, I mean, uniform results
regardless of font names used.
Sean
Attention: PowerPro's Web site has moved: http://www.ppro.org
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/power-pro/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/