Skip to main content
Known Participant
May 30, 2011
Question

Unable to load embedded fonts in Textlayout Framework using SWFContext.

  • May 30, 2011
  • 1 reply
  • 4222 views

Hi,
    We are having issues with embedding/renderring fonts in swf.
   
    Here is the code of the slide1.swf compiled by mxmlc.exe [Adobe Flex Compiler (mxmlc) Version 4.1.0 build 16076] with compiler parameters --  "-static-link-runtime-shared-libraries".

and checked with  Flash player version 10.1 and 10.2 and 10.3.
   
    package
    {
        import flash.display.Sprite;
        import flashx.textLayout.compose.ISWFContext;
       
        public class Slide1 extends Sprite implements ISWFContext
        {
            [Embed(source="C:/WINDOWS/FONTS/CALIBRI.TTF", fontName="Calibri", embedAsCFF = "true", unicodeRange="U+0041,U+0072,U+0069,U+0061,U+006C,U+0020,U+004E,U+006F,U+006D", mimeType="application/x-font")]
            public static const calibri:Class;
           
            [Embed("slide1/sldBg1.png", mimeType="image/png")]
            public static const bg:Class;
           
            [Embed("slide1/slide1.xml", mimeType="application/octet-stream")]
            public static const slide:Class;
           
            public function callInContext(fn:Function, thisArg:Object, argsArray:Array, returns:Boolean=true):*
            {
                if (returns)
                return fn.apply(thisArg, argsArray);
                fn.apply(thisArg, argsArray);
            }
        }
    }
   
   
    Using Flex 4.1 SDK:--
   
        When I load the slide1.swf in ActionScript Project it shows the embedded text.
   
        But, when I load the slide1.swf in  MX+Spark Flex Project, it gives an error :
       
        Warning: An ActionScript 1.0/2.0 SWF file has loaded an ActionScript 3.0 SWF; code in the ActionScript 3.0 SWF will not run.


       Error TypeError: Error #1034: Type Coercion failed: cannot convert Slide1@f56fce9 to mx.core.IFlexModuleFactory. !

        Below red colored text is the code where the exception occurs.
   
        var fontClass:Class = ApplicationDomain.currentDomain.getDefinition("slide1") as Class;
   
      textFlow.flowComposer.swfContext = new fontClass();
   
        textFlow.flowComposer.addController(new ContainerController(textContainer, containerWidth, containerHeight));   
        textFlow.flowComposer.updateAllControllers();           
           
   
        And, when I load the slide1.swf in Only MX Flex Poject, it shows the embedded Font.
   
   
    Using Flex 4.5 SDK:--
       
        With MX+ Spark and MX only Flex Project we get following errors
       
        VerifyError: Error #1053: Illegal override of createGeometry in flashx.textLayout.elements.FlowGroupElement.
        VerifyError: Error #1053: Illegal override of canReleaseContentElement in flashx.textLayout.elements.SubParagraphGroupElement.
        VerifyError: Error #1103: Class flashx.textLayout.elements::LinkElement cannot extend final base class.
        VerifyError: Error #1053: Illegal override of display in flashx.textLayout.elements.ContainerFormattedElement.
        VerifyError: Error #1053: Illegal override of canReleaseContentElement in flashx.textLayout.elements.FlowLeafElement.
        VerifyError: Error #1053: Illegal override of addParaTerminator in flashx.textLayout.elements.SpanElement.
        VerifyError: Error #1053: Illegal override of canReleaseContentElement in flashx.textLayout.elements.InlineGraphicElement.
        VerifyError: Error #1053: Illegal override of minPercentValue in flashx.textLayout.property.NumberOrPercentProperty.
        VerifyError: Error #1053: Illegal override of hash in flashx.textLayout.property.EnumStringProperty.
        VerifyError: Error #1053: Illegal override of hash in flashx.textLayout.property.BooleanProperty.
        VerifyError: Error #1053: Illegal override of minValue in flashx.textLayout.property.NumberProperty.
        VerifyError: Error #1014: Class flashx.textLayout.property::NumberProperty could not be found.
        VerifyError: Error #1053: Illegal override of minValue in flashx.textLayout.property.IntProperty.
        VerifyError: Error #1014: Class flashx.textLayout.property::IntProperty could not be found.
        VerifyError: Error #1053: Illegal override of hash in flashx.textLayout.property.UintProperty.
        VerifyError: Error #1014: Class flashx.textLayout.property::UintProperty could not be found.
        VerifyError: Error #1053: Illegal override of hash in flashx.textLayout.property.StringProperty.
        VerifyError: Error #1014: Class flashx.textLayout.property::NumberOrPercentProperty could not be found.
        VerifyError: Error #1053: Illegal override of hash in flashx.textLayout.property.ArrayProperty.
        VerifyError: Error #1103: Class flashx.textLayout.elements::TCYElement cannot extend final base class.
        VerifyError: Error #1053: Illegal override of createTextLine in flashx.textLayout.compose.ComposeState.

This topic has been closed for replies.

1 reply

Adobe Employee
May 31, 2011

It seems the same situation as http://forums.adobe.com/thread/855756?tstart=0

Known Participant
May 31, 2011

Hi Jin-Huang

          But when I use Simple ASProject with SDK 4.1 then it works fine but when I create Flex project then it give error

with SWFContext.

I think it's a issue of swfcontext or AS comunication with Spark components.

Please let me know if any solution.

Thanks

Adobe Employee
May 31, 2011

I think it's better to ask all your questions above on http://forums.adobe.com/community/flex/flex_general_discussion, including the Spark issue and the SDK 4.5 issue. It's a good report.