0 Replies Latest reply on Oct 30, 2013 6:30 AM by brentsmith

    Device Fonts such as Wingdings

    brentsmith

      Hello,

       

      I'm trying to get a user's device fonts to be applied to Closed Captions to meet an upcoming FCC requirement. I'm able to use Font.enumerateFonts(true) to get a list of fonts on the device but once I have this list of font I'm unable to use it. As an example I was trying to use Wingdings, which I have on my device but when I set it using StyleSheet or FontFormat the font was falling back to one of the base fonts.

       

      I noticed that the YouTube Captions (in flash only) allow a user to select a font on their system and it seems to work (I tried it with Wingdings and several obscure fonts I have locally). After much googling and testing I've been unable to come up with a good way to do this. Is there something you can recommend I try?

       

       

      Here's an example (remove the "W" conditional to see most device fonts render):

       

      private function onAddedToStage(e:Event):void{

           var offset:Number = 0;

           var fonts:Array = Font.enumerateFonts(true);

        for each(var font:Font in fonts)

           {

                if (font.fontName.charAt(0) == "W")

                {

       

                     var myText:TextField = new TextField();

            myText.y += offset;

                    myText.width = 600;

       

                     var myFormat:TextFormat = new TextFormat();

                     myFormat.size = 7;

                     myFormat.align = TextFormatAlign.LEFT;

       

                     myFormat.font = font.fontName;

       

                     myText.defaultTextFormat = myFormat;

       

                     myText.text = font.fontName;

                     myText.embedFonts = false;

       

                     offset += 10;

                     addChild(myText);

                }

           }

      }

       

      Any help would be appreciated,

      Thanks,

      Brent