2014. 10. 17. 10:22
내장된 폰트의 사용(embeded font)
2014. 10. 17. 10:22 in 팁&테크/ActionScript3
먼저 폰트를 embed 하는 방법
[Embed(source="경로/폰트.ttf", fontName = "폰트호출명", embedAsCFF="false", mimeType="application/x-font-truetype")]
public static var eFont:Class;
TextFormat 클래스로 사용
var tf:TextFormat = new TextFormat("폰트호출명", .....);
또는
var tf:TextFormat = new TextFormat();
tf.font = "폰트호출명";
-- 주의 --
내장된 폰트를 사용하기 위해서는 TextFormat를 할당하는 개체에도 내장된 폰트를 사용하게끔 설정해야 된다.
그리고 antiAlias를 ADVANCED로 줘야 그나마 깔끔하게 출력됨
var t:TextField = new TextField();
t.embedFonts = true;
t.antiAliasType = AntiAliasType.ADVANCED;
t.defaultTextFormat = tf; <- TextFormat 객체
setStyle로 적용할 경우
t.setStyle("textFormat", tf);
t.setStyle("embedFonts", true);