--- In [email protected], "brucexs" <[EMAIL PROTECTED]> wrote:
>
> Not sure if this is the issue, but the size argument for the logical
> font structure is not the same as the font size in points that you
> commonly see in the font selection dialogs.
>
> You have to change it
> lfHeight = -MulDiv(PointSize, GetDeviceCaps(hDC, LOGPIXELSY), 72);
Thanks, I changed it. What I meant by not working properly was that
the text width in bold case was less than that in normal case, which
was quite counter-intutive. Looks like there is a problem to set value
for (u)char type.
-------------- 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
---------------------------------------------------------------------
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/