Recommended Posts

i've done the same for centering 3d font a in nehe's 14th lesson but now i would like to have the same but with bitmaped fonts . Now what i would usually what's behind the code is.. (ScreenWidth / 2) - AllStringAddedTextWidth ... how do i find the width being used by CreateFont when i set the mWidth parameters as 0 ? thank you in advance
[Edited by - Metal Typhoon on June 30, 2005 11:16:11 PM]

0

Share this post

Link to post

Share on other sites

You ask how to find width from font that is created by some function... well, we don't know how this function looks like or where did you take it from, so we can't say anything for sure. How to count width, depends on your code, how it's designed, so one could use sth trivial like function GetTextWidth() { return width; }, other would need to write sth like this:

Share this post

Link to post

Share on other sites

Also, be aware that unless it's a monospaced font, each letter will have a different width - so what text you want to display depends on how it's centred - regardless of how many actual letters there are.