hey all,
I’m using an external .swf file to hold a few fonts.
I then successfully import these fonts into my project .swf.
If I publish the empty project .swf (meaning nothing on stage) and run the following script only (triggered by an onLoad listener),
var info:LoaderInfo = e.currentTarget as LoaderInfo;
var loader:Loader = info.content as Loader;
embeddedFonts = Font.enumerateFonts(false);
embeddedFonts.sortOn("fontName", Array.CASEINSENSITIVE);
for(var i:Number = 0; i < embeddedFonts.length; i++)
{
var item:Font = embeddedFonts*;
var temp = [item.fontName, item];
trace("[" + i + "] name:" + item.fontName + ", style: " + item.fontStyle + ", type: " + item.fontType);
}
I get a trace that looks like this and contains all of the correct fonts.
[0] name:Arial, style: italic, type: embeddedCFF
[1] name:Arial, style: bold, type: embeddedCFF
[2] name:Arial, style: boldItalic, type: embeddedCFF
[3] name:Arial, style: regular, type: embeddedCFF
[4] name:Trebuchet MS, style: bold, type: embeddedCFF
[5] name:Trebuchet MS, style: regular, type: embeddedCFF
[6] name:Trebuchet MS, style: italic, type: embeddedCFF
[7] name:Trebuchet MS, style: boldItalic, type: embeddedCFF
The problem is when I put a textfield (doesn’t matter what type) on the stage.
Let’s say I create a field using Arial, regular text. I choose to antialias the text. The above list will contain a duplicate Arial font. If I choose the device font setting for the text field (no antialias), the font isn’t duplicated in the list, but the font looks like crap b/c it’s not antialiased.
I checked the file size in the bandwidth profiler in both cases, and yes, it seems that the enumerateFonts() does indeed embed the same font twice in this instance.
Dynamically creating textfields and setting their properties to embedFonts = true works perfectly.
How do I fix the issue with authored textfields?