summaryrefslogtreecommitdiff
path: root/vcl/coretext
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2013-06-21 19:21:15 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2013-06-21 19:34:20 +0200
commit9fdd5db03b0b4147295fdacf98e6cf700955e2e1 (patch)
treeabd6052e3b59b3a03e38a3c80fafc500f024fe3d /vcl/coretext
parentecdd9d1a47587aa7557c1b151010c78efa90fef2 (diff)
Attempt to fix Core Text full justification
Apparently we need to subtract the trailing white space from the desired line length or text will sometimes protrude to the margin. Change-Id: Iee5ef40670c2fefc189afa319387b180c4ed648d
Diffstat (limited to 'vcl/coretext')
-rw-r--r--vcl/coretext/ctlayout.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/vcl/coretext/ctlayout.cxx b/vcl/coretext/ctlayout.cxx
index 183309361165..50ab4400ace9 100644
--- a/vcl/coretext/ctlayout.cxx
+++ b/vcl/coretext/ctlayout.cxx
@@ -140,10 +140,11 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs )
nPixelWidth = rArgs.mpDXArray[ mnCharCount - 1 ];
}
+ float fTrailingSpace = CTLineGetTrailingWhitespaceWidth( mpCTLine );
// in RTL-layouts trailing spaces are leftmost
// TODO: use BiDi-algorithm to thoroughly check this assumption
if( rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL)
- mnBaseAdv = rint( CTLineGetTrailingWhitespaceWidth( mpCTLine ) );
+ mnBaseAdv = rint( fTrailingSpace );
// return early if there is nothing to do
if( nPixelWidth <= 0 )
@@ -154,7 +155,7 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs )
if( (nOrigWidth >= nPixelWidth-1) && (nOrigWidth <= nPixelWidth+1) )
return;
- CTLineRef pNewCTLine = CTLineCreateJustifiedLine( mpCTLine, 1.0, nPixelWidth );
+ CTLineRef pNewCTLine = CTLineCreateJustifiedLine( mpCTLine, 1.0, nPixelWidth - fTrailingSpace );
if( !pNewCTLine ) { // CTLineCreateJustifiedLine can and does fail
// handle failure by keeping the unjustified layout
// TODO: a better solution such as