             var textField:TextField     = new TextField();
             textField.autoSize          = TextFieldAutoSize.LEFT;
             textField.defaultTextFormat = textFormat;
+            textField.antiAliasType     = AntiAliasType.ADVANCED;
             textField.text              = text.replace(/[\t\n\f\r]/g, " ");
             textField.setTextFormat(textFormat);
             return {width: textField.textWidth + 4, height: textField.textHeight + 4 };

        }

}
}
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFormat;
    import flash.text.AntiAliasType;
    import flash.utils.ByteArray;

    public class CanvasRenderingContext2D
