silexlabs / Cocktail

An HTML/CSS rendering engine for the Haxe language
http://www.silexlabs.org/haxe/cocktail/
Other
192 stars 34 forks source link

[BUG] TextRender - (urgent) #418

Open Espigah opened 10 years ago

Espigah commented 10 years ago

TextRender

Espigah commented 10 years ago

override public function getBitmap(bounds:RectangleVO):NativeBitmapData { //this offset is the offset between the top most of the text and the top of the text //field. We want to remove it so that text gets drawn at y=0 var textOffsetY:Float = _textField.textHeight - _textField.height; var textOffsetX:Float = _textField.width - _textField.textWidth;

    //_nativeBitmap = new BitmapData(Math.round(bounds.width), Math.round(bounds.height - textOffsetY), true, 0x00000000);
    _nativeBitmap = new BitmapData(Math.ceil(bounds.width+textOffsetX), Math.ceil(bounds.height - textOffsetY), true, 0x00000000);//#418 - [BUG] TextRender - (urgent) 
</code><code>   
    _matrix.identity();

    //there is a documented 2px gutter (horizontal and vertical) in the flash text field before the
    //first char :
    //http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextLineMetrics.html
    _matrix.translate( -2, textOffsetY + 2);

    _nativeBitmap.draw(_textField, _matrix);

    return _nativeBitmap;
}

still nothing... =/