7

How to get a list of all embedded fonts with their names using AS3.

1 Answers1

13

Use Font.enumerateFonts().

var fonts:Array = Font.enumerateFonts();
for each(var font:Font in fonts)
    trace( font.fontName+":"+font.fontType );
Huby
  • 871
  • 11
  • 16
weltraumpirat
  • 22,544
  • 5
  • 40
  • 54
  • 1
    Make note that this will only get you embedded fonts. If you want to grab all fonts on the user's machine then use `Font.enumerateFonts(false);` - I'm not telling you anything the documentation won't tell you, so have at it! – Jacksonkr Aug 30 '12 at 16:55
  • 2
    Thanks for the up vote, and I really don't want to be overly pedantic, but OP was specifically asking for a *list of embedded fonts*... ;) – weltraumpirat Aug 30 '12 at 16:59
  • 5
    Oh certainly, and you nailed the Q. I was merely adding some extra low-hanging-fruit info for anyone who may stroll past the comment in the future. – Jacksonkr Aug 30 '12 at 17:16
  • 1
    @Jackson - if you want to grab all fonts on the user's machine then use `Font.enumerateFonts(true);` not false (false is the default BTW). – rustyx Feb 21 '15 at 16:19