Sign in to follow this  
Addictman

Imagefont alignment

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
other...



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

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