Created
May 4, 2011 23:18
-
-
Save koesbong/956234 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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