Kaydet (Commit) ea8422d4 authored tarafından Khaled Hosny's avatar Khaled Hosny

Cherry-pick Core Text port from AOO

Manually picked from:

http://svn.apache.org/viewvc?view=revision&sortby=log&revision=1480384

Author:         hdu
Date:           Wed May 8 18:14:34 2013 UTC (3 weeks, 2 days ago)
Changed paths:  55
Log Message:    #i122195# add VCL support for 64bit OSX>=10.7

Change-Id: Ia799d7fdeb257e9bfd311338dcfdf97caf9d191f
üst cacc5166
This diff is collapsed.
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#include "coretext/salgdi2.h"
#include "sallayout.hxx"
#include <ApplicationServices/ApplicationServices.h>
// =======================================================================
class CTTextStyle
: public ImplMacTextStyle
{
public:
explicit CTTextStyle( const ImplFontSelectData& );
virtual ~CTTextStyle( void );
virtual SalLayout* GetTextLayout( void ) const;
virtual void GetFontMetric( float fDPIY, ImplFontMetricData& ) const;
virtual bool GetGlyphBoundRect( sal_GlyphId, Rectangle& ) const;
virtual bool GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ) const;
virtual void SetTextColor( const RGBAColor& );
private:
/// CoreText text style object
CFMutableDictionaryRef mpStyleDict;
friend class CTLayout;
CFMutableDictionaryRef GetStyleDict( void ) const { return mpStyleDict; }
};
// =======================================================================
#ifndef DISABLE_CORETEXT_DYNLOAD
// the CoreText symbols may need to be loaded dynamically
// since platform targets like OSX 10.4 do not provide all required symbols
// TODO: avoid the dlsym stuff if the target platform is >= OSX10.5
class DynCoreTextSyms
{
public:
// dynamic symbols to access the CoreText API
uint32_t (*GetCoreTextVersion)(void);
CTFontCollectionRef (*FontCollectionCreateFromAvailableFonts)(CFDictionaryRef);
CFArrayRef (*FontCollectionCreateMatchingFontDescriptors)(CTFontCollectionRef);
CGPathRef (*FontCreatePathForGlyph)(CTFontRef,CGGlyph,const CGAffineTransform*);
CGRect (*FontGetBoundingRectsForGlyphs)(CTFontRef,CTFontOrientation,CGGlyph*,CGRect*,CFIndex);
CTLineRef (*LineCreateJustifiedLine)(CTLineRef,CGFloat,double);
double (*LineGetTrailingWhitespaceWidth)(CTLineRef);
CGFloat (*LineGetOffsetForStringIndex)(CTLineRef,CFIndex,CGFloat*);
CFArrayRef (*LineGetGlyphRuns)(CTLineRef);
CFIndex (*RunGetGlyphCount)(CTRunRef);
const CGGlyph* (*RunGetGlyphsPtr)(CTRunRef);
const CGPoint* (*RunGetPositionsPtr)(CTRunRef);
const CGSize* (*RunGetAdvancesPtr)(CTRunRef);
const CFIndex * (*RunGetStringIndicesPtr)(CTRunRef);
// singleton helpers
static const DynCoreTextSyms& get( void );
bool IsActive( void ) const { return mbIsActive; }
private:
explicit DynCoreTextSyms( void );
bool mbIsActive;
};
#endif // DISABLE_CORETEXT_DYNLOAD
// =======================================================================
This diff is collapsed.
This diff is collapsed.
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
*/ */
#ifdef ENABLE_CORETEXT #ifdef ENABLE_CORETEXT
# include "coretext/salgdi.h" # include "coretext/salgdi2.h"
#else #else
# include "aqua/atsui/salgdi.h" # include "aqua/atsui/salgdi.h"
#endif #endif
......
This diff is collapsed.
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <vcl/dllapi.h> #include <vcl/dllapi.h>
#include <vcl/vclenum.hxx> #include <vcl/vclenum.hxx>
#include <vcl/fntstyle.hxx> #include <vcl/fntstyle.hxx>
#include <outfont.hxx>
// ------------ // ------------
// - Impl_Font - // - Impl_Font -
...@@ -229,6 +230,8 @@ public: ...@@ -229,6 +230,8 @@ public:
bool ParseCMAP( const unsigned char* pRawData, int nRawLength, CmapResult& ); bool ParseCMAP( const unsigned char* pRawData, int nRawLength, CmapResult& );
void UpdateAttributesFromPSName( const String& rPSName, ImplDevFontAttributes& );
#endif // _SV_IMPFONT_HXX #endif // _SV_IMPFONT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -39,6 +39,11 @@ public: ...@@ -39,6 +39,11 @@ public:
const CGFloat* AsArray() const { return m_fRGBA; } const CGFloat* AsArray() const { return m_fRGBA; }
bool IsVisible() const { return m_fRGBA[3] > 0; } bool IsVisible() const { return m_fRGBA[3] > 0; }
void SetAlpha( float fAlpha ) { m_fRGBA[3] = fAlpha; } void SetAlpha( float fAlpha ) { m_fRGBA[3] = fAlpha; }
CGFloat GetRed() const { return m_fRGBA[0]; }
CGFloat GetGreen() const { return m_fRGBA[1]; }
CGFloat GetBlue() const { return m_fRGBA[2]; }
CGFloat GetAlpha() const { return m_fRGBA[3]; }
private: private:
CGFloat m_fRGBA[4]; // red, green, blue, alpha CGFloat m_fRGBA[4]; // red, green, blue, alpha
}; };
......
...@@ -5846,6 +5846,14 @@ SalLayout* OutputDevice::ImplLayout( const OUString& rOrigStr, sal_Int32 nMinInd ...@@ -5846,6 +5846,14 @@ SalLayout* OutputDevice::ImplLayout( const OUString& rOrigStr, sal_Int32 nMinInd
ImplLayoutArgs aLayoutArgs = ImplPrepareLayoutArgs( aStr, nMinIndex, nLen, nPixelWidth, pDXArray ); 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 // get matching layout object for base font
SalLayout* pSalLayout = NULL; SalLayout* pSalLayout = NULL;
if( mpPDFWriter ) if( mpPDFWriter )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment