The purpose of this post is to document all the different properties available when using the [Embed] metadata tag to embed fonts into an SWF file. Much of this information is spread throughout Adobe’s documentation, and some of it came from personal experience while developing the Runtime Font Publisher extension. This list was generated out of a desire to see all this information in a single easy-to-read table.
While researching this post the most important points I discovered are that the Flex SDK uses three different font managers, that the font type (OpenType versus TrueType) often impacts the behavior of a property, and in a few cases, setting a value on one property will affect the behavior of a different property. As such I’ve repeated properties to point out behaviors specific to font type, and the notes point out instances where setting one property affects the behavior of a different property. Enjoy!
| Font Type | Property | Values | Notes | |
|---|---|---|---|---|
systemFont |
Exact name of a system font (e.g., "Arial") |
The font must be installed on your system. The JRE font manager is used to embed system fonts. The Flex SDK does not support embedding OpenType sytem fonts. | ||
source |
Absolute or relative location of font file (e.g., "c:/akbar.otf") |
OpenType fonts are transcoded by the AFE font manager. | ||
source |
Absolute or relative location of font file (e.g., "../akbar.ttf") |
TrueType fonts can be transcoded by the AFE or Batik font manager. Modifying the flex-config.xml file defines which font manager is used. |
||
fontName |
String alias | The fontName property is used to reference the font at runtime within the Flash Player. To shadow a font, that is giving it the same name as a system font, set the show-shadows-system-font-warnings compiler option to false. Shadowing a font often causes issues at runtime, especially if the system font that is being shadowed has a different weight or style than the embedded font. |
||
fontFamily |
String alias | Exhibits the same behavior as the fontName property. | ||
fontWeight |
normal | bold | heavy |
The fontWeight property must be set to the typeface style defined by the font file. Adobe’s documentation only references the three values, however some font files have a different typeface style. In theory, these could also be used. Have yet to test. |
||
fontWeight |
normal | bold | heavy |
The fontWeight property behaves the same for TrueType fonts as OpenType font when using the source property to embed a font. When the systemFont property is used, the font can be set to either normal or bold. I believe this styling is done by functions of the compiler, and not the exact font outlines defined in the font file. Must research more. |
||
fontStyle |
normal | italic | oblique |
The fontStyle property must be set to the typeface style defined by the font file. Adobe’s documentation only references the three values, however some font files have a different typeface style. In theory, these could also be used. Have yet to test. |
||
fontStyle |
normal | italic | oblique |
The fontStyle property behaves the same for TrueType fonts as OpenType font when using the source property to embed a font. When the systemFont property is used, the font can be set to either normal or italic. I believe this styling is done by modifying the outlines for the font, and not using the exact outlines defined within the font file. Must research more. |
||
unicodeRange |
Unicode characters written in U+hex notation. Also accepts string range names. | Ranges are specificed by dashes. Characters and ranges are comma delimited. String range names are defined in flex-config.xml. |
||
advanced- |
true | false |
By default the Flex SDK sets this value to true. Fonts that use advanced anti-aliasing appear sharper at smaller sizes. This property is ignored if the cff property is set to true. | ||
|
true | false |
Compact Font Format embedded fonts are created when set to true. CFF fonts are used by the Flash Text Engine. Classic textfields (flash.text.textfield) cannot use embedded CFF fonts. |
||
mimeType |
application/x-font |
This property must be set to succesfully embed the font. | ||
mimeType |
application/x-font | application/x-font-truetype |
Unknown if using either mimeType affects behavior of embedded font. | ||
Thanks for this property list. Just what I needed
I was researching a lot about these font managers the last days, just to find out that the smaller opensource version of the flex sdk doesn’t support opentype fonts.. Must have forgotten that in the last years without sdk updates..
Hello,
I was wondering if you’ve ever encountered any problems when embedding multiple otf files for various weights of one font family? I’m currently truing to get Helvetica Neue Light Standard CondesedOblique and BoldCondensed into Flex SDK 3.5, but with no luck!
I’m not getting any errors. It is displaying the font, but looks like the light version. I’ve even added -managers flash.fonts.AFEFontManager to my compiler settings.
Karen
The cff property name was incorrect. The correct property name to embed a font as a Compact Font Format is embedAsCFF. Using cff as a property would yield the following compile time error using the Flex 4 SDK, “transcoding parameter ‘cff’ is not supported by ‘flex2.compiler.media.FontTranscoder’.” This post has been updated.
Hi Karen,
Sorry, I haven’t personally run into issues with multiple OTF files and various weights. For different font weights of a font family, have you tried not including the fontStyle and fontWeight parameters in your embed tag? Still doing some more testing to confirm, but so far when using the Flex 4.0 SDK I’ve noticed that those parameters seem to be only used for system fonts.
Also, I ran into this thread recently. It suggests that OTF files with multiple weights will only work with system fonts. Which I think is a little strange because the Adobe documentation suggests that this was only possible with the CFF font manager that was introduced with the Flex 4 SDK. Still worth a shot!