I'm trying to embed a font in FlashDevelop. My folder structure is
My embed metadata is
[Embed(source = 'resources/04B08.TTF', fontName = '04b08')] public var _04b08:Class;
My code is
public var titleFormat:TextFormat;
public var titleText:TextField;
private function init(e:Event = null):void
{
// entry point
titleText = new TextField();
titleFormat = new TextFormat();
titleFormat.font = "04b08";
titleFormat.color = 0xFFFFFF;
titleFormat.size = 72;
//titleText.embedFonts = true;
titleText.autoSize = TextFieldAutoSize.LEFT;
titleText.antiAliasType = AntiAliasType.NORMAL;
titleText.defaultTextFormat = titleFormat;
titleText.text = "TEST";
titleText.x = 10;
titleText.y = 10;
addChild(titleText);
}
If I use this, I get
But I uncomment the titleText.embedFonts = true;
line, I get
This is the method that all of the guides I can find use. What should I do to get it to work?
You should try a method registerFont() before using it:
Also, try other metadata parameters like
embedAsCFF='false'
andfontFamily='fontName'
, and then usetitleFormat.font = "fontName";
.For more reliably testing don't have the font installed in your OS.