Skip to main content
Known Participant
May 18, 2010
Answered

Font issues after import

  • May 18, 2010
  • 1 reply
  • 788 views

I'm working on an application that uses embedded fonts. After the initial import, the fonts do not render correctly, when I use several fonts.

If after the import I change the font, it works correctly.

Any idea will be truly appreciated.

This topic has been closed for replies.
Correct answer robin_briggs

I'm probably missing something. Here's my code:

textFlow = TextConverter.importToFlow( xml, TextConverter.TEXT_LAYOUT_FORMAT);

textFlow.flowComposer = new StandardFlowComposer();

if( editManager == null && undoManager == null){

     undoManager = new UndoManager();

     editManager = new EditManager( undoManager );

     textFlow.interactionManager = editManager;

     textFlow.interactionManager.selectRange(0,0);

}

textFlow.flowComposer.updateAllControllers();

-------------------------------------------------------------

I replaced "textFlow.flowComposer.updateAllControllers();" with:

var cf:TextLayoutFormat = new TextLayoutFormat();

cf.fontLookup = flash.text.engine.FontLookup.EMBEDDED_CFF;

IEditManager( textFlow.interactionManager ).applyLeafFormat(cf);

but still get the same result. The font doesn't render correctly after the import.


Try this:

textFlow.interactionManager.selectRange(0, textFlow.textLength);

editManager.applyLeafFormat(cf);

Your previous call to applyLeafFormat will only change the text that was imported if it is selected.

If that still doesn't work, please tell me what you are doing to embed the font.

Thanks!

- robin

1 reply

storm767Author
Known Participant
May 18, 2010

note:

When I chnage the font, after the import, I'm using this code:

               var cf:TextLayoutFormat = new TextLayoutFormat();
                cf.fontFamily = 'Mesquite';
                cf.fontLookup = flash.text.engine.FontLookup.EMBEDDED_CFF;

               
                IEditManager( textFlow.interactionManager ).applyLeafFormat(cf);
                textFlow.interactionManager.setFocus();

After the initial import, I do:

               textFlow.flowComposer.updateAllControllers();

Adobe Employee
May 18, 2010

It is necessary when using embedded fonts to set the fontFamily to refer to the embedded font and the fontLookup to specify EMEBEDDED_CFF, as you describe. This can be done on import if the XML sets up the properties this way. Otherwise it must be done after import by resetting the properties, and can be done exactly as you describe with a call to applyLeafFormat. The call to applyLeafFormat will also do the updateAllControllers() for you.

Note that if you are loading the font in a separate SWF, this must be fully loaded and set up first.

If you are still having problems, can you supply a small example that shows it?

Thanks!

- robin

storm767Author
Known Participant
May 19, 2010

I'm probably missing something. Here's my code:

textFlow = TextConverter.importToFlow( xml, TextConverter.TEXT_LAYOUT_FORMAT);

textFlow.flowComposer = new StandardFlowComposer();

if( editManager == null && undoManager == null){

     undoManager = new UndoManager();

     editManager = new EditManager( undoManager );

     textFlow.interactionManager = editManager;

     textFlow.interactionManager.selectRange(0,0);

}

textFlow.flowComposer.updateAllControllers();

-------------------------------------------------------------

I replaced "textFlow.flowComposer.updateAllControllers();" with:

var cf:TextLayoutFormat = new TextLayoutFormat();

cf.fontLookup = flash.text.engine.FontLookup.EMBEDDED_CFF;

IEditManager( textFlow.interactionManager ).applyLeafFormat(cf);

but still get the same result. The font doesn't render correctly after the import.