Archived

This topic is now archived and is closed to further replies.

How do i figure out the width of specific characters?

This topic is 5898 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m writing a font engine, and I got to take characters from a bitmap and blit them, but the characters are all the same width apart, and it looks really bad! I want to make it space the characters right, so I need to know how wide each specific character is I''m blitting. How do I do this without manualy counting pixels?!

Share this post


Link to post
Share on other sites
There is no secret : either you count by hand, or you write a routine that does the counting for you (simple pixel test).

Share this post


Link to post
Share on other sites
Save it in the bitmaps. Either save bitmaps of varying widths (which would be reflected in the bmWidth field), or encapsulate the bitmap data in a font format which defines "hints" indicating how much to move the hotspot of the character in any direction - which, incidentally, is what TrueType fonts due.

Share this post


Link to post
Share on other sites
Write a routine to count pixels in initialization period, then store it somewhere.

---------------

I finally got it all together...
...and then forgot where I put it.

Edited by - AdmiralBinary on November 23, 2001 12:08:36 AM

Share this post


Link to post
Share on other sites
Please forgive me. My brain just woke up. I realize I just stated the painfully obvious, and that it doesn't answer your question at all.

EDIT: Dude, my brain HASN'T woken up. It's not painfully obvious. It's utterly inapplicable and irrelevant. I s'pose you're blitting from a single surface? I assumed u were using one surface for each char...

---------------

I finally got it all together...
...and then forgot where I put it.

Edited by - AdmiralBinary on November 23, 2001 12:07:14 AM

Share this post


Link to post
Share on other sites