Kaydet (Commit) 0379f8b6 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Re-factoring: Avoid pointless class derivation

Rename the CoreText-specific ImplMacFontData class to CoreTextFontData
and unify it with its sole derived class CTFontData.

Change-Id: Id3540432996ca55b2e4a20fd8798c94cb7bc84b6
üst f0d93fab
...@@ -44,16 +44,16 @@ public: ...@@ -44,16 +44,16 @@ public:
virtual ~CTFontList( void ); virtual ~CTFontList( void );
bool Init( void ); bool Init( void );
void AddFont( CTFontData* ); void AddFont( CoreTextFontData* );
virtual void AnnounceFonts( ImplDevFontList& ) const; virtual void AnnounceFonts( ImplDevFontList& ) const;
virtual ImplMacFontData* GetFontDataFromId( sal_IntPtr ) const; virtual CoreTextFontData* GetFontDataFromId( sal_IntPtr ) const;
private: private:
CTFontCollectionRef mpCTFontCollection; CTFontCollectionRef mpCTFontCollection;
CFArrayRef mpCTFontArray; CFArrayRef mpCTFontArray;
typedef boost::unordered_map<sal_IntPtr,CTFontData*> CTFontContainer; typedef boost::unordered_map<sal_IntPtr,CoreTextFontData*> CTFontContainer;
CTFontContainer maFontContainer; CTFontContainer maFontContainer;
}; };
...@@ -65,12 +65,12 @@ inline double toRadian(int nDegree) ...@@ -65,12 +65,12 @@ inline double toRadian(int nDegree)
} }
CoreTextStyle::CoreTextStyle( const FontSelectPattern& rFSD ) CoreTextStyle::CoreTextStyle( const FontSelectPattern& rFSD )
: mpFontData( (ImplMacFontData*)rFSD.mpFontData ) : mpFontData( (CoreTextFontData*)rFSD.mpFontData )
, mfFontStretch( 1.0 ) , mfFontStretch( 1.0 )
, mfFontRotation( 0.0 ) , mfFontRotation( 0.0 )
, mpStyleDict( NULL ) , mpStyleDict( NULL )
{ {
mpFontData = (CTFontData*)rFSD.mpFontData; mpFontData = (CoreTextFontData*)rFSD.mpFontData;
const FontSelectPattern* const pReqFont = &rFSD; const FontSelectPattern* const pReqFont = &rFSD;
double fScaledFontHeight = pReqFont->mfExactHeight; double fScaledFontHeight = pReqFont->mfExactHeight;
...@@ -249,43 +249,30 @@ void CoreTextStyle::SetTextColor( const RGBAColor& rColor ) ...@@ -249,43 +249,30 @@ void CoreTextStyle::SetTextColor( const RGBAColor& rColor )
// ======================================================================= // =======================================================================
CTFontData::CTFontData( const ImplDevFontAttributes& rDFA, sal_IntPtr nFontId ) PhysicalFontFace* CoreTextFontData::Clone( void ) const
: ImplMacFontData( rDFA, nFontId )
{}
// -----------------------------------------------------------------------
CTFontData::~CTFontData( void )
{
// TODO: any resources to release?
}
// -----------------------------------------------------------------------
PhysicalFontFace* CTFontData::Clone( void ) const
{ {
return new CTFontData( *this); return new CoreTextFontData( *this);
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
CoreTextStyle* CTFontData::CreateTextStyle( const FontSelectPattern& rFSD ) const CoreTextStyle* CoreTextFontData::CreateTextStyle( const FontSelectPattern& rFSD ) const
{ {
return new CoreTextStyle( rFSD); return new CoreTextStyle( rFSD);
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
ImplFontEntry* CTFontData::CreateFontInstance( /*const*/ FontSelectPattern& rFSD ) const ImplFontEntry* CoreTextFontData::CreateFontInstance( /*const*/ FontSelectPattern& rFSD ) const
{ {
return new ImplFontEntry( rFSD); return new ImplFontEntry( rFSD);
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
int CTFontData::GetFontTable( const char pTagName[5], unsigned char* pResultBuf ) const int CoreTextFontData::GetFontTable( const char pTagName[5], unsigned char* pResultBuf ) const
{ {
DBG_ASSERT( pTagName[4]=='\0', "CTFontData::GetFontTable with invalid tagname!\n" ); DBG_ASSERT( pTagName[4]=='\0', "CoreTextFontData::GetFontTable with invalid tagname!\n" );
const CTFontTableTag nTagCode = (pTagName[0]<<24) + (pTagName[1]<<16) + (pTagName[2]<<8) + (pTagName[3]<<0); const CTFontTableTag nTagCode = (pTagName[0]<<24) + (pTagName[1]<<16) + (pTagName[2]<<8) + (pTagName[3]<<0);
...@@ -423,7 +410,7 @@ static void CTFontEnumCallBack( const void* pValue, void* pContext ) ...@@ -423,7 +410,7 @@ static void CTFontEnumCallBack( const void* pValue, void* pContext )
if( bFontEnabled) if( bFontEnabled)
{ {
const sal_IntPtr nFontId = (sal_IntPtr)pValue; const sal_IntPtr nFontId = (sal_IntPtr)pValue;
CTFontData* pFontData = new CTFontData( rDFA, nFontId ); CoreTextFontData* pFontData = new CoreTextFontData( rDFA, nFontId );
CTFontList* pFontList = (CTFontList*)pContext; CTFontList* pFontList = (CTFontList*)pContext;
pFontList->AddFont( pFontData ); pFontList->AddFont( pFontData );
} }
...@@ -453,7 +440,7 @@ CTFontList::~CTFontList() ...@@ -453,7 +440,7 @@ CTFontList::~CTFontList()
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
void CTFontList::AddFont( CTFontData* pFontData ) void CTFontList::AddFont( CoreTextFontData* pFontData )
{ {
sal_IntPtr nFontId = pFontData->GetFontId(); sal_IntPtr nFontId = pFontData->GetFontId();
maFontContainer[ nFontId ] = pFontData; maFontContainer[ nFontId ] = pFontData;
...@@ -470,7 +457,7 @@ void CTFontList::AnnounceFonts( ImplDevFontList& rFontList ) const ...@@ -470,7 +457,7 @@ void CTFontList::AnnounceFonts( ImplDevFontList& rFontList ) const
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
ImplMacFontData* CTFontList::GetFontDataFromId( sal_IntPtr nFontId ) const CoreTextFontData* CTFontList::GetFontDataFromId( sal_IntPtr nFontId ) const
{ {
CTFontContainer::const_iterator it = maFontContainer.find( nFontId ); CTFontContainer::const_iterator it = maFontContainer.find( nFontId );
if( it == maFontContainer.end() ) if( it == maFontContainer.end() )
......
...@@ -23,21 +23,6 @@ ...@@ -23,21 +23,6 @@
#endif #endif
#include "sallayout.hxx" #include "sallayout.hxx"
// CoreText specific physically available font face
class CTFontData
: public ImplMacFontData
{
public:
explicit CTFontData( const ImplDevFontAttributes&, sal_IntPtr nFontId );
explicit CTFontData( CTFontDescriptorRef pFontDesc );
virtual ~CTFontData( void );
virtual PhysicalFontFace* Clone( void ) const;
virtual CoreTextStyle* CreateTextStyle( const FontSelectPattern& ) const;
virtual ImplFontEntry* CreateFontInstance( /*const*/ FontSelectPattern& ) const;
virtual int GetFontTable( const char pTagName[5], unsigned char* ) const;
};
SystemFontList* GetCoretextFontList(void); SystemFontList* GetCoretextFontList(void);
ImplDevFontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef, bool* ); ImplDevFontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef, bool* );
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -316,7 +316,7 @@ int CTLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIDs, Point& rPos, int& ...@@ -316,7 +316,7 @@ int CTLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIDs, Point& rPos, int&
if ( !CFEqual( pRunFont, pFont ) ) { if ( !CFEqual( pRunFont, pFont ) ) {
CTFontDescriptorRef pFontDesc = CTFontCopyFontDescriptor( pRunFont ); CTFontDescriptorRef pFontDesc = CTFontCopyFontDescriptor( pRunFont );
ImplDevFontAttributes rDevFontAttr = DevFontFromCTFontDescriptor( pFontDesc, NULL ); ImplDevFontAttributes rDevFontAttr = DevFontFromCTFontDescriptor( pFontDesc, NULL );
pFallbackFont = new CTFontData( rDevFontAttr, (sal_IntPtr)pFontDesc ); pFallbackFont = new CoreTextFontData( rDevFontAttr, (sal_IntPtr)pFontDesc );
} }
} }
......
...@@ -67,7 +67,7 @@ SystemFontList::~SystemFontList( void ) ...@@ -67,7 +67,7 @@ SystemFontList::~SystemFontList( void )
// ======================================================================= // =======================================================================
ImplMacFontData::ImplMacFontData( const ImplMacFontData& rSrc ) CoreTextFontData::CoreTextFontData( const CoreTextFontData& rSrc )
: PhysicalFontFace( rSrc ) : PhysicalFontFace( rSrc )
, mnFontId( rSrc.mnFontId ) , mnFontId( rSrc.mnFontId )
, mpCharMap( rSrc.mpCharMap ) , mpCharMap( rSrc.mpCharMap )
...@@ -81,7 +81,7 @@ ImplMacFontData::ImplMacFontData( const ImplMacFontData& rSrc ) ...@@ -81,7 +81,7 @@ ImplMacFontData::ImplMacFontData( const ImplMacFontData& rSrc )
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
ImplMacFontData::ImplMacFontData( const ImplDevFontAttributes& rDFA, sal_IntPtr nFontId ) CoreTextFontData::CoreTextFontData( const ImplDevFontAttributes& rDFA, sal_IntPtr nFontId )
: PhysicalFontFace( rDFA, 0 ) : PhysicalFontFace( rDFA, 0 )
, mnFontId( nFontId ) , mnFontId( nFontId )
, mpCharMap( NULL ) , mpCharMap( NULL )
...@@ -89,11 +89,12 @@ ImplMacFontData::ImplMacFontData( const ImplDevFontAttributes& rDFA, sal_IntPtr ...@@ -89,11 +89,12 @@ ImplMacFontData::ImplMacFontData( const ImplDevFontAttributes& rDFA, sal_IntPtr
, mbHasOs2Table( false ) , mbHasOs2Table( false )
, mbCmapEncodingRead( false ) , mbCmapEncodingRead( false )
, mbFontCapabilitiesRead( false ) , mbFontCapabilitiesRead( false )
{} {
}
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
ImplMacFontData::~ImplMacFontData() CoreTextFontData::~CoreTextFontData()
{ {
if( mpCharMap ) if( mpCharMap )
mpCharMap->DeReference(); mpCharMap->DeReference();
...@@ -101,23 +102,16 @@ ImplMacFontData::~ImplMacFontData() ...@@ -101,23 +102,16 @@ ImplMacFontData::~ImplMacFontData()
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
sal_IntPtr ImplMacFontData::GetFontId() const sal_IntPtr CoreTextFontData::GetFontId() const
{ {
return (sal_IntPtr)mnFontId; return (sal_IntPtr)mnFontId;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
ImplFontEntry* ImplMacFontData::CreateFontInstance(FontSelectPattern& rFSD) const
{
return new ImplFontEntry(rFSD);
}
// -----------------------------------------------------------------------
static unsigned GetUShort( const unsigned char* p ){return((p[0]<<8)+p[1]);} static unsigned GetUShort( const unsigned char* p ){return((p[0]<<8)+p[1]);}
const ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const const ImplFontCharMap* CoreTextFontData::GetImplFontCharMap() const
{ {
// return the cached charmap // return the cached charmap
if( mpCharMap ) if( mpCharMap )
...@@ -130,17 +124,17 @@ const ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const ...@@ -130,17 +124,17 @@ const ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const
// get the CMAP byte size // get the CMAP byte size
// allocate a buffer for the CMAP raw data // allocate a buffer for the CMAP raw data
const int nBufSize = GetFontTable( "cmap", NULL ); const int nBufSize = GetFontTable( "cmap", NULL );
DBG_ASSERT( (nBufSize > 0), "ImplMacFontData::GetImplFontCharMap : GetFontTable1 failed!\n"); DBG_ASSERT( (nBufSize > 0), "CoreTextFontData::GetImplFontCharMap : GetFontTable1 failed!\n");
if( nBufSize <= 0 ) if( nBufSize <= 0 )
return mpCharMap; return mpCharMap;
// get the CMAP raw data // get the CMAP raw data
ByteVector aBuffer( nBufSize ); ByteVector aBuffer( nBufSize );
const int nRawLength = GetFontTable( "cmap", &aBuffer[0] ); const int nRawLength = GetFontTable( "cmap", &aBuffer[0] );
DBG_ASSERT( (nRawLength > 0), "ImplMacFontData::GetImplFontCharMap : GetFontTable2 failed!\n"); DBG_ASSERT( (nRawLength > 0), "CoreTextFontData::GetImplFontCharMap : GetFontTable2 failed!\n");
if( nRawLength <= 0 ) if( nRawLength <= 0 )
return mpCharMap; return mpCharMap;
DBG_ASSERT( (nBufSize==nRawLength), "ImplMacFontData::GetImplFontCharMap : ByteCount mismatch!\n"); DBG_ASSERT( (nBufSize==nRawLength), "CoreTextFontData::GetImplFontCharMap : ByteCount mismatch!\n");
// parse the CMAP // parse the CMAP
CmapResult aCmapResult; CmapResult aCmapResult;
...@@ -155,7 +149,7 @@ const ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const ...@@ -155,7 +149,7 @@ const ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const
return mpCharMap; return mpCharMap;
} }
bool ImplMacFontData::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const bool CoreTextFontData::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const
{ {
// read this only once per font // read this only once per font
if( mbFontCapabilitiesRead ) if( mbFontCapabilitiesRead )
...@@ -202,7 +196,7 @@ bool ImplMacFontData::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabi ...@@ -202,7 +196,7 @@ bool ImplMacFontData::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabi
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
void ImplMacFontData::ReadOs2Table( void ) const void CoreTextFontData::ReadOs2Table( void ) const
{ {
// read this only once per font // read this only once per font
if( mbOs2Read ) if( mbOs2Read )
...@@ -212,24 +206,24 @@ void ImplMacFontData::ReadOs2Table( void ) const ...@@ -212,24 +206,24 @@ void ImplMacFontData::ReadOs2Table( void ) const
// prepare to get the OS/2 table raw data // prepare to get the OS/2 table raw data
const int nBufSize = GetFontTable( "OS/2", NULL ); const int nBufSize = GetFontTable( "OS/2", NULL );
DBG_ASSERT( (nBufSize > 0), "ImplMacFontData::ReadOs2Table : GetFontTable1 failed!\n"); DBG_ASSERT( (nBufSize > 0), "CoreTextFontData::ReadOs2Table : GetFontTable1 failed!\n");
if( nBufSize <= 0 ) if( nBufSize <= 0 )
return; return;
// get the OS/2 raw data // get the OS/2 raw data
ByteVector aBuffer( nBufSize ); ByteVector aBuffer( nBufSize );
const int nRawLength = GetFontTable( "cmap", &aBuffer[0] ); const int nRawLength = GetFontTable( "cmap", &aBuffer[0] );
DBG_ASSERT( (nRawLength > 0), "ImplMacFontData::ReadOs2Table : GetFontTable2 failed!\n"); DBG_ASSERT( (nRawLength > 0), "CoreTextFontData::ReadOs2Table : GetFontTable2 failed!\n");
if( nRawLength <= 0 ) if( nRawLength <= 0 )
return; return;
DBG_ASSERT( (nBufSize==nRawLength), "ImplMacFontData::ReadOs2Table : ByteCount mismatch!\n"); DBG_ASSERT( (nBufSize==nRawLength), "CoreTextFontData::ReadOs2Table : ByteCount mismatch!\n");
mbHasOs2Table = true; mbHasOs2Table = true;
// parse the OS/2 raw data // parse the OS/2 raw data
// TODO: also analyze panose info, etc. // TODO: also analyze panose info, etc.
} }
void ImplMacFontData::ReadMacCmapEncoding( void ) const void CoreTextFontData::ReadMacCmapEncoding( void ) const
{ {
// read this only once per font // read this only once per font
if( mbCmapEncodingRead ) if( mbCmapEncodingRead )
...@@ -245,7 +239,7 @@ void ImplMacFontData::ReadMacCmapEncoding( void ) const ...@@ -245,7 +239,7 @@ void ImplMacFontData::ReadMacCmapEncoding( void ) const
const int nRawLength = GetFontTable( "cmap", &aBuffer[0] ); const int nRawLength = GetFontTable( "cmap", &aBuffer[0] );
if( nRawLength < 24 ) if( nRawLength < 24 )
return; return;
DBG_ASSERT( (nBufSize==nRawLength), "ImplMacFontData::ReadMacCmapEncoding : ByteCount mismatch!\n"); DBG_ASSERT( (nBufSize==nRawLength), "CoreTextFontData::ReadMacCmapEncoding : ByteCount mismatch!\n");
const unsigned char* pCmap = &aBuffer[0]; const unsigned char* pCmap = &aBuffer[0];
if( GetUShort( pCmap ) != 0x0000 ) if( GetUShort( pCmap ) != 0x0000 )
...@@ -270,7 +264,7 @@ AquaSalGraphics::AquaSalGraphics() ...@@ -270,7 +264,7 @@ AquaSalGraphics::AquaSalGraphics()
, mxClipPath( NULL ) , mxClipPath( NULL )
, maLineColor( COL_WHITE ) , maLineColor( COL_WHITE )
, maFillColor( COL_BLACK ) , maFillColor( COL_BLACK )
, mpMacFontData( NULL ) , mpFontData( NULL )
, mpTextStyle( NULL ) , mpTextStyle( NULL )
, maTextColor( COL_BLACK ) , maTextColor( COL_BLACK )
, mbNonAntialiasedText( false ) , mbNonAntialiasedText( false )
...@@ -280,7 +274,7 @@ AquaSalGraphics::AquaSalGraphics() ...@@ -280,7 +274,7 @@ AquaSalGraphics::AquaSalGraphics()
#else #else
: mrContext( NULL ) : mrContext( NULL )
, mfFakeDPIScale( 1.0 ) , mfFakeDPIScale( 1.0 )
, mpMacFontData( NULL ) , mpFontData( NULL )
, mpTextStyle( NULL ) , mpTextStyle( NULL )
, maTextColor( COL_BLACK ) , maTextColor( COL_BLACK )
, mbNonAntialiasedText( false ) , mbNonAntialiasedText( false )
...@@ -458,20 +452,20 @@ sal_uInt16 AquaSalGraphics::SetFont( FontSelectPattern* pReqFont, int /*nFallbac ...@@ -458,20 +452,20 @@ sal_uInt16 AquaSalGraphics::SetFont( FontSelectPattern* pReqFont, int /*nFallbac
// handle NULL request meaning: release-font-resources request // handle NULL request meaning: release-font-resources request
if( !pReqFont ) if( !pReqFont )
{ {
mpMacFontData = NULL; mpFontData = NULL;
return 0; return 0;
} }
// update the text style // update the text style
mpMacFontData = static_cast<const ImplMacFontData*>( pReqFont->mpFontData ); mpFontData = static_cast<const CoreTextFontData*>( pReqFont->mpFontData );
mpTextStyle = mpMacFontData->CreateTextStyle( *pReqFont ); mpTextStyle = mpFontData->CreateTextStyle( *pReqFont );
mpTextStyle->SetTextColor( maTextColor ); mpTextStyle->SetTextColor( maTextColor );
SAL_INFO("vcl.coretext", SAL_INFO("vcl.coretext",
"SetFont" "SetFont"
<< " to " << mpMacFontData->GetFamilyName() << " to " << mpFontData->GetFamilyName()
<< ", " << mpMacFontData->GetStyleName() << ", " << mpFontData->GetStyleName()
<< " fontid=" << mpMacFontData->GetFontId() << " fontid=" << mpFontData->GetFontId()
<< " for " << pReqFont->GetFamilyName() << " for " << pReqFont->GetFamilyName()
<< ", " << pReqFont->GetStyleName() << ", " << pReqFont->GetStyleName()
<< " weight=" << pReqFont->GetWeight() << " weight=" << pReqFont->GetWeight()
...@@ -495,18 +489,18 @@ SalLayout* AquaSalGraphics::GetTextLayout( ImplLayoutArgs& /*rArgs*/, int /*nFal ...@@ -495,18 +489,18 @@ SalLayout* AquaSalGraphics::GetTextLayout( ImplLayoutArgs& /*rArgs*/, int /*nFal
const ImplFontCharMap* AquaSalGraphics::GetImplFontCharMap() const const ImplFontCharMap* AquaSalGraphics::GetImplFontCharMap() const
{ {
if( !mpMacFontData ) if( !mpFontData )
return ImplFontCharMap::GetDefaultMap(); return ImplFontCharMap::GetDefaultMap();
return mpMacFontData->GetImplFontCharMap(); return mpFontData->GetImplFontCharMap();
} }
bool AquaSalGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const bool AquaSalGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const
{ {
if( !mpMacFontData ) if( !mpFontData )
return false; return false;
return mpMacFontData->GetImplFontCapabilities(rFontCapabilities); return mpFontData->GetImplFontCapabilities(rFontCapabilities);
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
...@@ -543,7 +537,7 @@ static void FakeDirEntry( const char aTag[5], ByteCount nOfs, ByteCount nLen, ...@@ -543,7 +537,7 @@ static void FakeDirEntry( const char aTag[5], ByteCount nOfs, ByteCount nLen,
bool AquaSalGraphics::GetRawFontData( const PhysicalFontFace* pFontData, bool AquaSalGraphics::GetRawFontData( const PhysicalFontFace* pFontData,
ByteVector& rBuffer, bool* pJustCFF ) ByteVector& rBuffer, bool* pJustCFF )
{ {
const ImplMacFontData* pMacFont = static_cast<const ImplMacFontData*>(pFontData); const CoreTextFontData* pMacFont = static_cast<const CoreTextFontData*>(pFontData);
// short circuit for CFF-only fonts // short circuit for CFF-only fonts
const int nCffSize = pMacFont->GetFontTable( "CFF ", NULL); const int nCffSize = pMacFont->GetFontTable( "CFF ", NULL);
...@@ -734,7 +728,7 @@ void AquaSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFontData, bool bV ...@@ -734,7 +728,7 @@ void AquaSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFontData, bool bV
free( (void*)pGlyphMetrics ); free( (void*)pGlyphMetrics );
} }
const ImplFontCharMap* pMap = mpMacFontData->GetImplFontCharMap(); const ImplFontCharMap* pMap = mpFontData->GetImplFontCharMap();
DBG_ASSERT( pMap && pMap->GetCharCount(), "no charmap" ); DBG_ASSERT( pMap && pMap->GetCharCount(), "no charmap" );
pMap->AddReference(); // TODO: add and use RAII object instead pMap->AddReference(); // TODO: add and use RAII object instead
......
...@@ -49,20 +49,20 @@ class CoreTextStyle; ...@@ -49,20 +49,20 @@ class CoreTextStyle;
typedef sal_uInt32 sal_GlyphId; typedef sal_uInt32 sal_GlyphId;
typedef std::vector<unsigned char> ByteVector; typedef std::vector<unsigned char> ByteVector;
// mac specific physically available font face // CoreText-specific physically available font face
class ImplMacFontData : public PhysicalFontFace class CoreTextFontData : public PhysicalFontFace
{ {
public: public:
ImplMacFontData( const ImplDevFontAttributes&, sal_IntPtr nFontID ); CoreTextFontData( const ImplDevFontAttributes&, sal_IntPtr nFontID );
virtual ~ImplMacFontData(); ~CoreTextFontData();
virtual PhysicalFontFace* Clone() const = 0; PhysicalFontFace* Clone() const;
virtual ImplFontEntry* CreateFontInstance( FontSelectPattern& ) const; ImplFontEntry* CreateFontInstance( FontSelectPattern& ) const;
virtual sal_IntPtr GetFontId() const; sal_IntPtr GetFontId() const;
virtual CoreTextStyle* CreateTextStyle( const FontSelectPattern& ) const = 0; CoreTextStyle* CreateTextStyle( const FontSelectPattern& ) const;
virtual int GetFontTable( const char pTagName[5], unsigned char* ) const = 0; int GetFontTable( const char pTagName[5], unsigned char* ) const;
const ImplFontCharMap* GetImplFontCharMap() const; const ImplFontCharMap* GetImplFontCharMap() const;
bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const; bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const;
...@@ -72,7 +72,8 @@ public: ...@@ -72,7 +72,8 @@ public:
void ReadMacCmapEncoding() const; void ReadMacCmapEncoding() const;
protected: protected:
ImplMacFontData( const ImplMacFontData&); CoreTextFontData( const CoreTextFontData&);
private: private:
const sal_IntPtr mnFontId; const sal_IntPtr mnFontId;
mutable const ImplFontCharMap* mpCharMap; mutable const ImplFontCharMap* mpCharMap;
...@@ -97,7 +98,7 @@ public: ...@@ -97,7 +98,7 @@ public:
void SetTextColor( const RGBAColor& ); void SetTextColor( const RGBAColor& );
const ImplMacFontData* mpFontData; const CoreTextFontData* mpFontData;
/// <1.0: font is squeezed, >1.0 font is stretched, else 1.0 /// <1.0: font is squeezed, >1.0 font is stretched, else 1.0
float mfFontStretch; float mfFontStretch;
/// text rotation in radian /// text rotation in radian
...@@ -121,7 +122,7 @@ public: ...@@ -121,7 +122,7 @@ public:
virtual ~SystemFontList( void ); virtual ~SystemFontList( void );
virtual void AnnounceFonts( ImplDevFontList& ) const = 0; virtual void AnnounceFonts( ImplDevFontList& ) const = 0;
virtual ImplMacFontData* GetFontDataFromId( sal_IntPtr nFontId ) const = 0; virtual CoreTextFontData* GetFontDataFromId( sal_IntPtr nFontId ) const = 0;
}; };
#ifdef MACOSX #ifdef MACOSX
...@@ -160,8 +161,8 @@ protected: ...@@ -160,8 +161,8 @@ protected:
RGBAColor maFillColor; RGBAColor maFillColor;
// Device Font settings // Device Font settings
const ImplMacFontData* mpMacFontData; const CoreTextFontData* mpFontData;
CoreTextStyle* mpTextStyle; CoreTextStyle* mpTextStyle;
RGBAColor maTextColor; RGBAColor maTextColor;
/// allows text to be rendered without antialiasing /// allows text to be rendered without antialiasing
bool mbNonAntialiasedText; bool mbNonAntialiasedText;
......
...@@ -89,7 +89,7 @@ protected: ...@@ -89,7 +89,7 @@ protected:
double mfFakeDPIScale; double mfFakeDPIScale;
// Device Font settings // Device Font settings
const ImplMacFontData* mpMacFontData; const CoreTextFontData* mpFontData;
CoreTextStyle* mpTextStyle; CoreTextStyle* mpTextStyle;
RGBAColor maTextColor; RGBAColor maTextColor;
/// allows text to be rendered without antialiasing /// allows text to be rendered without antialiasing
......
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