Skip to content

Instantly share code, notes, and snippets.

@koesbong
Created May 4, 2011 23:18
Show Gist options
  • Select an option

  • Save koesbong/956234 to your computer and use it in GitHub Desktop.

Select an option

Save koesbong/956234 to your computer and use it in GitHub Desktop.
package {
import flash.display.Sprite;
import flash.text.Font;
import flash.text.FontType;
import flash.text.FontStyle;
import flash.external.ExternalInterface;
public class FontList extends Sprite
{
public function FontList()
{
ExternalInterface.call('kt.populateFontList', getDeviceFonts());
}
public function getDeviceFonts():Array
{
var embeddedAndDeviceFonts:Array = Font.enumerateFonts(true);
var deviceFontNames:Array = [];
for each (var font:Font in embeddedAndDeviceFonts)
{
if (font.fontType == FontType.EMBEDDED
|| font.fontStyle != FontStyle.REGULAR
)
continue;
deviceFontNames.push(font.fontName);
}
deviceFontNames.sort();
return deviceFontNames;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment