Jump to content
  • Advertisement
Sign in to follow this  

Imagefont alignment

This topic is 4873 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

Hi. In designing imagefonts, there are some issues at hand. For example, characters like g,q,p,j that go "under the line" so to speak. How do you handle these? Do you make individual exceptions, or has anyone found a slick way of doing this? :)

Share this post

Link to post
Share on other sites
hi Addictman,

unfortunately, there is nothing what you are calling "slick way" (in respect of my
definition of slick way, which means in this example an automatic/intelligent
routine taking care of such special cases); most engines
are using standard/default bitmaps fonts, where are some pixels are wasted at
characters like "i" ect.; in some systems it's possible to avoid such
situations, for example: if the system allows you to specify asymetric font
size characterizations.
but: in most cases, the simple implementation looks really very good and is
fully useable - there is no reason for having doubt that the quality will be
bad: just try it...

depending on the situation i would consider between these two situations...
depending on what quality you want, the one solution may be better than the

Share this post

Link to post
Share on other sites
Hello and thanks for the reply.

In the game engine I'm writing now, my ImageFont class allows for
different-sized images. In my opinion that makes for some more
options and some interesting fonts. But I am having problems
aligning my words properly. Drawing one and one character works
ok (then you can align them on the fly), but this is not really
effective performance-wise. So, I am buffering into composite
words and senteces as well. My solution at the moment is to introduce
an array with unicode indexes (direct mapping to character values),
which allows you to specify "offsets" in height and alignment. The
default is to align every letter to bottom and left, and if a letter
with an "offset" is found in the word, enlarge the image, draw the letter
at its offset position (typically further down than normal characters),
and them trim the image. It works, but it might require the use of
a method or two too much. However, considering that different fonts
display different height-differences in these characters, it might
be my only solution.

Oh well, it is a learning experience, I guess. If anyone has specific
tips on how to improve on things, by all means!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!