vcl/coretext/ctlayout.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
New commits: commit 9fdd5db03b0b4147295fdacf98e6cf700955e2e1 Author: Khaled Hosny <[email protected]> Date: Fri Jun 21 19:21:15 2013 +0200 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 diff --git a/vcl/coretext/ctlayout.cxx b/vcl/coretext/ctlayout.cxx index 18330936..50ab440 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 _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
