10 Replies Latest reply on Aug 16, 2012 6:26 AM by sinious

    Fonts Embed issue

    kiranemc2 Level 1

      while iam embedding in air application through flash IDE. iam not able to see the text from where i get numarical numbers. can some one help me regarding this.


        Mystring : <font face="arial" size="20"><b> this is audioTranscript M01L01T01ST01P07P  </b></font>


      View string: this is audioTranscript Sl

        • 1. Re: Fonts Embed issue
          Ned Murphy Adobe Community Professional & MVP

          What process are you following to embed the font?

          • 2. Re: Fonts Embed issue
            kiranemc2 Level 1

            Hi Sir


            Sorry no fonts Displaying. I dont why it is comming .

            I am using below  process (code)  please let me know where i did mistake  below are the points.


            • I have created new Air file with flash IDE and i have loaded fonts.swf
            • after fonts loading completed then i have loaded page1.swf
            • when i   trace(Font.enumerateFonts()[k].fontName)  // Arial, Kruti Dev 010



            Fonts embed Process:

            1. fonts.swf Code


            1. Font.registerFont(hindifont)
            2. Font.registerFont(arial)

            hindifont, arial in library


            Doccument class code :




              import flash.display.Loader;

              import flash.events.Event;

              import flash.net.URLRequest;

              import flash.display.MovieClip;

              import flash.text.Font;

              public class Main extends MovieClip


              private var fonstsURL:String = "fonts.swf";

              private var pagesURL:String = "page1.swf";

              public function Main()


              // constructor code



              private function loadFonts()


              var ldr:Loader=new Loader();


              ldr.load(new URLRequest(fonstsURL));


              private function loadfile(e)






              private function loadpages()


              for (var k in Font.enumerateFonts())




              var ldr:Loader=new Loader();


              ldr.load(new URLRequest(pagesURL));



              private function pagesLoaded(e)








            Page1.swf code

            //dynamic textfield in stage




            • 3. Re: Fonts Embed issue
              lalitha subramanian Level 1

              When your textfield is on stage you can embed the font easily, select the textfield and go to that property and click the embed option there you can see select the character range.you select numerals option then it will display correctly.(This embed option you can get only in cs5,cs5.5 and cs6 not in cs4)

              • 4. Re: Fonts Embed issue
                kiranemc2 Level 1

                Thank's for your reply,


                It is easy for me to embed all the fonts in one fla file, but the problem is I will have multiple fla's for multiple pages. it is be difficult to embed all the fonts in all the files and the size of the swf file will also be increased. I will change the text with different font through xml file at the run time. So, I am trying to load the swf file at the beginning where I have all the fonts embedded.

                • 5. Re: Fonts Embed issue
                  dmeN Level 5

                  You should not need to use registerFont, at least I've not needed it. In order to use an embedded font, you should only need to make a Font object out of it, then use that in a TextFormat. Here's what I do:


                  import flash.text.Font;

                  import flash.utils.getDefinitionByName;



                  var fontClass:Class = getDefinitionByName("libraryFontLinkageName") as Class;

                  var theFont:Font = new fontClass() as Font;


                  var texFormat:TextFormat = new TextFormat();

                  textFormat.font = theFont.fontName;


                  myField.defaultTextFormat = textFormat;

                  • 6. Re: Fonts Embed issue
                    sinious Most Valuable Participant

                    kiranemc2 wrote:


                    Mystring : <font face="arial" size="20"><b> this is audioTranscript M01L01T01ST01P07P  </b></font>


                    You're bolding the font. This can often trigger havoc. You need to embed a font in regular, bold and italic (3 separate fonts and linkages) if you want to do things like that.


                    I suggest you set your linkage names to something other than a built-in font name. Arial is on every machine in existence. Setting embedFonts=true isn't enough to be clear to the machine which font to use. Use names that do not exist as system fonts like:







                    Then instead of using a <b> bold tag, do this:

                    <font face="ArialBold" size="20">this is audioTranscript M01L01T01ST01P07P</font>

                    • 7. Re: Fonts Embed issue
                      kiranemc2 Level 1

                      i followed the steps which you mentioned. But it has given default font name(arial). if we give the same font name then it is showing nornally.

                      but i tried "arialBold" for Bold text. then it is showing empty.


                      what should i do in this case.


                      thanks in advance

                      • 8. Re: Fonts Embed issue
                        sinious Most Valuable Participant

                        A font is embedded as a Class so it should always start with an uppercase letter. That aside, are you using any fonts other than Arial? If not you really don't need to be going through all of this.


                        I'd swoop back and ask yourself, do you really want to embed a font that every computer and device already has? Try removing the embedded Arial font and don't set embedFont=true. Still set the TextFields AntiAliasType.ADVANCED however. Then just use the proper font name and it should use your computer or devices font directly which is much higher performance, especially on mobile devices. You can also use your bold tag again as you were.


                        <font face="Arial" size="20"><b>this is audioTranscript M01L01T01ST01P07P</b></font>


                        A TextFormat object will accept the device fonts name as a string too of course:


                        myTextField.defaultTextFormat = new TextFormat("Arial",20,0x0,true); // device font Arial, size 20, black, bolded

                        • 9. Re: Fonts Embed issue
                          kiranemc2 Level 1

                          I missed one major thing in my previous question, we are providing elearning courses for different local languages, so that we need different font faces,

                          please let me know if there any alternate for this. 

                          • 10. Re: Fonts Embed issue
                            sinious Most Valuable Participant

                            Simply make the font face a variable so you can change it to a font that's supported by other languages. If you're doing online training where the user needs to load your app over the Internet then this is typically a good practice.


                            I've had the unfortunate luck of having clients who both want a very specific non-standard font that needed Traditional and Simple Chinese. The font increased the initial download by 18MB. I'm not happy doing things like this, especially when the app is a promotional experience about a product. A user may sit through your download if it's an online e-learning course but not really for product advertising.


                            Try device fonts you know to contain the glyphs in the style you choose for any particular language first. Arial actually contains them all but it doesn't look like a "good font" to other cultures. I ended up doing this more and more and I typically do it with 13-15 languages. Only Asian and Cyrillic fonts are the bane of my existence. Luckily good old Arial will handle almost all your Latin.