动态字体嵌入和格式化文本流

时间:2014-07-07 05:24:07

标签: actionscript-3 flex tlf textflow

我在运行时加载包含不同字体的多个swf文件。当我将它应用于富可编辑文本中的文本流时,我遇到了问题。任何想法如何将这些自定义字体应用于文本流?

这是我的代码的一部分。

用于注册字体

var FontClass:*;
var dom:ApplicationDomain = response.target.applicationDomain; 
FontClass = dom.getDefinition(fileName) as Class;
Font.registerFont(FontClass);

作品!

将字体应用于文本流。

 var cf:TextLayoutFormat = new TextLayoutFormat();
    cf.fontFamily = mFontName; //Font Name
    cf.fontLookup = FontLookup.EMBEDDED_CFF; 

    var editManager: IEditManager = IEditManager(textflow.interactionManager);
    editManager.applyLeafFormat(cf);

没有崩溃!作品!

但是应用的字体不正确。有任何建议请。

1 个答案:

答案 0 :(得分:0)

IEditManager是一个界面,它什么都不做。您应该使用EditManager

接口不是工作类,它们用于定义一组通用函数,任何实现接口的类,必须创建接口中定义的所有函数的工作版本,否则编译器将失败。进一步阅读here