4 Replies Latest reply: Oct 12, 2011 7:45 AM by eprevot123 RSS

    use specific font, swf size too big

    eprevot123 Community Member

      Hi all

       

      I have a pure AS3 project and I want to use a specific font. The problem is when I embed this font, my swf application is too big.


      I saw I can specify unicode range to embed just the characters I need. This seems to be usefull especially for asian fonts but it's a latin font and I need all the letters it contains.

      I saw I can load the font dynamically, but I need it everywhere in the application, from the home page, so I don't know if it's a good idea.

       

      Do you know if there is a way to just embed one size of this font ? (since all my texts are the same size)

      Do you see any other solution to reduce total swf size when using special font ?



        • 1. Re: use specific font, swf size too big
          Andrei1 Community Member

          "I saw I can load the font dynamically, but I need it everywhere in the application, from the home page, so I don't know if it's a good idea."

           

          Once font gets into application domain - you can use it everywhere in your swf

           

          "Do you know if there is a way to just embed one size of this font ?"

           

          Fonts do not have outlines of different sizes - this is the very idea of computer fonts. Size is relevant at runtime only when it is drawn on screen.

          • 2. Re: use specific font, swf size too big
            eprevot123 Community Member

            Once font gets into application domain - you can use it everywhere in your swf

            What I meant is I think you load fonts or other assets dynamically when you don't need it at starting or every time. For example you need the font just if the user clicked some button so you prefer to delay the loading time to when it is needed. Or you have several fonts for several locales, so you just load the one you are interested in when the user changes the locale. But here I would load the font at the starting of the application. Tell me if I'm wrong but in this case, the application won't display faster if I load dynamically the font swf at the application initialization.

             

            Have you heard about font bitmap ? could it help and how ? (the font I use now is .ttf and 500k)

            • 3. Re: use specific font, swf size too big
              Andrei1 Community Member

              Your main application will load faster. Although all-in-all load time (and application initialization) will be reduced a bit (multiple requests for smaller files is a faster approach than one bulky file), still, aggregate size will be the same.

               

              This looks strange to me that the font containing latin characters takes 500K. You should definitely restrict char ranges to only ones you use.

              • 4. Re: use specific font, swf size too big
                eprevot123 Community Member

                something weird : the .ttf is 500k but the swf file is 1300k bigger when I embed the font...

                 

                Anyway, I used the unicodeRange parameter on the embed font, and it's much better : the swf size falls from 1300k to 360k

                I still have to try to load dynamically to see if loading is faster.

                 

                thanks