Sign in to follow this  
mameman

Bounding Rectangle For Text?

Recommended Posts

Hi, Does anyone know of a good way to calculate the EXACT bounding rectangle for some text using any TrueType font?. I've gone through a hole host of techniques (including examining the GDI path) for the font but I've not had ANY success :(. I always seem to be one or two pixels out either on the horizontal or vertical axis. Using Win32/C++ and OGL. ANY ideas/suggestions on how to lance this problem MUCH appreciated. MAMEman.

Share this post


Link to post
Share on other sites
Thanks for the infos prototype but this isn't what I'm looking for!. Probably didn't explain the problem correctly. Anyways let me simplify. Basically try to draw some text at 0, 0 using DrawText(), TextOut() or any other GDI function you care to use, and try to put a rectangle around it WITHOUT leaving any space on the left, top, right and bottom sides of the text. Note this assumes that you can use any TrueType font and memory permitting any pointsize too.

Hope this simplifies,

MAMEman.

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