Search code examples
actionscript-3fontsair

Air starling as3 mobile app and using fonts


I am about to build a new mobile app for iOS and Android using AS3, Air and Starling and was wondering if someone would be kind enough to share the best method for using non system specific fonts?

I will essentially be using 2 different fonts and each one will need to have multiple sizes, italics, bolds etc.

I have used embedded ttf's in previous apps however when the font is lower than a particular size they become slightly fuzzy. I have also used font sprite sheets but these only seem good when using 1 or 2 different sizes.

Any guidance for best methods for performance and re-usability is appreciated.


Solution

  • There are two ways of using custom fonts with Starling:

    1. Use bitmap fonts. This seems to be less desirable for you as you would need to have bitmap data for every size of your font, not to mention bolds and italics.

    2. Use regular Flash text API to generate your text, then get it in a bitmap form and render with Starling. This is slower than using bitmap fonts as text blocks must be prerendered to bitmaps for the first time but you should be comfortable with it if your text won't change too frequently.

    Take a look how FeathersUI utilizes both techniques to render the text. :)