summaryrefslogtreecommitdiff
path: root/vcl/coretext/salcoretextlayout.cxx
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2013-04-06 17:14:09 +0300
committerTor Lillqvist <tml@iki.fi>2013-04-07 01:13:34 +0300
commit3780597178b9074e4896588fb0c68a708ae26133 (patch)
treeb2ab3dc6ee883c4c50f250d72f2b7b1c2f73a242 /vcl/coretext/salcoretextlayout.cxx
parentffd4c2e40eca03445ab2c77468f661d691adc31e (diff)
Take trailing whitesapce into consideration
CTLineGetImageBounds() does not include space taken by trailing whitespace in the line. Change-Id: I403906daed952bac58fa11634beb6c7faa39b9b3
Diffstat (limited to 'vcl/coretext/salcoretextlayout.cxx')
-rw-r--r--vcl/coretext/salcoretextlayout.cxx11
1 files changed, 9 insertions, 2 deletions
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 );