From 3780597178b9074e4896588fb0c68a708ae26133 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sat, 6 Apr 2013 17:14:09 +0300 Subject: Take trailing whitesapce into consideration CTLineGetImageBounds() does not include space taken by trailing whitespace in the line. Change-Id: I403906daed952bac58fa11634beb6c7faa39b9b3 --- vcl/coretext/salcoretextlayout.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'vcl/coretext') diff --git a/vcl/coretext/salcoretextlayout.cxx b/vcl/coretext/salcoretextlayout.cxx index c82381b50528..1732a9357296 100644 --- a/vcl/coretext/salcoretextlayout.cxx +++ b/vcl/coretext/salcoretextlayout.cxx @@ -263,7 +263,14 @@ bool CoreTextLayout::GetBoundRect( SalGraphics& rGraphics, Rectangle& rVCLRect ) maBoundRectangle = Rectangle( Point( round_to_long(bound_rect.origin.x * mpStyle->GetFontStretchFactor()), round_to_long(bound_rect.origin.y - bound_rect.size.height )), - Size( round_to_long(bound_rect.size.width * mpStyle->GetFontStretchFactor()), round_to_long(bound_rect.size.height))); + Size( round_to_long((bound_rect.size.width + CTLineGetTrailingWhitespaceWidth( mpLine )) * mpStyle->GetFontStretchFactor()), + round_to_long(bound_rect.size.height))); + maBoundRectangle.Justify(); + } else { + maBoundRectangle = Rectangle( + Point( 0, 0 ), + Size( round_to_long(CTLineGetTrailingWhitespaceWidth( mpLine ) * mpStyle->GetFontStretchFactor()), + 0 ) ); maBoundRectangle.Justify(); } mbHasBoundRectangle = true; @@ -422,7 +429,7 @@ long CoreTextLayout::GetTextWidth() const return 0; } CGRect bound_rect = CTLineGetImageBounds(mpLine, context); - long w = round_to_long(bound_rect.size.width * mpStyle->GetFontStretchFactor()); + long w = round_to_long((bound_rect.size.width + CTLineGetTrailingWhitespaceWidth(mpLine)) * mpStyle->GetFontStretchFactor()); SAL_INFO( "vcl.coretext.layout", "GetTextWidth(" << this << ") returning " << w ); -- cgit