summaryrefslogtreecommitdiff
path: root/vcl/quartz/ctlayout.cxx
diff options
context:
space:
mode:
authorDouglas Mencken <dougmencken@gmail.com>2014-04-27 11:57:39 -0400
committerDavid Tardon <dtardon@redhat.com>2014-05-13 07:45:07 +0000
commitc345429b27da24ac4b7ecb73a5a6311cd5e93576 (patch)
tree400c2bfda55c2accd30188a65095192d5509b490 /vcl/quartz/ctlayout.cxx
parent3f72ad159c881d0a11e638c84064172f48f75026 (diff)
vcl-quartz: fix for fdo#77993 (specific to OS X <10.6)
When using current method, early version of CoreText crashes internally. Change-Id: Id451d72ac26e4777b61f5d3fec6d4b046c46a749 Reviewed-on: https://gerrit.libreoffice.org/9180 Tested-by: David Tardon <dtardon@redhat.com> Reviewed-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'vcl/quartz/ctlayout.cxx')
-rw-r--r--vcl/quartz/ctlayout.cxx16
1 files changed, 15 insertions, 1 deletions
diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx
index 7969991f11d2..0b29673cbf42 100644
--- a/vcl/quartz/ctlayout.cxx
+++ b/vcl/quartz/ctlayout.cxx
@@ -172,6 +172,11 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs )
// - CoreText handles spaces specially (in particular at the text end)
if( mnTrailingSpaceCount )
{
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+ // don't recreate line layout here, because this can lead to problems
+ // (looks like internal issues inside early CoreText versions)
+ mfTrailingSpaceWidth = CTLineGetTrailingWhitespaceWidth( mpCTLine );
+#else
if(rArgs.mpDXArray)
{
int nFullPixelWidth = nPixelWidth;
@@ -201,8 +206,9 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs )
aCFText,
mpTextStyle->GetStyleDict() );
mpCTLine = CTLineCreateWithAttributedString( pAttrStr );
- CFRelease( aCFText);
CFRelease( pAttrStr );
+ CFRelease( aCFText );
+#endif
// in RTL-layouts trailing spaces are leftmost
// TODO: use BiDi-algorithm to thoroughly check this assumption
@@ -212,7 +218,11 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs )
}
}
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+ CTLineRef pNewCTLine = CTLineCreateJustifiedLine( mpCTLine, 1.0, nPixelWidth - mfTrailingSpaceWidth );
+#else
CTLineRef pNewCTLine = CTLineCreateJustifiedLine( mpCTLine, 1.0, nPixelWidth);
+#endif
if( !pNewCTLine )
{
// CTLineCreateJustifiedLine can and does fail
@@ -225,7 +235,11 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs )
}
CFRelease( mpCTLine );
mpCTLine = pNewCTLine;
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+ mfCachedWidth = nPixelWidth;
+#else
mfCachedWidth = nPixelWidth + mfTrailingSpaceWidth;
+#endif
}
// When drawing right aligned text, rounding errors in the position returned by