summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2015-05-04 08:08:18 +0300
committerKhaled Hosny <khaledhosny@eglug.org>2015-05-04 08:15:28 +0300
commit1f059a591966b69e8943cefa1169a1b6526e2199 (patch)
treee346f9b2146cd66bfc3c5987e9c3326297ba1623
parent4c07124cf4f7684d271d0e71a095c67e0f988e45 (diff)
Revert "Fix tdf#87373: Kerning broken on OS X"
This reverts commit bec8fc58a827c220b3f28462ae127cc1c571d1bf. It does not really solve the bad spacing issue and it broke handling of trailing whitespace in right-to-left text.
-rw-r--r--vcl/quartz/ctlayout.cxx49
1 files changed, 20 insertions, 29 deletions
diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx
index bf207b693c98..b9d4f1b99b2c 100644
--- a/vcl/quartz/ctlayout.cxx
+++ b/vcl/quartz/ctlayout.cxx
@@ -215,38 +215,19 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs )
return;
}
- DeviceCoordinate nPixelWidth = rArgs.mnLayoutWidth;
+ DeviceCoordinate nPixelWidth = 0;
- if( rArgs.mpDXArray && !(rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL) )
+ if(rArgs.mpDXArray && !(rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL) )
{
nPixelWidth = rArgs.mpDXArray[ mnCharCount - 1 ];
- }
- if( nPixelWidth <= 0)
- {
- return;
- }
- // short-circuit when justifying an all-whitespace string
- if( mnTrailingSpaceCount >= mnCharCount)
- {
- mfCachedWidth = nPixelWidth;
- return;
- }
-
- // justification requests which change the width by just one pixel are probably
- // introduced by lossy conversions between integer based coordinate system
- const DeviceCoordinate nOrigWidth = GetTextWidth();
-
- if( (nOrigWidth >= nPixelWidth - 1) && (nOrigWidth <= nPixelWidth + 1) )
- {
- return;
- }
- if( rArgs.mpDXArray && !(rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL) )
- {
+ if( nPixelWidth <= 0)
+ return;
ApplyDXArray( rArgs );
if( mnTrailingSpaceCount )
{
DeviceCoordinate nFullPixelWidth = nPixelWidth;
- nPixelWidth = rArgs.mpDXArray[ mnCharCount - mnTrailingSpaceCount - 1];
+ nPixelWidth = (mnTrailingSpaceCount == mnCharCount) ? 0 :
+ rArgs.mpDXArray[ mnCharCount - mnTrailingSpaceCount - 1];
mfTrailingSpaceWidth = nFullPixelWidth - nPixelWidth;
if( nPixelWidth <= 0)
return;
@@ -255,6 +236,15 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs )
}
else
{
+ nPixelWidth = rArgs.mnLayoutWidth;
+
+ if( nPixelWidth <= 0 && rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL)
+ {
+ nPixelWidth = GetTextWidth();
+ }
+
+ if( nPixelWidth <= 0)
+ return;
// if the text to be justified has whitespace in it then
// - Writer goes crazy with its HalfSpace magic
@@ -265,10 +255,10 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs )
{
mfTrailingSpaceWidth = CTLineGetTrailingWhitespaceWidth( mpCTLine );
nPixelWidth -= mfTrailingSpaceWidth;
- if( nPixelWidth <= 0)
- {
- return;
- }
+ }
+ if(nPixelWidth <= 0)
+ {
+ return;
}
// recreate the CoreText line layout without trailing spaces
@@ -295,6 +285,7 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs )
}
CTLineRef pNewCTLine = CTLineCreateJustifiedLine( mpCTLine, 1.0, nPixelWidth);
SAL_INFO( "vcl.ct", "CTLineCreateJustifiedLine(" << mpCTLine << ",1.0," << nPixelWidth << ") = " << pNewCTLine );
+
if( !pNewCTLine )
{
// CTLineCreateJustifiedLine can and does fail