3 Replies Latest reply on Aug 9, 2011 1:56 PM by Seglespaan

    embedding fonts

    Seglespaan Level 1

      Hi,

       

      I've created an fla file with the following code on the first frame of the actions layer.

       

      [Embed(source='verdana.ttf', fontFamily='Verdana', fontName='Verdana', fontWeight="normal", mimeType="application/x-font-truetype", unicodeRange='U+0020-U+002F,U+0030-U+0039,U+003A-U+0040,U+0041-U+005A,U+005B-U+0060,U+006 1-U+007A,U+007B-U+007E, U+00A3')]

      var verdana:Class;

       

      [Embed(source='verdanabd.ttf', fontFamily='Verdana', fontName='Verdana',  fontWeight="bold", unicodeRange='U+0020-U+002F,U+0030-U+0039,U+003A-U+0040,U+0041-U+005A,U+005B-U+0060,U+006 1-U+007A,U+007B-U+007E, U+00A3')]

      var verdanaBold:Class;

       

      [Embed(source='verdanai.ttf', fontFamily='Verdana', fontName='Verdana', fontWeight="normal", fontStyle='italic', mimeType="application/x-font-truetype", unicodeRange='U+0020-U+002F,U+0030-U+0039,U+003A-U+0040,U+0041-U+005A,U+005B-U+0060,U+006 1-U+007A,U+007B-U+007E, U+00A3')]

      var verdanaItalic:Class;

       

      [Embed(source='verdanabi.ttf', fontFamily='Verdana', fontName='Verdana',  fontWeight="bold", fontStyle='italic', unicodeRange='U+0020-U+002F,U+0030-U+0039,U+003A-U+0040,U+0041-U+005A,U+005B-U+0060,U+006 1-U+007A,U+007B-U+007E, U+00A3')]

      var verdanaBoldItalic:Class;

       

      Font.registerFont(verdana);

      Font.registerFont(verdanaBold);

      Font.registerFont(verdanaItalic);

      Font.registerFont(verdanaBoldItalic);

       

       

      however when I load it into my application and apply the font to a text area I'm not able to display any special characters such as ()%#$% in the text area.

       

      the code I'm using to load it into my app is

       

      loader.load(new URLRequest("http://79.170.43.156/~surfprin/flex_designer/assets/fonts/Vz.swf"));

       

      should I be doing something ele to make special chars available to me?

       

      Thanks

       

      TIm

        • 1. Re: embedding fonts
          Flexpadawan

          Here is a sample I used my my CSS files that allowed special characters.

           

          src: url("fonts/MyriadPro-Regular.otf");
              unicode-range:
              U+0020-U+0040, /* Punctuation, Numbers */
              U+0041-U+005A, /* Upper-Case A-Z */
              U+005B-U+0060, /* Punctuation and Symbols */
              U+0061-U+007A, /* Lower-Case a-z */
              U+007B-U+007E; /* Punctuation and Symbols */
                         
              fontFamily: "MyriadPro-Regular";   
              advancedAntiAliasing:     true;
              font-anti-alias-type:   advanced;

          • 2. Re: embedding fonts
            Flex harUI Adobe Employee

            How are you applying the font to the textarea?  Which TextArea and which

            version of Flex?

            • 3. Re: embedding fonts
              Seglespaan Level 1

              Thanks flex padawan, I'll give it a go.

               

              harUI, I'm binding the font family like this

               

              fontFamily="{dataModel.font}"

               

              so on change of my font selector I update the datamodel and it's applied the the selected text area.

               

              but for some reason special chars don't work

               

              Tim