0

I am loading multiple swf files containing the different fonts at run-time. I am having problem when I am applying it to textflow in Rich Editable Text. Any Idea how to apply those custom fonts to the textflow ?

Here is the part of my code.

For registering the fonts

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

Works!

For applying the font to textflow.

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

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

No crash! Works!

But the applied font is not correct. Any suggestion please.

1 Answers1

0

IEditManager is an interface, it doesn't do anything. You should be using EditManager.

Interfaces are not working classes, they used to define a common set of functions, any class that implements an interface, has to create working versions of all functions defined in the interface, or the compiler will fail. Further reading here

CyanAngel
  • 1,240
  • 1
  • 14
  • 28
  • Thanks for answering it but It didn't work.The problem is with applying custom fonts to TextFlow. If I am applying the device font (e.g. Segoe) with the same code, it works correctly. I have user defined set of Fonts and I have embedded them to different swf's. I am able to load and embed the swf into my application but they are not applying to the textflow. For example I have a font clearviewATT, I have different swf files for its different styles (e.g.bold,regular,bolditalic,light etc)when I am applying the font to the textflow, it seems that the text is formatted to the default font family. – user3805327 Jul 07 '14 at 09:09
  • Add this detail to your question, all information is helpful – CyanAngel Jul 07 '14 at 09:12