     import flash.text.TextField;
     import flash.text.TextFieldAutoSize;
     import flash.text.TextFormat;
+    import flash.text.AntiAliasType;
     import flash.utils.ByteArray;
 
     public class CanvasRenderingContext2D

        }

}
}

            // Convert the text into BitmapData
            var bitmapData:BitmapData = new BitmapData(width + 4, height + 4, true, 0);
            bitmapData.draw(textField, matrix, null, null, null, true);

            // Adjust x coordinates
            switch (state.textAlign)
