[Embed(source='/assets/calibri.ttf', fontName="Font", mimeType="application/x-font-truetype" embedAsCFF="false")]
private static var calibri:String;
I Looking from tutorial and get code like above and look like it's must on Class? can I use it without class? or maybe an example for font loaded class please?
Use the embed param fontFamily
. This string you can use to set the font.
[Embed(source='/assets/calibri.ttf', fontFamily="calibri", mimeType="application/x-font-truetype" embedAsCFF="false")]
var CalibriFont:Class;
var tf:TextField = new TextField();
tf.embedFonts = true;
addChild(tf);
var tff:TextFormat = new TextFormat();
tff.font = "calibri";
tf.defaultTextFormat = tff;
tf.htmlText = "HELLO";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.