0

I register my fonts once they are loaded. In my head I should be able to use them once they are. But I wasn't so I tweaked my code, here it is but it still makes the text invisible. As soon as I do embedFonts = false, it starts working again.

        trace(Font.enumerateFonts()); // Returns an array and does show my Fonts embedded.


        var format:TextFormat = new TextFormat();
        var fontClass:Class = _model.getFont("HappyHell"); // Does return the Class
        var myFont:Font = new fontClass(); // Works
        format.font = myFont.fontName;
        format.size = 15;
        format.letterSpacing = 0.8;

        var test:TextField = new TextField();
        test.embedFonts = true;
        test.defaultTextFormat = format;

        test.text = "TESTING everything 13216";
        test.x = 30;
        test.y = 30;
        addChild(test);
Fahim Akhter
  • 1,617
  • 5
  • 31
  • 49

1 Answers1

1

If you are using embededFonts = true property then you need to have the font in your library.

Links:

UPDATE

What does trace ( myFont.fontName ) output?

try:

var myFont:Font = new HappyHell();

or

var myFont:Font = new fontClass() as Font;
Community
  • 1
  • 1
Jevgenij Dmitrijev
  • 2,228
  • 1
  • 15
  • 23
  • The output is : "Happy Hell" The output of Font.enumerateFonts is [HappyHell][Joint][...] and Font.enumerateFonts()[0].fontName results in "Happy Hell" – Fahim Akhter Jul 28 '11 at 08:12
  • I got it working, I had an swc embedded in the project. This SWC had a textfield using the font. Somehow flash doesn't appreciate that. – Fahim Akhter Jul 29 '11 at 09:36