5 Replies Latest reply on Dec 1, 2009 9:09 PM by Flex harUI

    embedding font from swf not working on external computer

    Mike6679

      Hi,

       

      I am;

       

      1.  embedding a font in a swf

       

      2. Embedding the swf in Flex and wrapping it in a class file:

       

       

      Main App File:

       

       

       

      import action.fontslib.EmbedFontsLibrary;

       

       

       

       

      Font Class File

       

      /* EmbedFontsLibrary.as

       

      o PURPOSE: Need this class to wrap our font embeds

      o NOTE: In future can add each embed to an array to reference

      */

       

       

      package

      action.fontslib

      {

       

      import flash.text.Font;

       

       

      public final class EmbedFontsLibrary

      {

       

           //public static var Fonts:Array = new Array();

       

       

       

          

       

           [Embed(source="fonts/Frutiger.swf", fontName="Frutiger 55 Roman",

           fontStyle=

      "75 Black", fontWeight="bold")]

       

           public static var Frutiger75Black28:Class;

       

       

           //Fonts.push(Frutiger75Black28);

       

       

      }

      }

       

      3. Now my css file can reference  the font family:

       

       

      .TextTitleBlue

      ,.TextTitleRed

      {

       

       

      fontFamily: "Frutiger 55 Roman";

       

      font-weight: bold;

       

      fontSize: 28;

       

      /*fontAntiAliasType: normal ;*/

       

      color: #EE8011; /* orange */

      }

       

       

      4. Also I embed from skins from other swfs (** and these swfs also contian the Frutiger font )

       

       

      Ok so all works well on my machine, I see the font no problem and even when I remove the font from my system I STILL see the font. Now the problem is when my compiled Flex app is run on another system, I do NOT see my Frutiger font. What can I look for that could be the potential problem here??

       

      thank you!

       

      -Mike

        • 1. Re: embedding font from swf not working on external computer
          Flex harUI Adobe Employee

          I'm not sure the fontStyle you are using is supported.

           

          You might want to verify that the SWF really is using embedded fonts by checking the internal textFields in the debugger to see if they have embedFonts = true.

           

          Alex Harui

          Flex SDK Developer

          Adobe Systems Inc.

          Blog: http://blogs.adobe.com/aharui

          • 2. Re: embedding font from swf not working on external computer
            Mike6679 Level 1

            Well, I run my swf on its own after removing the font from my sytem and I do see my Frutiger font, so it looks like font is embedded in the swf. However, in debug mode in Flex, I see:

             

            inheriting styles
               embedFonts = false

             

            for my Text field.

             

            Now the question is, am I embedding incorrectly or is my font just not supported? How do I find out which fonts ARE supported for embedding in Flex?

             

            thx

             

            -Mike

            • 3. Re: embedding font from swf not working on external computer
              Flex harUI Adobe Employee

              If Flex reverts to using device fonts, even if the font is removed, the system may know enough to approximate or have it cached somewhere.

               

              However, the styles don't matter, what really matters is what the inner TextField's embedFont property is.  There's a lot of code that runs to figure out how to set it.

               

              In general, I think the fontStyle has to be italic or normal and fontWeight has to be bold or normal and the fontStyle and fontWeight have to match the styles on the component.  Lots of folks have problems if they don't embed a bold font but are using bold for display and vice versa.

               

              Alex Harui

              Flex SDK Developer

              Adobe Systems Inc.

              Blog: http://blogs.adobe.com/aharui

              • 4. Re: embedding font from swf not working on external computer
                Mike6679 Level 1

                Ok given what you stated I did the following:

                 

                1 Embedded my Frutiger font using Flash CS3 (simply Frutiger 55 Roman & bold)

                 

                2.My css looks like this:

                 

                @font-face
                    {
                        src:url("../fonts/Frutiger1.swf");
                        fontFamily: "Frutiger 55 Roman";
                        fontStyle: normal;
                        fontWeight: bold;
                    
                   /*fontStyle: normal;*/
                    }
                   
                    
                   
                    .TextTitleBlue
                    {
                        font-size: 28px;
                        font-family: "Frutiger 55 Roman";
                        font-Style: normal;
                        font-weight: bold;
                        /*
                        font-Style: "75 Black";
                       
                        fontFamily: "Frutiger 55 Roman";
                        font-weight: bold;
                        fontStyle: normal;
                        fontSize: 28;
                        fontAntiAliasType: normal ;*/

                        color: #EE8011; /* orange */
                       
                    }

                 

                The result is that nothing shows up (not even a system substitute font). If I change my font-family to Arial in the TextTitleBlue class of course the text will show, so obviously its a problem with my font. I even tried taking out  " font-Style: normal; font-weightBut" out of my TextTitleBlue class but still no luck. You said if I simply have fontStyle as  italic or normal and fontWeight as  bold or normal it should work right?....

                 

                thx

                 

                -Mike

                • 5. Re: embedding font from swf not working on external computer
                  Flex harUI Adobe Employee

                  When you switch to Arial, we still don't know if it is using device fonts or not.  I still think that is worth verifying.

                   

                  Another I would do is make sure you are embedding the correct font.  If you're saying that fontWeight is bold, make sure it is really a bold font.

                   

                  And if you are using Flex 4, make sure you have the correct embedAsCFF value

                   

                  Alex Harui

                  Flex SDK Developer

                  Adobe Systems Inc.

                  Blog: http://blogs.adobe.com/aharui