开发者

AS3 Embedded font won't show up

Using FlashDevelop with the Flex SDK, I'm trying to embed 开发者_JAVA技巧a font in the swf file, using the following code:

[Embed(source = '/asset/Frutiger-Normal.ttf', fontName = 'Frutiger')]
public static var Frutiger:Class;

(...)

var textField:TextField = new TextField();
textField.embedFonts = true;
textField.defaultTextFormat = new TextFormat('Frutiger', 12, 0x000000);
textField.text = "Hello World!";
stage.addChild(textField);

But for some reason, the text won't show up in the embedded font. When 'embedFonts' is set to false, the text will be visible, but in the default font.

The font itself should load, when I change the path to the font to an incorrect one, the compiler throws an exception, so it should be ok.


You need to register the font.

[Embed(source = '/asset/Frutiger-Normal.ttf', fontName = 'Frutiger')]
public static var Frutiger:Class;
Font.registerFont(Frutiger);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜