openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h..@apache.org
Subject svn commit: r1602365 - in /openoffice/branches/AOO410: ./ main/ main/vcl/aqua/source/gdi/ctfonts.cxx main/vcl/aqua/source/gdi/ctfonts.hxx main/vcl/aqua/source/gdi/ctlayout.cxx main/vcl/source/gdi/outdev3.cxx
Date Fri, 13 Jun 2014 10:49:56 GMT
Author: hdu
Date: Fri Jun 13 10:49:55 2014
New Revision: 1602365

URL: http://svn.apache.org/r1602365
Log:
#i124922# allow late setting of the font color for CoreText-layouted text

Merged from AOO's trunk revision 1595858

Modified:
    openoffice/branches/AOO410/   (props changed)
    openoffice/branches/AOO410/main/   (props changed)
    openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctfonts.cxx
    openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctfonts.hxx
    openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctlayout.cxx
    openoffice/branches/AOO410/main/vcl/source/gdi/outdev3.cxx

Propchange: openoffice/branches/AOO410/
------------------------------------------------------------------------------
  Merged /openoffice/trunk:r1595858

Propchange: openoffice/branches/AOO410/main/
------------------------------------------------------------------------------
  Merged /openoffice/trunk/main:r1595858

Modified: openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctfonts.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctfonts.cxx?rev=1602365&r1=1602364&r2=1602365&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctfonts.cxx (original)
+++ openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctfonts.cxx Fri Jun 13 10:49:55 2014
@@ -140,6 +140,9 @@ CTTextStyle::CTTextStyle( const ImplFont
 	CFDictionarySetValue( mpStyleDict, kCTFontAttributeName, pNewCTFont );
 	CFRelease( pNewCTFont);
 
+	// allow delayed setting the font color, i.e. after the text layout
+	CFDictionarySetValue( mpStyleDict, kCTForegroundColorFromContextAttributeName, kCFBooleanTrue
);
+
 	// handle emulation of bold styles if requested and the font that doesn't provide them
 	if( (pReqFont->meWeight > WEIGHT_MEDIUM)
 	&&  (mpFontData->meWeight <= WEIGHT_MEDIUM)
@@ -282,21 +285,6 @@ bool CTTextStyle::GetGlyphOutline( sal_G
 	return true;
 }
 
-// -----------------------------------------------------------------------
-
-void CTTextStyle::SetTextColor( const RGBAColor& rColor )
-{
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
-	CGColorRef pCGColor = CGColorCreateGenericRGB( rColor.GetRed(),
-		rColor.GetGreen(), rColor.GetBlue(), rColor.GetAlpha() );
-#else // for builds on OSX 10.4 SDK
-	const CGColorSpaceRef pCGColorSpace = GetSalData()->mxRGBSpace;
-	CGColorRef pCGColor = CGColorCreate( pCGColorSpace, rColor.AsArray() );
-#endif
-	CFDictionarySetValue( mpStyleDict, kCTForegroundColorAttributeName, pCGColor );
-	CFRelease( pCGColor);
-}
-
 // =======================================================================
 
 CTFontData::CTFontData( const ImplDevFontAttributes& rDFA, sal_IntPtr nFontId )

Modified: openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctfonts.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctfonts.hxx?rev=1602365&r1=1602364&r2=1602365&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctfonts.hxx (original)
+++ openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctfonts.hxx Fri Jun 13 10:49:55 2014
@@ -39,7 +39,7 @@ public:
 	virtual bool	GetGlyphBoundRect( sal_GlyphId, Rectangle& ) const;
 	virtual bool	GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ) const;
 
-	virtual void	SetTextColor( const RGBAColor& );
+	virtual void	SetTextColor( const RGBAColor& ) {}
 
 private:
 	/// CoreText text style object

Modified: openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctlayout.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctlayout.cxx?rev=1602365&r1=1602364&r2=1602365&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctlayout.cxx (original)
+++ openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctlayout.cxx Fri Jun 13 10:49:55 2014
@@ -111,6 +111,7 @@ CTLayout::~CTLayout()
 
 bool CTLayout::LayoutText( ImplLayoutArgs& rArgs )
 {
+	// release an eventual older layout
 	if( mpAttrString )
 		CFRelease( mpAttrString );
 	mpAttrString = NULL;
@@ -118,6 +119,7 @@ bool CTLayout::LayoutText( ImplLayoutArg
 		CFRelease( mpCTLine );
 	mpCTLine = NULL;
 
+	// initialize the new layout
 	SalLayout::AdjustLayout( rArgs );
 	mnCharCount = mnEndCharPos - mnMinCharPos;
 
@@ -236,12 +238,12 @@ void CTLayout::AdjustLayout( ImplLayoutA
 void CTLayout::DrawText( SalGraphics& rGraphics ) const
 {
 	AquaSalGraphics& rAquaGraphics = static_cast<AquaSalGraphics&>(rGraphics);
-	
+
 	// short circuit if there is nothing to do
 	if( (mnCharCount <= 0)
 	||  !rAquaGraphics.CheckContext() )
 		return;
-	
+
 	// the view is vertically flipped => flipped glyphs
 	// so apply a temporary transformation that it flips back
 	// also compensate if the font was size limited
@@ -249,7 +251,7 @@ void CTLayout::DrawText( SalGraphics& rG
 	CGContextScaleCTM( rAquaGraphics.mrContext, +mfFontScale, -mfFontScale );
 	CGContextSetShouldAntialias( rAquaGraphics.mrContext, !rAquaGraphics.mbNonAntialiasedText
);
 
-	// Draw the text
+	// set the text transformation (e.g. position)
 	const Point aVclPos = GetDrawPosition( Point(mnBaseAdv,0) );
 	CGPoint aTextPos = { +aVclPos.X()/mfFontScale, -aVclPos.Y()/mfFontScale };
 
@@ -262,6 +264,11 @@ void CTLayout::DrawText( SalGraphics& rG
 	}
 
 	CGContextSetTextPosition( rAquaGraphics.mrContext, aTextPos.x, aTextPos.y );
+
+	// set the text color as fill color (see kCTForegroundColorFromContextAttributeName)
+	CGContextSetFillColor( rAquaGraphics.mrContext, rAquaGraphics.maTextColor.AsArray() );
+
+	// draw the text
 	CTLineDraw( mpCTLine, rAquaGraphics.mrContext );
 
 	// request an update of the changed window area

Modified: openoffice/branches/AOO410/main/vcl/source/gdi/outdev3.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/vcl/source/gdi/outdev3.cxx?rev=1602365&r1=1602364&r2=1602365&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/vcl/source/gdi/outdev3.cxx (original)
+++ openoffice/branches/AOO410/main/vcl/source/gdi/outdev3.cxx Fri Jun 13 10:49:55 2014
@@ -6043,14 +6043,6 @@ SalLayout* OutputDevice::ImplLayout( con
 
     ImplLayoutArgs aLayoutArgs = ImplPrepareLayoutArgs( aStr, nMinIndex, nLen, nPixelWidth,
pDXArray );
 
-#ifdef MACOSX
-    // 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
-    if( mbInitTextColor )
-        const_cast<OutputDevice&>(*this).ImplInitTextColor();
-#endif
-
     // get matching layout object for base font
     SalLayout* pSalLayout = NULL;
     if( mpPDFWriter )



Mime
View raw message