开发者

Flex: Embedding fonts at runtime only works locally?

开发者 https://www.devze.com 2023-01-17 05:32 出处:网络
I\'m trying to change the text format in a TextField I get from a .swf. I\'m embedding my font in a myFont.swf:

I'm trying to change the text format in a TextField I get from a .swf. I'm embedding my font in a myFont.swf:

public class TemplateFont extends Sprite { [Embed(source='../fontFiles/geogrotesque/Geogrotesque-Regular.ttf', fontName='theFontName')] public static var FONT_TEXT:Class; }

Then I'm loading it where I need it and registering it:

var FontLibrary:Class = e.target.applicationDomain.getDefinition("TemplateFont") as Class; Font.registerFont(FontLibrary.FONT_TEXT);

And then I'm trying to set the format to my Textfield: txtTitle.embedFonts = true; txtTitle.antiAliasType = AntiAliasType.ADVANCED; var titleFormat:TextFormat = txtTitle.getTextFormat(); //TextFormat is set in swf, just wanna change font at runtime.

titleFormat.font = "theFontName; txtTitle.htmlText = ti开发者_Go百科tle; //coming from xml sorrunded with CDATA txtTitle.defaultTextFormat = titleFormat; txtTitle.setTextFormat(titleFormat);

This all works fine when I'm running it on my computer, but as soon as I place my files on a server nothing shows. When I'm tracing the htmlText for the TextField it looks fine, but no text is showing up. I'm also tracing the registered fonts to see that they are there, and they are.

Anybody knows?


Two things:

  1. The EULA of this font don't allowed to upload the font to a server.
  2. Have you a legal copy of Geogrotesque? We only sell Open Type format (OT), but not True Type (TTF).

If you have doubts about this, please contact with Emtype.

0

精彩评论

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