Font embedding troubles

Posted on January 31, 2008
Filed Under Flash Tips, Font related |

Why can’t localization and embedding fonts be as simple as one would want it.
Embedding a font in the library (new Font) to get the complete font may seem like a good enough solution. But no… you just can’t embed the whole typeface, just the characters that matches the current system at compile time. Sooo annoying. Even though you have a rich OpenType font with characters for all your languages.
Read somewhere that Flex can use some unicode range to embed characters at compile time, but Flex just isn’t my thing (too fond of my timeline), at least not yet.

My solution:
1. Place a textfield on stage and in it, embed all characters you need.
2. Create a movieclip with the textfield and export it for runtime sharing. Export the swf.
3. Create another FLA that includes the movieclip you previously made through “import for runtime sharing”. Export swf.
4. In your application FLA, load the swf you created. Now you can use the font, set it with either CSS or TextFormat. (I prefer CSS for localization).

One thing though, the font you import… you can’t have a textfield anywhere in your application FLA that has that font set in the IDE (you set your textfilelds font through actionscript). If you do… nothing will show up.

This solution seems good enough in both AS2 and AS3.

Leave a Reply




For and by the developers at swedish digital agency Projector.