Search code examples
actionscript-3fontsairadobe

AFEFontManager in Adobe AIR. How to embed fonts now?


I have been building my games using FlashDevelop with Flex SDK compiler all the time, but now I need ASC 2.0 with adobe air. So I have migrated to it. But one problem came out, which I just can't find a solution for. I need to embed TTF fonts, which I used to always add additional compiler option -managers=flash.fonts.AFEFontManager for. In this new AIR SDK all I get is the next warning:

command line Warning: 'compiler.fonts.managers' is not fully supported.

And of course fonts do not embed. Is there a solution for it?

Here's how I embed them

[Embed(source = "VERDANA.TTF", fontName = "verdana")]
private static var Verdana: Class;

Solution

  • Well, the answer to this is that Adobe (for some unknown reason) have cut font pretranscoding out of ASC 2.0, so all fonts must be pretranscoded now to be able to embedded into code. The easiest way is to use Adobe Flash pro, to embed font and pack it as SWC. Then attach it to your project somewhow, and register font via Font.registerFont(Arial); (or some other class you have attached to it). Bingo! Now you can use it. The second, more complicated, but cheaper way is to use fontswf utility from adobe

    Details can be found here http://www.bytearray.org/?p=4789 and here: http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7f5f.html (at the bottom of the page)