This is my EnglishFonts.swf application that contains embedded fonts:
package
{
import flash.display.Sprite;
public class EnglishFonts extends Sprite implements IFontApplication
{
[Embed(
source="../../assets/en/segoeprb.ttf",
fontName="Segoe Print",
unicodeRange="U+0048, U+0061, U+0073, U+006E, U+0074, U+003A, U+0030-0039"
)]
public var SegoePrintBold:Class;
public function get fonts():Vector.<Class>
{
return Vector.<Class>([SegoePrintBold]);
}
}
}
In my Flex application, I load this EnglishFonts.swf through the Loader class and try to register the embedded font like this:
var fontsApplication:DisplayObject = loader.content;
var fonts:Vector.<Class> = fontsApplication['fonts'] as Vector.<Class>;
Font.registerFont(fonts[0]);
Font.registerFont() throws this error:
ArgumentError: Error #1508: The value specified for argument font is invalid.
at flash.text::Font$/registerFont()
This error only occurs when I run my application in stand-alone Flash Player. It runs fine in the browser. I couldn’t figure out why this is.