2 Replies Latest reply on May 11, 2010 9:23 AM by Francesco_C

    Rendering runtime loaded fonts

    Francesco_C

      Hi at all (i apologize fot my english)

       

      i've a swc called fonts.swc loaded at rutime with RSL.

      I created the swc with Flash CS5 embedding 'Showcard' font with new Font Panel.

      My flex app loads the fonts.swc fine but the font does not rendered...

       

      protected function init():void

      {

                   var embeddedFonts:Array = Font.enumerateFonts();     

       

                  // ShowCard font is in list!!

       

                   var showcard:Class = systemManager.getDefinitionByName("fonts.ShowcardEmbedded") as Class;
                     
                   Font.registerFont(showcard);
                     
                  myLabel.setStyle("fontFamily", "ShowcardEmbedded");

                 // Font is not rendered in Label spark component.

       

      }

       

      Thanks.

      Francesco_C

        • 1. Re: Rendering runtime loaded fonts
          Flex harUI Adobe Employee

          Make sure the embedAsCFF option is set correctly.  If myLabel is a Flex 4

          Spark Label, embedAsCFF must be set to true, otherwise it must be false.

          • 2. Re: Rendering runtime loaded fonts
            Francesco_C Level 1

            Issue solved.

             

             

             

            // Wrong

            <s:Label text="the lazy dog"

             

                    id="lab"

             

                    fontSize="56"

             

                    fontFamily="ShowcardEmbedded"

             

                    fontLookup="embeddedCFF"

             

                    />

             

             

             

             

            // Correct

             

            protected function init():void
                        {
                            var embeddedFonts:Array = Font.enumerateFonts();
                           
                           var showcard:Class = systemManager.getDefinitionByName("fonts.ShowcardEmbedded") as Class;
                           
                         Font.registerFont(showcard);
                           
                           lab.setStyle("fontFamily", "Showcard Gothic");

             

                        }

             

            <s:Label text="the lazy dog"
                    id="lab"
                    fontSize="56"
                    fontFamily="Showcard Gothic" // I see 'font name' in Debug Panel
                    fontLookup="embeddedCFF"
                    />

             

             

            Thanks