diff options
author | Frank Schönheit <fs@openoffice.org> | 2009-09-21 10:31:11 +0000 |
---|---|---|
committer | Frank Schönheit <fs@openoffice.org> | 2009-09-21 10:31:11 +0000 |
commit | 105e04d56fe3a67b58b667c278ad66786366304a (patch) | |
tree | 1353868f4b31606bf82145398fb63b31da217196 /vcl | |
parent | e71f3326ef8f46a39228b6ab6589b61482044b40 (diff) |
DrawText( Rect, ...): properly calculate the to-be-returned text rect even in edge cases ...
Diffstat (limited to 'vcl')
-rwxr-xr-x | vcl/source/gdi/textlayout.cxx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx index a555709e0786..d969df2f439b 100755 --- a/vcl/source/gdi/textlayout.cxx +++ b/vcl/source/gdi/textlayout.cxx @@ -332,6 +332,17 @@ namespace vcl m_rTargetDevice.DrawText( aRect, _rText, _nStyle, _pVector, _pDisplayText, this ); Rectangle aTextRect = onEndDrawText(); + if ( aTextRect.IsEmpty() && !aRect.IsEmpty() ) + { + // this happens for instance if we're in a PaintToDevice call, where only a MetaFile is recorded, + // but no actual painting happens, so our "DrawText( Point, ... )" is never called + // In this case, calculate the rect from what OutputDevice::GetTextRect would give us. This has + // the disadvantage of less accuracy, compared with the approach to calculate the rect from the + // single "DrawText( Point, ... )" calls, since more intermediate arithmetics will translate + // from ref- to target-units. + aTextRect = m_rTargetDevice.GetTextRect( aRect, _rText, _nStyle, NULL, this ); + } + if ( IsZoom() ) { // similar to above, transform the to-be-returned rectanle to coordinates which are meaningful |