New: iPhone/iPad development course in Belgium in August.

16 Jan 2009

If you're on a Mac, you cannot embed fonts in Flex or AIR apps directly from the dfont files that come with the system. However, you can do this:

  1. Install fondu (sudo port install fondu or get the OS X package)
  2. Copy the fonts you want to convert from /System/Fonts to, say, ~/mydfonts
  3. Switch the output folder (e.g., cd ~/mynewfonts)
  4. In Terminal, invoke fondu (fondu ~/mydfonts/*.dfont)
  5. In your Flex Builder project properties, add the following compiler tag: -managers flash.fonts.AFEFontManager (or else you'll get an exception during transcoding: Unexpected exception encountered while reading font file error)
  6. Finally, embed the font as you would normally via CSS. e.g.,
    @font-face {
      src: url("fonts/Geneva.ttf") ;
      font-family: "GenevaAIR";
      advanced-anti-aliasing: true;
    }

Add Your Comment

Spam Protection by WP-SpamFree

How to: embed dfont fonts on OS X in Adobe Flex and AIR apps

  1. Nice! I was just wondering how I would do that yesterday.

    Matt Giger
  2. Thought it was a Flex/Air “feature”. Instead you teach me it is just a MacOsx thing. Thanks for sharing.

    funkyboy
  3. Killer tip Aral. Merci beaucoup!

    Brooks
  4. Excellent post! Exactly what I needed. Well almost… How about converting fonts into bold?

    Robin