如何在不损失质量的情况下将文本转换为图形

时间:2012-10-24 13:36:56

标签: flash actionscript

        ex = new TextField();
        ex.styleSheet = styleSheet; //some custom fonts
        ex.htmlText = '<p>EX</p>';
        ex.autoSize = 'left';
        //ex.embedFonts = true;
        //var exbitmap:Bitmap;
        //exbitmap = new Bitmap( new BitmapData(ex.width,ex.height,true,0x000000));
        //exbitmap.bitmapData.draw(ex);
        var bitmapdata:BitmapData = new BitmapData(ex.width, ex.height, true, 0x00000000);
        bitmapdata.draw(ex);


        graphics.beginBitmapFill(bitmapdata);
        graphics.drawRect(0, 0, ex.width, ex.height);
        graphics.endFill();

问题在于,当我将文字绘制为图形时,它会失去质量,如何做到这一点而失去了质量?

enter image description here

enter image description here

看到差异?

首先转换为图像,第二个是原始

1 个答案:

答案 0 :(得分:0)

确保文本字段的坐标是整数。

ex.x = int(/*your formula*/);
//or
ex.x = Math.round(/*your formula*/);