Hello all,

I check font2swf tool and find what some code must be added to create
powerful font creation utility. Currently, in resulting swf I see

package
{
    import flash.text.*;

    dynamic public class Arial extends Font
    {

        public function Arial()
        {
            return;
        }// end function

    }
}

(checked with Sothink SWF Decompiler). But, to register font
successfully in external Flash app, you need this code:

package
{
    import mx.core.*;

    public class RSFont0__font extends FontAsset
    {

        public function RSFont0__font()
        {
            return;
        }// end function

    }
}

package
{
    import flash.text.*;

    public class RSFont0 extends Font
    {
        private var _fontName:String = "ArialRegular";
        private var _fontStyle:String = "regular";
        private var _fontType:String = "embedded";
        private static var _font:Class = RSFont0__font;

        public function RSFont0()
        {
            return;
        }// end function

        override public function get fontName() : String
        {
            return this._fontName;
        }// end function

        override public function get fontStyle() : String
        {
            return this._fontStyle;
        }// end function

        override public function get fontType() : String
        {
            return this._fontType;
        }// end function

        public static function get font() : Class
        {
            return _font;
        }// end function

    }
}

package
{
    import FontRegister.*;
    import flash.display.*;
    import flash.text.*;

    public class FontRegister extends Sprite
    {
        private var _fonts:Array;

        public function FontRegister()
        {
            this._fonts = [new RSFont0()];
            this.registerFont(RSFont0.font);
            return;
        }// end function

        public function get fonts() : Array
        {
            return this._fonts;
        }// end function

        protected function registerFont(param1:Class) : void
        {
            Font.registerFont(param1);
            return;
        }// end function

    }
}

package mx.core
{
    import flash.text.*;

    public class FontAsset extends Font implements IFlexAsset
    {
        static const VERSION:String = "4.0.0.14159";

        public function FontAsset()
        {
            return;
        }// end function

    }
}

package mx.core
{

    public interface IFlexAsset
    {

        public function IFlexAsset();

    }
}

This is classes in SWF generated by
http://code.google.com/p/flash-runtime-font-publisher/

Also, I check sources and found what you have undocumented switch "-n
fontname" where fontname="Arial" in previous example. Please document
this feature, this is very useful thing for preparing fonts, because
italic, bold and other font styles have default "Arial" name too - but
with this key I can set fontname to "ArialItalic", "ArialBold" and so
on.

-- 
Andrew Answer
CEO of Yourself
http://andrew.answer.name
Learn and grow.

Reply via email to