My Coding Life
Archive for January, 2010
A property list for embedding fonts with the [Emded] metadata tag.
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. | ||