About this site's lack of design: Yes, it's supposed to look this way — I'm helping create a new sandbox theme for WordPress (see it on GitHub).

Dan Rubin's SuperfluousBanter

Suffering from chronic idiocy since 1977

|

Bitmap Fonts in Flash

It’s 3:00AM and I just spent 2 hours fix­ing a bitmap font (pixel) to dis­play cor­rectly in my Flash movie. I even­tu­ally solved the prob­lem. Thank god, because I think I was going mad. Here’s what I did to avoid a few noto­ri­ous problems.

Prob­lem 1: Blurry Text

You got your nifty font all ready and sud­dendly Flash is not being nice and diplay­ing it all blurry. Yuck. It turns out that when a text field’s X and Y stage coor­di­nates are non-integer val­ues (for exam­ple X: 102.4 and Y: 301.3) the pix­els at the edge of the font suf­fer from over anti-aliasing. You can read more about it in a Flash Tech­Note. The solu­tion is pretty sim­ple: just change those nasty non-integer val­ues to nice inte­ger val­ues. This was some­what of a “duh” moment — when read­ing the Tech­Note I remem­bered this odd­ity (the doc­u­ment dates from 2001 for cry­ing out loud.) Addi­tion­ally Fonts For Flash has a use­ful user guide to help you make sure those bitmap fonts dis­play as crisp as they should (note: they carry a nice selec­tion of bitmap fonts for sale.) Good, time to move on.

Prob­lem 2: Filled Characters

My prob­lems were far from over. The first prob­lem was solved in a mere 5 min­utes. A lit­tle Google here and there and you’re ready to get going again. But then sud­dendly some char­ac­ters of my font filled them­selves where no fill was intended. Com­pare the two images below.

Look mom! I screwed up my font in Flash!

Now, obvi­ously sit­u­a­tion A totally sucks. Use­less. Before I go on I must add that this was a bitmap font I edited and changed myself using Macro­me­dia Fontog­ra­pher, an appli­ca­tion I’m not ter­ri­bly famil­iar with. I didn’t like some spe­cific let­ters. How­ever only “R” and “D” were giv­ing me trou­ble (i.e. fill­ing up) and I didn’t touch those — go fig­ure. Any­way, to be hon­est I had no clue what was going on. I redesigned both let­ters, but alas with­out sat­is­fac­tory result (I was doing some­thing wrong obvi­ously.) After doing some research I came across a tuto­r­ial at Ultrashock.com on this very sub­ject. I was saved. I cor­rectly edited the let­ters that were caus­ing the pain and it automag­i­cally all worked per­fectly as shown in sit­u­a­tion B.

Feel­ing Silly

I feel a bit silly for my lack of knowl­edge in this spe­cific case — it’s not like this is an extremely recent prob­lem or any­thing (more like known for ages.) I guess I never really used bitmap fonts much in Flash and if I did, I was a lazy bum and would import images (which is obvi­ously a big no-no con­sid­er­ing file size and dynamic text fields.) Any­way, I hope my igno­rance will help you with future projects and lead to less frus­tra­tion and time loss. I’m going to bed and dream about bitmap fonts in Flash and world dom­i­na­tion. Catch you later.

This item was posted by dhilhorst on Tuesday, July 6th, 2004.

Categories:

You can follow comments on this item via the RSS 2.0 feed.

Comments are closed.

6 comments on “Bitmap Fonts in Flash”

  1. Posted by Jeff Adams on Wednesday, July 7th, 2004.

    Fonts in Flash drive me nuts, sheesh

  2. Posted by Tim Uruski on Wednesday, July 7th, 2004.

    Good link to the Ultra­shock tuto­r­ial, with that title it should hope­fully Google more read­ily. Like you, I spent hours Googling and forum-hopping to find that solution.

    As best I can tell it has to do with the ver­tices touch­ing, if you seper­ate them by even a tiny bit Flash will be have, oth­er­wise it drops the com­pound shape and col­lapses your nice open­ing into a black box. Blah.

  3. Posted by Rob Cameron on Wednesday, July 7th, 2004.

    Well, let’s see the project you were work­ing on! :)

  4. Posted by [m] on Friday, July 9th, 2004.

    Or you could open up mx 2004 and set the anti-aliasing off. ;)

  5. Posted by stefano on Wednesday, July 14th, 2004.

    finally, a GREAT arti­cle about this prob­lem!!! thank you so much. I have much appre­ci­ate and i have insert this link in my blog:

    http://www.webmaster-republic.it

  6. Posted by annia on Thursday, July 15th, 2004.

    whee thanks for shar­ing the link! Flash sucks some­times with those sim­ple things :(