I also managed CreateFontIndirect to work. Notice that I don't have
specified terminating null for sFaceName in tLogFont struct, which
doesn't seem to matter anyway. The usage is
.GetTextSize("string","font",size[,bold][,italic])
E.g., .GetTextSize("This is a test.","Courier New",12,1,1)
-------------- GetTextSize.PowerPro ---------------------------------
@CreateFontIndirect
args sString,sFaceName,nHeight,bold,italic
local hWnd,hDC,hFont,hFold,tLogFont,aSize
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"++;;+
repeat(" c",length(sFaceName))++esc(?"|0n",0),nHeight,0,0,0,400+;;+
300*bold,if(italic,"001"),"","","","","","","",sFaceName[?"(?s)."])
hFont=dll.call("CreateFontIndirect|t* ui",tLogFont)
hFold=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,hFold)
dll.call("DeleteObject|ui",hFont)
dll.call("ReleaseDC|ui ui",hWnd,hDC)
win.debug("Width:"++aSize[1],"Height:"++aSize[2])
quit
---------------------------------------------------------------------
Sean
------------------------ Yahoo! Groups Sponsor --------------------~-->
Something is new at Yahoo! Groups. Check out the enhanced email design.
http://us.click.yahoo.com/SISQkA/gOaOAA/yQLSAA/JV_rlB/TM
--------------------------------------------------------------------~->
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/