 
             // Convert the text into BitmapData
             var bitmapData:BitmapData = new BitmapData(width + 4, height + 4, true, 0);
-            bitmapData.draw(textField, matrix);
+            bitmapData.draw(textField, matrix, null, null, null, true);
 
             // Adjust x coordinates
             switch (state.textAlign)


            // Remove 2px margins around the text
            var matrix:Matrix = new Matrix();
//            matrix.translate(-2, -2);

            if (isStroke)
            {

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

    public class CanvasRenderingContext2D
