Flex/AIR embedded fonts - Exception during Transcoding - Solved

I've come across this error a number of times:

exception during transcoding: Unexpected exception encountered while reading font file '/C:/Documents and Settings/markl/My Documents/Flex Builder 3/DexterNorthCode/src/assets/DejaVuSans-Bold.ttf'

It can be very frustrating as there is not much information to be gleaned from the error messages and the whole font area is very murky and complicated.

There are a number for reasons that this error will occur

  • If you reference the wrong file
  • If you specify the fontStyle or fontWeight wrong
  • or most frustratingly if the font manager can't interpret the font correctly.

After grappling with this problem for I while and after much reading I realised that there are 3 different "font managers" that transcode fonts in AS3. These are:

  • flash.fonts.JREFontManager
  • flash.fonts.AFEFontManager
  • flash.fonts.BatikFontManager

The different font managers have different capabilities and should be automatically selected to choose the best one. However, this is not always the case.

You can force the compiler to use a specific manager by appending the following to the compiler arguments.

Project->Properties->Flex Compiler->Additional compiler arguments:

-managers=flash.fonts.AFEFontManager

This forces the use of the AFEFontManager which seems to have the best support for fonts and is the one being most actively developed.

Comments
Shane D's Gravatar I ran into the same problem and the AFEFontManager sovled the problem when publishing. However, I still get the exceptions while working in design mode in the Flex IDE. I have resorted to commenting the embeded fonts in the css while skinning (so that the view renders correctly) and then uncommenting when the project is published. Any Idea how to work around that since it makes it quite difficult to skin/stlye an app when you cannot see the assets as well as the correct fonts in the design view.

Thanks in advance...
SD
# Posted By Shane D | 6/17/08 4:03 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.1.004.