Flash CS5,动态字体嵌入问题
我正在尝试创建带有字体嵌入的动态文本字段。嵌入是动态的,如下所示:
public class TextFormats extends TextFormat {
private var TF:TextFormat = new TextFormat();
[Embed(source = "/fonts/tahoma.ttf", fontWeight = "normal", fontFamily = "tahomaNormal")]
var fontTahoma:Class;
private var fTahoma:Font;
public function TextFormats():void {
fTahoma = new fontTahoma();
}
public function format(fmb:String):TextFormat {
TF.letterSpacing = -1;
TF.font = fTahoma.fontName;
switch(fmb) {
case "combolist_label":
TF.color = 0x383838;
TF.size = 13;
TF.letterSpacing = 0;
break;
}
return TF;
}
}
当我在 flash CS4 中编译它时,嵌入文本很好地出现在舞台上!但是,当我尝试使用 flash CS5 编译它时,文本没有出现,也没有错误警告。
原因是什么?我应该使用其他方法来嵌入字体吗?!
I'm trying to create dynamic textfield with font embedding. Embeding is dynamic like this:
public class TextFormats extends TextFormat {
private var TF:TextFormat = new TextFormat();
[Embed(source = "/fonts/tahoma.ttf", fontWeight = "normal", fontFamily = "tahomaNormal")]
var fontTahoma:Class;
private var fTahoma:Font;
public function TextFormats():void {
fTahoma = new fontTahoma();
}
public function format(fmb:String):TextFormat {
TF.letterSpacing = -1;
TF.font = fTahoma.fontName;
switch(fmb) {
case "combolist_label":
TF.color = 0x383838;
TF.size = 13;
TF.letterSpacing = 0;
break;
}
return TF;
}
}
When I compile it in flash CS4, embeded text appears on stage fine! But, when I tried to compile it with flash CS5, the text do not appear and no error warnings.
What is the reason? Should I use another methods for font embeding?!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有几篇文章介绍了 CS5 中新增的字体嵌入的巨大差异。我认为这个相当不错:
在 Flash CS5 中嵌入字体和 HTML 文本时遇到问题?
嵌入字体的方式是 CS5 中的一项改进 - 但这意味着当您打开 FLA 进行编辑时,所有 CS5 动态文本字段都会损坏在CS5中!太糟糕了! (与在 SWF 中部署一样,一切仍然工作正常。)
如果您在 CS5 中打开 CS4 FLA,则基本上需要重建动态文本字段并重新应用嵌入。
有代码 这里:
There are a few articles published about the big difference in font embedding that is new in CS5. I think this one is quite good:
Having trouble with embedded fonts and HTML text in Flash CS5?
The manner in which fonts are embedded is an improvement in CS5 -- but it means that all your CS5 dynamic text fields break when you open the FLA for editing in CS5! Which sucks! (Everything still works fine as deployed in SWFs.)
If you open the CS4 FLA in CS5, you basically need to rebuild the dynamic text fields and reapply the embedding.
There is code here: