Embedded fonts in Adobe air

I know there are nice articles on it here and here by Adobe, but they just did not seem 100% clear when describing embedding fonts in Adobe AIR (also I know I’m supposed to be using ‘spark’ but again this is a support fix)

So to embed fonts in your adobe air app in order to stop your users wrecking your nice layout when they do something like replace the Ariel font on their system (don’t ask), you will need adobe Air 2.5 or better, and be using CSS for text properties (no more in-line stuff, or setting of default in “<mx:WindowedApplication” for you my lad)

Set the font face in the top of your CSS like this

@font-face {
    src:url("../src/com/ldc/Resource/fonts/arial.ttf");
    fontFamily: Ariel;
    advancedAntiAliasing: true;
}

Now the font will be actually embedded in your air application, so the link you use is the referential one to the font file that you have copied from your system font folder into your air project source folders

and then your normal CSS like this will be happy with it

.BaseField {
    color: #580C18;
    fontFamily: Arial;
    fontSize: 12;
    textAlign: left;    
}

that’s it

Leave a Reply

Your email address will not be published. Required fields are marked *