嵌入字体不会出现
我正在尝试在 FlashDevelop 中嵌入字体。我的文件夹结构是
我的嵌入元数据是
[Embed(source = 'resources/04B08.TTF' , fontName = '04b08')] public var _04b08:Class;
我的代码是
public var titleFormat:TextFormat;
public var titleText:TextField;
private function init(e:Event = null):void
{
// entry point
titleText = new TextField();
titleFormat = new TextFormat();
titleFormat.font = "04b08";
titleFormat.color = 0xFFFFFF;
titleFormat.size = 72;
//titleText.embedFonts = true;
titleText.autoSize = TextFieldAutoSize.LEFT;
titleText.antiAliasType = AntiAliasType.NORMAL;
titleText.defaultTextFormat = titleFormat;
titleText.text = "TEST";
titleText.x = 10;
titleText.y = 10;
addChild(titleText);
}
如果我使用这个,我会得到
但我取消注释 titleText.embedFonts = true;
行,我得到
这是我能找到的所有指南都使用的方法。我应该怎么做才能让它发挥作用?
I'm trying to embed a font in FlashDevelop. My folder structure is
My embed metadata is
[Embed(source = 'resources/04B08.TTF', fontName = '04b08')] public var _04b08:Class;
My code is
public var titleFormat:TextFormat;
public var titleText:TextField;
private function init(e:Event = null):void
{
// entry point
titleText = new TextField();
titleFormat = new TextFormat();
titleFormat.font = "04b08";
titleFormat.color = 0xFFFFFF;
titleFormat.size = 72;
//titleText.embedFonts = true;
titleText.autoSize = TextFieldAutoSize.LEFT;
titleText.antiAliasType = AntiAliasType.NORMAL;
titleText.defaultTextFormat = titleFormat;
titleText.text = "TEST";
titleText.x = 10;
titleText.y = 10;
addChild(titleText);
}
If I use this, I get
But I uncomment the titleText.embedFonts = true;
line, I get
This is the method that all of the guides I can find use. What should I do to get it to work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该尝试一种方法 在使用它之前先注册Font():
另外,尝试其他元数据参数,例如
embedAsCFF='false'
和fontFamily='fontName'
,然后使用titleFormat.font = "fontName";
。为了进行更可靠的测试,请不要在操作系统中安装该字体。
You should try a method registerFont() before using it:
Also, try other metadata parameters like
embedAsCFF='false'
andfontFamily='fontName'
, and then usetitleFormat.font = "fontName";
.For more reliably testing don't have the font installed in your OS.