Sign in to follow this  
MrDeathStar

Gettextextent And Font Size

Recommended Posts

I am using the Canvas component to center some text features among custom graphics.  I call Draw.SetFont() and Draw.GetTextExtent() to calculate text positions before drawing.  However, GetTextExtent() seems to report the same pixel size regardless of the font size chosen.

 

Since SetFont() does not use a DC argument, I tried a dummy TextOut() using the chosen font to see if that would set the DC before calling GetTextExtent.  It did not work either, so any help is appreciated.  Thanks.

(ver. 2203/2224/2229)

Share this post


Link to post
Share on other sites

We have that fixed.  Email us for a link to a prerelease build (or if you've already used a prerelease, its in the same spot as before).  You were on the right track trying to do a dummy TextOut().  The issue was that the system wasn't setting the font into the DC before calling GetTextExtent().  It does it now....

Share this post


Link to post
Share on other sites

I figured it might have been a simple SelectObject related thing.  The dummy TextOut was a stab in the dark, but if it had worked I would have probably questioned potential DC object leaks from not selecting it out.  Since the forum did not have much regarding GetTextExtent, I gather it is a seldom used/tested feature.  So, thanks again for a speedy fix with the 2230 update!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this