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:
The How to: embed dfont fonts on OS X in Adobe Flex and AIR apps article by Aral Balkan, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial 2.0 UK: England License.
- Install fondu (
sudo port install fonduor get the OS X package) - Copy the fonts you want to convert from /System/Fonts to, say, ~/mydfonts
- Switch the output folder (e.g.,
cd ~/mynewfonts) - In Terminal, invoke fondu (
fondu ~/mydfonts/*.dfont) - 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) - 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; }
The How to: embed dfont fonts on OS X in Adobe Flex and AIR apps article by Aral Balkan, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial 2.0 UK: England License.
Nice! I was just wondering how I would do that yesterday.
Thought it was a Flex/Air “feature”. Instead you teach me it is just a MacOsx thing. Thanks for sharing.
Killer tip Aral. Merci beaucoup!
Excellent post! Exactly what I needed. Well almost… How about converting fonts into bold?