My examples work in Flex 4.5.1, and monkey patching is not straightforward based on my Googling. Looks like no way out without upgrading.
Baz On Tue, Oct 25, 2011 at 12:37 PM, Baz <li...@thinkloop.com> wrote: > Hey Alex, > > I tried changing "Framework Linkage" to "Merged into Code" as well as > checking/unchecking "use local debug runtimes..." without much effect. I'm > reading your blog and piecing out what might apply to me. It's pretty > advanced stuff. The thing is the font is there - if I specify it directly in > RichEditableText it shows up. What is the container doing to TextFlow that I > am not, and how can I mimic that. I've introspected almost every property > and function of TextFlow, FlowComposer, ContainerController, TextFlowLine > and TextLine (I've been on this for many days now :). Judging by the output > of textFlowLine.getTextLine().textBlock.dump(), TLF is just not > aware/registering the font until after the container is rendered. > > If you are curious to see it work and fail side-by-side in a simplified > compilable app, check out: http://dl.dropbox.com/u/480077/FlexTestTLF.zip > > If you run it, you will notice 4 RichEditableTextContainers. The first two > use device fonts (Courier and Arial), and they are interpreted correctly. > The trace of the dump() in the console shows this nicely. The third box, in > red, is the problem. This box tries to employ an embeded font before the > container is rendered, and if you look at the trace, it's not accepting the > font and instead using the default Times New Roman. The fourth box is > exactly the same as the third box, but solves the problem by applying the > truncation at updateComplete, rather than on initialize. The trace shows the > font to be correct as well. > > Do you think all this is related to contexts and multiple swfs as you > describe in your blog? > > Thanks! > > > What do you make of this? Is there a way to mimic what happens to textFlow > on updateComplete but inside initialize? > > On Tue, Oct 25, 2011 at 10:02 AM, Alex Harui <aha...@adobe.com> wrote: > >> ** >> >> >> See the embedded font post on my blog. The control needs to have the >> right SWF context. Does it work if you turn off RSLs? >> >> >> >> On 10/25/11 3:01 AM, "Baz" <li...@thinkloop.com> wrote: >> >> >> >> >> >> >> Hello, >> >> Anyone have any idea why the embedded font in the following basic >> application does not show up? >> >> <?xml version="1.0" encoding="utf-8"?> >> >> <s:Application >> >> xmlns:fx="http://ns.adobe.com/mxml/2009" >> >> xmlns:s="library://ns.adobe.com/flex/spark < >> http://ns.adobe.com/flex/spark> " >> >> xmlns:mx="library://ns.adobe.com/flex/mx < >> http://ns.adobe.com/flex/mx> " >> >> creationComplete="application1_initializeHandler(event)" >> >> minWidth="955" minHeight="600"> >> >> >> >> <fx:Script> >> >> <![CDATA[ >> >> import flash.text.engine.FontLookup; >> >> import flashx.textLayout.elements.TextFlow; >> >> import mx.events.FlexEvent; >> >> import spark.utils.TextFlowUtil; >> >> >> >> [Embed(source="ZemkeHandITCTT.ttf", >> fontFamily="zem", embedAsCFF="true", fontWeight="normal", >> mimeType="application/x-font")] >> >> public const zem_embed_class:Class; >> >> >> >> protected var embeddedFontMarkup:XML = <p >> fontFamily="zem" fontLookup="embeddedCFF"><span>Some content</span></p>; >> >> >> >> protected function >> application1_initializeHandler(event:FlexEvent):void { >> >> var textFlow:TextFlow = >> TextFlowUtil.importFromXML(embeddedFontMarkup); >> >> textFlow.fontFamily = 'zem'; >> >> textFlow.fontLookup = >> FontLookup.EMBEDDED_CFF; >> >> one.textFlow = textFlow; >> >> } >> >> ]]> >> >> </fx:Script> >> >> >> >> <s:RichEditableText id="one" width="500" height="204" >> renderingMode="cff" fontLookup="embeddedCFF" /> >> >> </s:Application> >> >> >> >> I know the font works because if I specify *any* embedded font directly >> in the RichEditableText, the specified embedded fonts shows up. >> >> >> >> Thanks, >> >> Baz >> >> >> >> >> >> >> >> >> -- >> Alex Harui >> Flex SDK Team >> Adobe System, Inc. >> http://blogs.adobe.com/aharui >> >> >> > >