I looked at all the topics about inserting fonts in AS3 that I could find, and tried all the solutions. I probably missed something obvious, but I donโt quite understand what Iโm doing, so please direct me in the right direction. Many of the answers are related to Flash Builder or another tool, but I use FlashDevelop . I donโt know if that matters.
I have this line in my Main.as:
[Embed(source = "assets/SKA_75_marul_CE_extended.ttf", fontName = "SKA_75_marul_CE_extended", fontWeight = "bold", advancedAntiAliasing = "true", mimeType = "application/x-font")] public static var SKA_75_marul_CE_extended:String;
And this exists in an extended sprite constructor called Pointer.as:
var format:TextFormat = new TextFormat(); format.font = "SKA_75_marul_CE_extended"; format.color = 0xFFCCCC; format.size = 20; var label:TextField = new TextField(); label.defaultTextFormat = format; label.text = "test"; label.embedFonts = true; label.antiAliasType = AntiAliasType.ADVANCED;
The only way I found to display it is to disable embedFonts. I tried to implement C: /windows/fonts/arial.ttf without success.
Embedding fonts seems like a dark art like no other, and I have to give in after 1 hour of struggle. Please send help.
UPDATE:
Here the working code, it turns out, was due to the correct order of operations ...:
[Embed(source="assets/SKA_75_marul_CE_extended.ttf", fontName = "myFont", mimeType = "application/x-font", fontWeight="normal", fontStyle="normal", unicodeRange="U+0020-U+007E", advancedAntiAliasing="true", embedAsCFF="false")] private var myEmbeddedFont:Class; var tf:TextFormat = new TextFormat( "myFont", 20,0xffffff ); var t:TextField = new TextField; t.embedFonts = true;
flash fonts actionscript-3 flashdevelop
joon
source share