Skip to main content
Inspiring
June 1, 2010
Question

Weird issues with embedded fonts and TLF

  • June 1, 2010
  • 1 reply
  • 2708 views

Hello all,

I am working on a fairly complex designer tool that allows the user to add text items to a stage and manipultate the text wysiwyg style.

I have it all working well, and the textflow info is saved to the database through a webservice.  However I am experiancing an odd issue.

This is the code I am using to load up the textflow:

                GlobalSettings.resolveFontLookupFunction = null;
                var tf:TextFlow = TextFlowUtil.importFromXML(res.children()[0],"preserve");
                tf.renderingMode = RenderingMode.CFF;
                tf.fontLookup = FontLookup.EMBEDDED_CFF;
                txt.textFlow = tf;
                txt.textFlow.invalidateAllFormats();

txt is my richeditabletext object.

When my stored textflow calls for an embedded font, it wont render properly the first time, it just falls back to the ugly default font, then If I trigger the above code a second time, replacing the textflow again, the correct font appears.  Does anyone see anything in my code that is wrong?

Thanks

Jason

This topic has been closed for replies.

1 reply

Aaronius9er9er
Inspiring
June 2, 2010

Are you sure your font is loaded by the time the code you pasted is run for the first time?  If not, I think you'll have to call txt.textFlow.invalidateAllFormats(); again after the font is loaded.

box86rowhAuthor
Inspiring
June 2, 2010

The first thing my app does is load in all my designer fonts.  Then during this debugging time, I have it alert me that they are 100% loaded, then when they are, I go the area of the app that generates these text items.  So they are not created at all before the font loads.

Adobe Employee
June 4, 2010

Suggest reading Alex's blog on Flex and fonts.

http://blogs.adobe.com/aharui/2010/03/flex_and_embedded_fonts.html

I'm not sure this will help with your situation.  I'm guessing you are using Flex.  Messing with the global resolvefontlookup function will definitely cause issues for Flex.  If you aren't using Flex this function should be null already.

Possibly it would be better to leave resolvefontlookup alone, let flex manage the fonts and set flowComposer.swfContext to UIComponent.getFontContext as ISWFContext.

Other than that sample code demonstrating the problem would be useful.

Hope that helps,

Richard