[Libreoffice-commits] core.git: vcl/quartz vcl/source

Tor Lillqvist tml at collabora.com
Thu Dec 12 01:09:23 PST 2013


 vcl/quartz/ctlayout.cxx    |   33 ---------------------------------
 vcl/source/gdi/outdev3.cxx |    2 +-
 2 files changed, 1 insertion(+), 34 deletions(-)

New commits:
commit fec3f8a8bab77ffb5345a401739114e0afaafcb2
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Dec 12 10:51:08 2013 +0200

    Much better fix for the iOS text colour problem
    
    Just use the same simple trick as for OS X in
    OutputDevice::ImplLayout().
    
    Thanks to Khaled Hosny for pointing out this.
    
    This reverts commit 9aba69e8cc034526c53f6135a41fc62dc3c5dce3.
    
    Change-Id: I27ba92ef8ebd1ebdb9eb74f670d8170649078881

diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx
index b1ce5fb..56d8696 100644
--- a/vcl/quartz/ctlayout.cxx
+++ b/vcl/quartz/ctlayout.cxx
@@ -64,8 +64,6 @@ private:
     // mutable members since these details are all lazy initialized
     mutable double  mfCachedWidth;          // cached value of resulting typographical width
 
-    mutable float mfAdjustedLineLength;
-
     // x-offset relative to layout origin
     // currently only used in RTL-layouts
     mutable double  mfBaseAdv;
@@ -77,7 +75,6 @@ CTLayout::CTLayout( const CoreTextStyle* pTextStyle )
 ,   mpCTLine( NULL )
 ,   mnCharCount( 0 )
 ,   mfCachedWidth( -1 )
-,   mfAdjustedLineLength( 0 )
 ,   mfBaseAdv( 0 )
 {
 }
@@ -162,7 +159,6 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs )
     CFRelease( mpCTLine );
     mpCTLine = pNewCTLine;
     mfCachedWidth = nPixelWidth;
-    mfAdjustedLineLength = nPixelWidth - fTrailingSpace;
 }
 
 // When drawing right aligned text, rounding errors in the position returned by
@@ -225,36 +221,7 @@ void CTLayout::DrawText( SalGraphics& rGraphics ) const
     }
 
     CGContextSetTextPosition( rAquaGraphics.mrContext, aTextPos.x, aTextPos.y );
-#ifdef MACOSX
-    // For some reason on OS X the problem with text colour being out of sync
-    // does not seem to occur.
     CTLineDraw( mpCTLine, rAquaGraphics.mrContext );
-#else
-    if( CFDictionaryGetValue( mpTextStyle->GetStyleDict(), kCTFontAttributeName) )
-    {
-        // We did likely not know the correct intended colour of the
-        // text in LayoutText(), so have to redo layout and justify.
-        CFStringRef aCFText = CFAttributedStringGetString( mpAttrString );
-        CFAttributedStringRef pAttrString = CFAttributedStringCreate( NULL, aCFText, mpTextStyle->GetStyleDict() );
-        CTLineRef pCTLine = CTLineCreateWithAttributedString( pAttrString );
-        CFRelease( pAttrString );
-        if( mfAdjustedLineLength > 0 )
-        {
-            CTLineRef pNewCTLine = CTLineCreateJustifiedLine( pCTLine, 1.0, mfAdjustedLineLength );
-            CFRelease( pCTLine );
-            pCTLine = pNewCTLine;
-        }
-        CTLineDraw( pCTLine, rAquaGraphics.mrContext );
-        CFRelease( pCTLine );
-    }
-    else
-    {
-        // FIXME: can the colour be wrong also the other way around:
-        // some leftover wrong colour was used in LayoutText(), but
-        // then here the style does not actually contain any colour?
-        CTLineDraw( mpCTLine, rAquaGraphics.mrContext );
-    }
-#endif
 #ifndef IOS
     // request an update of the changed window area
     if( rAquaGraphics.IsWindowGraphics() )
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index f3f5a77..7f09937 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -5783,7 +5783,7 @@ SalLayout* OutputDevice::ImplLayout( const OUString& rOrigStr, sal_Int32 nMinInd
 
     ImplLayoutArgs aLayoutArgs = ImplPrepareLayoutArgs( aStr, nMinIndex, nLen, nPixelWidth, pDXArray );
 
-#ifdef MACOSX
+#if defined(MACOSX) || defined(IOS)
     // CoreText layouts are immutable and already contain the text color
     // so we need to provide the color already for the layout request
     // even if this layout will never be drawn


More information about the Libreoffice-commits mailing list