Font Listing
...
@author DefaultUser (Tools -> Custom Arguments...)
package
{
import flash.events.Event;
import flash.display.LoaderInfo;
import flash.display.Loader;
import flash.display.Sprite;
import flash.net.URLRequest;
import flash.text.Font;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
/**
* ...
* @author DefaultUser (Tools -> Custom Arguments...)
*/
[SWF(width = "465", height = "465", frameRate = "0", backgroundColor = "#FFFFFF")]
public class FontListing extends Sprite
{
private var _textField:TextField;
public function FontListing()
{
_textField = new TextField();
_textField.x = 10;
_textField.y = 10;
_textField.width = stage.stageWidth;
_textField.height = stage.stageHeight;
_textField.multiline = true;
addChild(_textField);
init();
}
private function init():void {
var fontArray:Array = Font.enumerateFonts(true);
fontArray.forEach(traceElement);
}
private function traceElement(element:*, index:int, ary:Array):void {
var f:Font = element as Font;
var begin:int;
var end:int;
var msg:String = "";
msg += "index:" + index + " fontName:" + f.fontName
+ " fontType:" + f.fontType + " fontStyle:" + f.fontStyle + "\n";
begin = _textField.text.length - 1;
_textField.appendText(msg);
end = _textField.text.length - 1;
_textField.setTextFormat(new TextFormat(f.fontName, 20), begin, end);
//trace(msg);
}
}
}