AS3 Embedded Fonts list and their names
Asked Answered
N

1

7

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

Necklace answered 31/5, 2012 at 16:16 Comment(0)
H
13

Use Font.enumerateFonts().

var fonts:Array = Font.enumerateFonts();
for each(var font:Font in fonts)
    trace( font.fontName+":"+font.fontType );
Hooded answered 31/5, 2012 at 16:31 Comment(4)
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!Aemia
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... ;)Hooded
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.Aemia
@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).Dude

© 2022 - 2024 — McMap. All rights reserved.