# Embeded fonts from external swf only true type fonts work

**URL:** <https://forum.kirupa.com/t/embeded-fonts-from-external-swf-only-true-type-fonts-work/326761>\
**Category:** Uncategorized\
**Created:** [January 10, 2012, 7:06pm UTC](https://forum.kirupa.com/t/embeded-fonts-from-external-swf-only-true-type-fonts-work/326761 "2012-01-10T19:06:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bonassus](https://avatars.discourse-cdn.com/v4/letter/b/ea5d25/32.png) [@bonassus](https://forum.kirupa.com/u/bonassus)\
**Post date:** [January 10, 2012, 7:06pm UTC](https://forum.kirupa.com/t/embeded-fonts-from-external-swf-only-true-type-fonts-work/326761/1 "2012-01-10T19:06:31Z")

</div>

I have a TextDisplay class that loads a swf with embeded fonts and then regesters the font with Font.registerFont. I then pass the font class name as a parameter. This works fine for some fonts and not for others and i don’t know why. Its seems to only work with true type fonts but not all. If some one knows whats going one here I would really appreciate some help.

Thanks!

```auto

package mvc.view
{
    import com.greensock.loading.*;
    import com.greensock.events.*;
    import flash.display.MovieClip;
    import flash.text.Font;
    import flash.text.TextField;
    import flash.text.TextFormat;
    import flash.text.AntiAliasType
    import flash.text.TextFieldAutoSize;
import flash.text.TextFormatAlign;

public class TextDisplay extends MovieClip{
    private var textFormat:TextFormat = new TextFormat();
    private var theTextField:TextField = new TextField();
    private var _theText:String = "";
    private var loader:SWFLoader;
    private var fontClass:Class;
    private var _theColor:String;
    private var _fontName;
    private var _ifBold:Boolean;
    private var _textSize:uint;

        public function TextDisplay(theColor,textSize,fontName){
            _theColor = theColor;
            _textSize = textSize;
            _fontName = fontName;
            loader = new SWFLoader("mvc/view/font/fonts.swf", {onComplete:completeHandler});
            loader.load();
        }

        function completeHandler(event:LoaderEvent):void {
         fontClass = loader.getClass(_fontName);
        Font.registerFont(fontClass);
                 setText(_theText);

        }

         private function setText(_theText){
             textFormat.font = _fontName;
            textFormat.size = _textSize;
            textFormat.bold = _ifBold;
            textFormat.color =_theColor;

            textFormat.align = TextFormatAlign.RIGHT;

            theTextField.text = _theText;
            theTextField.setTextFormat(textFormat);
            theTextField.selectable = false;
            theTextField.mouseEnabled = false;
            theTextField.antiAliasType = AntiAliasType.ADVANCED;
            theTextField.autoSize = TextFieldAutoSize.RIGHT;
            addChild(theTextField);
    }

        public function set theText(value:String):void {
            _theText = value;
           setText(_theText);
        }
    }
}

```
