How to embed fonts in pure AS3

On my travels as a contractor, I’ve seen various methods used for embedding fonts in ActionScript 3 projects (code embedded, creating font SWFs, runtime loading, etc). Each of them has its own merits (and limitations), but generally you’re looking for something that’s easy to do, easy to maintain (for others, not just yourself) and of course that works!

So, here’s the method I use for pure AS3 projects I compile with the Flex SDK. I embed the TTF or OTF file in a ‘Style’ class and include those font files in the CVS/SVN repository too – it does my head in when fonts go missing, because a designer can’t remember which font they used:


 

Through experience, this seems to be the most robust and maintainable way of dealing with fonts (not to throw out more flexible, but perhaps less robust ways, such as runtime loading), especially when you need control of the unicode ranges you are embedding – which I have included for reference.

InterServer Web Hosting and VPS
 

One thought on “How to embed fonts in pure AS3”

  1. Nice Post, didnt know about the unicodeRange-Part. Anyhow, I’m having a Project, where the embedded Font (Verdana) is drawing latin I characters (like äöü) in a wrong way, so the unicodeRange-part seems to be ignored. Any Experience with that?
    Cheers
    Manuel

Leave a Reply