2 Replies Latest reply on Jul 30, 2015 6:05 PM by kawikaheftel

    How do I embed a font on FB4.7 for mobile

    goodnewsjim Level 1

      Hello,

       

      I'm using the Andalus font, and everything worked fine with the emulator so I didn't think I'd have to be concerned with what it looked like on my Nexus 7.

      But when I used it on Nexus 7, it was using a default font instead of Andalus.

       

      How do I embed?

       

      I tried:

      [Embed(source="./assets/fonts/andlso.ttf",
      fontName="Andalus",
      mimeType="application/x-font",
      fontWeight="normal",
      fontStyle="normal",
      unicodeRange="englishRange",
      advancedAntiAliasing="true")]
      private var myEmbeddedFont:Class;

       

      But I got an error:"invalid Unicode range 'ENGLISHRANGE'"

       

      I browsed the web for help, and it had me editing up my AIR SDK files, but that didn't work at all.

       

      Anyone have help?   This should be easy to do.  I must be missing something.

        • 1. Re: How do I embed a font on FB4.7 for mobile
          goodnewsjim Level 1

          I spent about 2 hours aligning the Andalus font up on my video game "Throne and Crown."  I don't want to be forced to use Times New Roman.

           

          I'm using Air 17.0

           

          Anyone with even ideas on what to check will be appreciated.  I don't think I can use CSS because MXML slows games on mobile.

           

          Again any help big or small is appreciated since I've exhausted Google searches of this.

          • 2. Re: How do I embed a font on FB4.7 for mobile
            kawikaheftel Level 3

            Here is how I embed a font in my iOS application using FB 4.7:

             

            [Embed(source="../../../embed/doctor_soos_bold_3.0.ttf", fontName="DoctorSoosBold", mimeType = "application/x-font-truetype", embedAsCFF="false")]
              protected static var DR_SOOS_FONT:Class;
            

             

            I think the embedAsCFF="false" line is important, though I'm not sure why.

             

            When I need to use it in a textfield, I set fontName="DoctorSoosBold".  I'm using Starling and Feathers, but under the hood it uses a native Flash Textfield, so I'm also using regular TextFormat objects.  To use it with a native flash textfield I think you just assign the TextFormat to tf.defaultTextFormat:

            tf.defaultTextFormat = new TextFormat("DoctorSoosBold", 20, 0xFFFFFF);
            tf.text = "Hello world!"