EDIT:
**Problem solved.
Turns out, when targeting FP10, you have to specify an additional parameter for the [Embed] tag when creating the font SWF:
embedAsCFF=‘false’.
Otherwise the font cannot be used with Textfield().**
I’ve spent close to four hours trying to get this banal issue resolved.
I want to use an embedded font in my AS3 project and no matter what technique I try, it does not work.
After having tried exported Font SWF/SWC from Flash CS5 as well as via the FDT Font Library, I have now created the font SWF according to this article.
When I load the font and register it, everything seems fine:
[FONT=courier new]constructor:[/FONT]
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.INIT, init);
loader.load(new URLRequest("assets/_Rockwell.swf"));
[FONT=courier new]init() listener:[/FONT]
var FontLibrary:Class = event.target.applicationDomain.getDefinition("_Rockwell") as Class;
Font.registerFont(FontLibrary._Rockwell);
showEmbeddedFonts();
showEmbeddedFonts() function:
var fonts:Array = Font.enumerateFonts();
fonts.sortOn("fontName", Array.CASEINSENSITIVE);
for (var i:int = 0; i < fonts.length; i++)
{
trace(fonts*.fontName + ", " + fonts*.fontStyle);
}
trace output: [FONT=courier new]"_Rockwell, regular"[/FONT]
However, when I try to use it in a different class of that project (after the font has loaded of course) the text disappears (system fonts do show up).
[FONT=courier new]excerpt of class TextItem():[/FONT]
// set text styles
var format : TextFormat = new TextFormat();
format.font = "_Rockwell";
format.bold = false;
format.color = _color;
format.size = _textSize;
_textfield.defaultTextFormat = format;
_textfield.embedFonts = true;
Any ideas as to what I have missed here?