6 Replies Latest reply on Dec 3, 2009 12:55 PM by Mike6679

    Embedding Font from swf Error

    Mike6679 Level 1

      Hey, I'm tring to embed a postscript font called Frutiger with a style of "75 Black". I  use Flash and add a dynamic text box with said font (with some text) and then embed  the font then export the swf. In Flex I create a css file with:

       

      @font-face
          {
              src:url("../fonts/Frutiger1.swf");
              fontFamily: "Frutiger" ;
         
           }

       

      I have also  tried  Frutiger 55 Roman, Frutiger 75 Black for the fontFamily name, however I keep getting the same error:

       

      font 'Frutiger' with normal weight and regular style not found.

       

       

      I even tried using flash cs3 as I read that it doesn't have problems with fonts like cs4 does, but flash cs3 couldn't even display Frutiger with a style of "75 Black" in the font list. the I have read so many  forums on this and tried so many work arounds but to no avail. Has anybody solved this??

       

      thanks in advance....

       

      -Mike

        • 1. Re: Embedding Font from swf Error
          Flex harUI Adobe Employee

          Try this syntax instead:

              [Embed(source="embedfonts.swf", fontName="Freestyle Script", fontStyle="italic", fontWeight="bold")]

              public static var freestyleBoldItalic:Class;

          • 2. Re: Embedding Font from swf Error
            Mike6679 Level 1

            Thanks. I'll give that a shot .  What is "freestyleBoldItalic" for?

            • 3. Re: Embedding Font from swf Error
              Flex harUI Adobe Employee

              It is the class that is assigned the Font.  has to precede some AS variable definition.  You can use any name you want there.  The fontName in the tag is what you reference in your CSS.

              • 4. Re: Embedding Font from swf Error
                Mike6679 Level 1

                That definitely helped! The other thing was that the Font name HAD to be the exact name of the font...for example in  Flash,  the font name was simply "Frutiger" but when I looked at the font name on my system it was 'Frutiger 55 Roman"   with a weight of bold.

                 

                 

                [Embed(source="fonts/Frutiger.swf", fontName="Frutiger 55 Roman", fontStyle="75 Black", fontWeight="bold")]
                public static var Frutiger75Black28:Class;

                 

                then I referenced the 'Frutiger 55 Roman" name in my css file.

                 

                thanks  Flex harUI!

                • 5. Re: Embedding Font from swf Error
                  Mike6679 Level 1

                  I had this working at one point but it only ever  works inconsistently at best. Sometimes I had to make sure I built my css file  before the file that used the style  and then it would work.   Right now I can't get it to work at all. I am embedding a font from a swf and I can see in design mode in Flex but when I run the app the font does not show up!.   Now.... I am also embedding other assets from other swfs that also have the same font in them.......could there possibly be a conflict? What else can I look for that would possibly prevent me from seeing my font at runtime??

                   

                  Thank you!

                   

                  -Mike

                   

                   

                  In my main app mxml:

                   

                   

                   

                  //---FONTS ---

                   

                   

                   

                  //---Frutiger 75 Black---

                  [

                  Embed(source="fonts/Frutiger.swf", fontName="Frutiger 55 Roman", fontStyle="75 Black", fontWeight="bold")]

                   

                  public static var Frutiger75Black28:Class;

                   

                   

                  //---END: FONTS

                   

                   

                  CSS:

                   

                  .TextTitleBlue

                  {

                   

                   

                   

                       fontFamily: "Frutiger 55 Roman";

                   

                       fontWeight: bold;

                   

                       fontSize: 28;

                   

                       /*fontAntiAliasType: normal ;*/

                   

                   

                       color: #EE8011; /* orange */

                  }

                   

                   

                   

                   

                   

                   

                  • 6. Re: Embedding Font from swf Error
                    Mike6679 Level 1

                    FYI

                     

                    I ended up just importing MovieClip and Buttons directly from a swf in order to get my Frutiger font as it turns out Flex just doesn't handle it well. I could not find out excactly what fonts are suported in Flex. But basicaly as I understand it, if your font is bold in the swf your Flex css should be set to

                    fontWeight: bold;  as well and same goes for normal weight. In the case of Frutiger, bold just did not work. ALSO I still had to build the css file first THEN the mxml files that referenced the font classes in the css otherwise they just did not show up. I hope the next version of flex handles fonts better...

                     

                     

                    //styles.css

                     

                    @font-face

                     

                     

                     

                     

                    {

                     

                     

                     

                     

                    src:url("../fonts/helvetica.swf");

                     

                    fontFamily: "Helvetica 55 Roman";

                     

                    fontWeight: bold;

                    }