2 Replies Latest reply on Feb 18, 2011 8:34 AM by robglobal

    Embedded fonts as .swfs not working with Spark theme?

    robglobal

      Someone posted a similar thread to this sometime ago, but it looks like it wasn't answered:

       

      http://forums.adobe.com/message/2356428#515648

       

       

      The question remains for me still. I need to load Adobe PostScript fonts at run-time for different clients. I can really only find updating docs on embedded your fonts as TTF files.

       

      Before I switched from the Halo theme to Spark theme, this method of embedding Post Script fonts was working fine for me:

       

       

      @namespace mx "library://ns.adobe.com/flex/mx";
      @namespace s "library://ns.adobe.com/flex/spark";

       


      @font-face {


          src:url("assets/fonts/HelveticaNeue.swf");
          font-family: "Helvetica Neue";
          font-weight: bold;

       


      }

       

       

      mx|Button.primary

      {

           font-family: "Helvetica Neue";

       

      }

       

       


      I am using the MXML compiler to compile a CSS file into a swf, and then I use loadStyleDeclarations(*.swf) to load it at run time.

       

       

      If I embed a TTF font, it shows up fine, for example:

       

       

      @font-face
      {
          src:url("assets/fonts/RAVIE.TTF");
          font-family: Ravie;
          font-weight: normal;
          embedAsCFF: true;
      }

       

       

       

      So basically I have isolated the problem to fonts that are embedded as SWFs, and then compiled into a style SWF to be loaded at runtime.

       

      Has anyone encountered this, and found a resolution to it?

       

      Thanks in advance.

        • 1. Re: Embedded fonts as .swfs not working with Spark theme?
          Flex harUI Adobe Employee

          If you are using mx components with their default TextFields, then

          embedAsCFF must be false, otherwise it must be set to true.  There may be

          limitation on how the font get into the SWF.  It may not have the right

          information to allow it to be used as a CFF font.  You might need the latest

          CS5 version to generate the SWF.

           

          I thought you could embed postscript fonts just like TTF files, but I could

          be wrong about that.

          1 person found this helpful
          • 2. Re: Embedded fonts as .swfs not working with Spark theme?
            robglobal Level 1

            Thanks, so I have figured this much out thus far:

             

             

            I can only embed PostScript fonts by putting them in a SWF, and I don't have CS5 to test for the CFF property/option.

             

            However, I went into my project properties and unchecked the option to: "Use Flash Text Engine in MX Components", and now my postscript fonts are showing up again.

             

             

            Eventually I am going to upgrade all of my text controls to spark so I will test out CS5 and Post Script fonts then.

             

            I must admit, the embedAsCFF can be pretty confusing at first. I had fonts embedding correctly, but then my text inputs weren't editable at all. But removing that checkbox fixed it all for me, for now. Thanks.