0 Replies Latest reply on Jul 7, 2014 2:48 AM by Bhaashu

    Textflow and custom dynamic fonts

    Bhaashu Level 1

      Hello all,
      I am creating a browser based editor application using the Rich Editable Text control. I have a user defined set of fonts in different swf files. I am loading those swf files at run-time. Here is the part of code below.

       

      // Registers the fonts :

       

      I have loaded swf file at run time using the Loader and then registered the loaded font to global font list.

       

        var FontClass:*;

        var dom:ApplicationDomain = event.target.applicationDomain;

        FontClass = dom.getDefinition(fileName) as Class;

        Font.registerFont(FontClass);

       

      /* This works Fine !!! */

       

      Now  I am trying to apply the loaded font to textflow with the code :

       

       

        var cf:TextLayoutFormat = new TextLayoutFormat();

        cf.fontLookup = FontLookup.EMBEDDED_CFF;

        cf.renderingMode = RenderingMode.CFF;

        cf.fontSize = mFontSize;

        cf.fontFamily = mFontName;

        var editManager: IEditManager = IEditManager(mTxtFlow.interactionManager);

        editManager.applyLeafFormat(cf);

       

      So, far I am using the device fonts its working fine and I am able to apply the font and  when I am applying the custom font its not being applied but when I am exporting thetextflow, it returns me the applied font name (i.e. custom font name I applied above).

       

      One more question I would like to ask. I have different swf files (with same name and different url) for a single font with different styles like ClearviewATT-Regular,ClearviewATT-Bold,ClearviewATT-BoldItalic,ClearviewATT-Light. What will Flex do in this case, because for Flex all swf files having same name. Would it register the first swf only , all the swf's or the last one? What should I do in this case.

       

      Please Help.