2 Replies Latest reply on Aug 14, 2008 6:50 AM by mlecho

    embeding a font

    mlech0 Level 1
      i am having a bit of an issue trying to get some fonts embeded. It's a bit two fold. The first is in my <mx:Style tag. I have the source pointed at 'css/main.css' and in that dir, a file (called main.css) that has a wanted font declared.
      @font-face
      {
      src:url("../fnt/ArialMT tt");
      fontFamily:"mypro";
      }
      this alone get' me a warning:
      exception during transcoding: Font for alias 'ArialMT tt' with plain weight and style was not found at: file:/Users/me/Documents/Flex Builder 3/Catalog/src/fnt/ArialMT tt

      i have tried to change the path to /fnt/Ar... and ../../fnt but i am pretty sure that the first one (../fnt) is the right one....so, a bit at a loss here....

      Once we get past this, i will ask my question about how to incoporate this font with a dynamic text field created in ActionScript, and not as an mxml markup component.
        • 1. Re: embeding a font
          TheNut007
          To solve your transcoding issue, try changing the font engine. We had the same issues before. In the project compiler settings, add: -managers=flash.fonts.AFEFontManager


          To use the font in a dynamic text box, assume your AS code is the following:

          var textbox:Text = new Text();

          You can assign the text control a style where the font is defined in CSS

          For example:
          textbox.styleName = "myStyle";

          in your "styles.css" file (or whatever you called it), you would have:
          Text.myStyle
          {
          fontFamily: Arial;
          }
          • 2. Re: embeding a font
            mlecho Level 1
            Well, my work around to at least getting acces to the font was placing it into a swf, and then using
            @font-face
            {
            src:url('fnt/FontSWF.swf');
            font-family:'Arial';
            }
            .title
            {
            fontFamily:'Arial';
            }
            that clears me of the error. As for applying it...well, it's more complicated than just using it from a Style tag. While the application has a style tag doing the above, i need to access the font from within a class...not from markup. So, if i have some htmlText pulled in from xml looking like:
            <p class='title'>TEst text</p>, how can i utilize the fonts? attached is my method in the class that creates the text field.