summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2016-01-10 10:16:02 +1100
committerChris Sherlock <chris.sherlock79@gmail.com>2016-01-10 02:32:34 +0000
commit416d7ccb4e0c56199034b7fb01aefc988d7783a0 (patch)
tree126239aa091f34e9ebdc2fb71d8297f0909d0d73
parentd538eb2bfa45e07ddb1303330c1e0e80c7c0ead0 (diff)
vcl: (OS X only) Change CoreTextFontData to CoreTextFontFace
The base class is called PhysicalFontFace (I believe it was called something like ImplFontData or somesuch before it was changed), and it is really primarily used to provide a factory function to create the logical font instance that LibreOffice can use (i.e. we distinguish between "physical" and "logical" fonts - as physical font is the actual font installed on the system, and the logical font is the one we ask for and have mapped to the physical font face). I also want to provide naming consistency in the class heirachy to enhance code readability, so that's another reason I've changed this class name. Change-Id: Ib7f23da1e3a1db59f4d04f5bb096f490e2958a4b Reviewed-on: https://gerrit.libreoffice.org/21299 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
-rw-r--r--vcl/inc/quartz/salgdi.h18
-rw-r--r--vcl/quartz/ctfonts.cxx18
-rw-r--r--vcl/quartz/ctlayout.cxx2
-rw-r--r--vcl/quartz/salgdi.cxx34
4 files changed, 36 insertions, 36 deletions
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 836eee2ed5b6..5bfbed295fea 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -54,11 +54,11 @@ typedef sal_uInt32 sal_GlyphId;
typedef std::vector<unsigned char> ByteVector;
// CoreText-specific physically available font face
-class CoreTextFontData : public PhysicalFontFace
+class CoreTextFontFace : public PhysicalFontFace
{
public:
- CoreTextFontData( const ImplFontAttributes&, sal_IntPtr nFontID );
- virtual ~CoreTextFontData();
+ CoreTextFontFace( const ImplFontAttributes&, sal_IntPtr nFontID );
+ virtual ~CoreTextFontFace();
PhysicalFontFace* Clone() const override;
LogicalFontInstance* CreateFontInstance( FontSelectPattern& ) const override;
@@ -74,7 +74,7 @@ public:
void ReadMacCmapEncoding() const;
protected:
- CoreTextFontData( const CoreTextFontData& );
+ CoreTextFontFace( const CoreTextFontFace& );
private:
const sal_IntPtr mnFontId;
@@ -98,7 +98,7 @@ public:
bool GetGlyphBoundRect( sal_GlyphId, Rectangle& ) const;
bool GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ) const;
- const CoreTextFontData* mpFontData;
+ const CoreTextFontFace* mpFontData;
/// <1.0: font is squeezed, >1.0 font is stretched, else 1.0
float mfFontStretch;
/// text rotation in radian
@@ -122,16 +122,16 @@ public:
~SystemFontList( void );
bool Init( void );
- void AddFont( CoreTextFontData* );
+ void AddFont( CoreTextFontFace* );
void AnnounceFonts( PhysicalFontCollection& ) const;
- CoreTextFontData* GetFontDataFromId( sal_IntPtr nFontId ) const;
+ CoreTextFontFace* GetFontDataFromId( sal_IntPtr nFontId ) const;
private:
CTFontCollectionRef mpCTFontCollection;
CFArrayRef mpCTFontArray;
- typedef std::unordered_map<sal_IntPtr,CoreTextFontData*> CTFontContainer;
+ typedef std::unordered_map<sal_IntPtr,CoreTextFontFace*> CTFontContainer;
CTFontContainer maFontContainer;
};
@@ -166,7 +166,7 @@ protected:
RGBAColor maFillColor;
// Device Font settings
- const CoreTextFontData* mpFontData;
+ const CoreTextFontFace* mpFontData;
CoreTextStyle* mpTextStyle;
RGBAColor maTextColor;
/// allows text to be rendered without antialiasing
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index 4d847ba8f9af..e33ce7ea2739 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -45,7 +45,7 @@ inline double toRadian(int nDegree)
}
CoreTextStyle::CoreTextStyle( const FontSelectPattern& rFSD )
- : mpFontData( static_cast<CoreTextFontData const *>(rFSD.mpFontData) )
+ : mpFontData( static_cast<CoreTextFontFace const *>(rFSD.mpFontData) )
, mfFontStretch( 1.0 )
, mfFontRotation( 0.0 )
, mpStyleDict( nullptr )
@@ -235,19 +235,19 @@ bool CoreTextStyle::GetGlyphOutline( sal_GlyphId aGlyphId, basegfx::B2DPolyPolyg
return true;
}
-PhysicalFontFace* CoreTextFontData::Clone() const
+PhysicalFontFace* CoreTextFontFace::Clone() const
{
- return new CoreTextFontData( *this);
+ return new CoreTextFontFace( *this);
}
-LogicalFontInstance* CoreTextFontData::CreateFontInstance( /*const*/ FontSelectPattern& rFSD ) const
+LogicalFontInstance* CoreTextFontFace::CreateFontInstance( /*const*/ FontSelectPattern& rFSD ) const
{
return new LogicalFontInstance( rFSD);
}
-int CoreTextFontData::GetFontTable( const char pTagName[5], unsigned char* pResultBuf ) const
+int CoreTextFontFace::GetFontTable( const char pTagName[5], unsigned char* pResultBuf ) const
{
- DBG_ASSERT( pTagName[4]=='\0', "CoreTextFontData::GetFontTable with invalid tagname!\n" );
+ DBG_ASSERT( pTagName[4]=='\0', "CoreTextFontFace::GetFontTable with invalid tagname!\n" );
const CTFontTableTag nTagCode = (pTagName[0]<<24) + (pTagName[1]<<16) + (pTagName[2]<<8) + (pTagName[3]<<0);
@@ -420,7 +420,7 @@ static void CTFontEnumCallBack( const void* pValue, void* pContext )
if( bFontEnabled)
{
const sal_IntPtr nFontId = reinterpret_cast<sal_IntPtr>(pValue);
- CoreTextFontData* pFontData = new CoreTextFontData( rDFA, nFontId );
+ CoreTextFontFace* pFontData = new CoreTextFontFace( rDFA, nFontId );
SystemFontList* pFontList = static_cast<SystemFontList*>(pContext);
pFontList->AddFont( pFontData );
}
@@ -450,7 +450,7 @@ SystemFontList::~SystemFontList()
}
}
-void SystemFontList::AddFont( CoreTextFontData* pFontData )
+void SystemFontList::AddFont( CoreTextFontFace* pFontData )
{
sal_IntPtr nFontId = pFontData->GetFontId();
maFontContainer[ nFontId ] = pFontData;
@@ -465,7 +465,7 @@ void SystemFontList::AnnounceFonts( PhysicalFontCollection& rFontCollection ) co
}
}
-CoreTextFontData* SystemFontList::GetFontDataFromId( sal_IntPtr nFontId ) const
+CoreTextFontFace* SystemFontList::GetFontDataFromId( sal_IntPtr nFontId ) const
{
CTFontContainer::const_iterator it = maFontContainer.find( nFontId );
if( it == maFontContainer.end() )
diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx
index f13d61747a62..5b0d98e3d3b4 100644
--- a/vcl/quartz/ctlayout.cxx
+++ b/vcl/quartz/ctlayout.cxx
@@ -532,7 +532,7 @@ int CTLayout::GetNextGlyphs( int nLen, sal_GlyphId* pOutGlyphIds, Point& rPos, i
{
if ( !CFEqual( iter->m_pFont, pFont ) )
{
- pFallbackFont = new CoreTextFontData( rDevFontAttr, reinterpret_cast<sal_IntPtr>(pFontDesc) );
+ pFallbackFont = new CoreTextFontFace( rDevFontAttr, reinterpret_cast<sal_IntPtr>(pFontDesc) );
*(pFallbackFonts++) = pFallbackFont;
}
else
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index ca83b61e3748..774252382f54 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -53,7 +53,7 @@
using namespace vcl;
-CoreTextFontData::CoreTextFontData( const CoreTextFontData& rSrc )
+CoreTextFontFace::CoreTextFontFace( const CoreTextFontFace& rSrc )
: PhysicalFontFace( rSrc )
, mnFontId( rSrc.mnFontId )
, mbOs2Read( rSrc.mbOs2Read )
@@ -64,7 +64,7 @@ CoreTextFontData::CoreTextFontData( const CoreTextFontData& rSrc )
mpCharMap = rSrc.mpCharMap;
}
-CoreTextFontData::CoreTextFontData( const ImplFontAttributes& rDFA, sal_IntPtr nFontId )
+CoreTextFontFace::CoreTextFontFace( const ImplFontAttributes& rDFA, sal_IntPtr nFontId )
: PhysicalFontFace( rDFA )
, mnFontId( nFontId )
, mbOs2Read( false )
@@ -74,7 +74,7 @@ CoreTextFontData::CoreTextFontData( const ImplFontAttributes& rDFA, sal_IntPtr n
{
}
-CoreTextFontData::~CoreTextFontData()
+CoreTextFontFace::~CoreTextFontFace()
{
if( mpCharMap )
{
@@ -82,14 +82,14 @@ CoreTextFontData::~CoreTextFontData()
}
}
-sal_IntPtr CoreTextFontData::GetFontId() const
+sal_IntPtr CoreTextFontFace::GetFontId() const
{
return (sal_IntPtr)mnFontId;
}
static unsigned GetUShort( const unsigned char* p ){return((p[0]<<8)+p[1]);}
-const FontCharMapPtr CoreTextFontData::GetFontCharMap() const
+const FontCharMapPtr CoreTextFontFace::GetFontCharMap() const
{
// return the cached charmap
if( mpCharMap )
@@ -102,18 +102,18 @@ const FontCharMapPtr CoreTextFontData::GetFontCharMap() const
// get the CMAP byte size
// allocate a buffer for the CMAP raw data
const int nBufSize = GetFontTable( "cmap", nullptr );
- DBG_ASSERT( (nBufSize > 0), "CoreTextFontData::GetFontCharMap : GetFontTable1 failed!\n");
+ DBG_ASSERT( (nBufSize > 0), "CoreTextFontFace::GetFontCharMap : GetFontTable1 failed!\n");
if( nBufSize <= 0 )
return mpCharMap;
// get the CMAP raw data
ByteVector aBuffer( nBufSize );
const int nRawLength = GetFontTable( "cmap", &aBuffer[0] );
- DBG_ASSERT( (nRawLength > 0), "CoreTextFontData::GetFontCharMap : GetFontTable2 failed!\n");
+ DBG_ASSERT( (nRawLength > 0), "CoreTextFontFace::GetFontCharMap : GetFontTable2 failed!\n");
if( nRawLength <= 0 )
return mpCharMap;
- DBG_ASSERT( (nBufSize==nRawLength), "CoreTextFontData::GetFontCharMap : ByteCount mismatch!\n");
+ DBG_ASSERT( (nBufSize==nRawLength), "CoreTextFontFace::GetFontCharMap : ByteCount mismatch!\n");
// parse the CMAP
CmapResult aCmapResult;
@@ -127,7 +127,7 @@ const FontCharMapPtr CoreTextFontData::GetFontCharMap() const
return mpCharMap;
}
-bool CoreTextFontData::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const
+bool CoreTextFontFace::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const
{
// read this only once per font
if( mbFontCapabilitiesRead )
@@ -171,7 +171,7 @@ bool CoreTextFontData::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilit
return !rFontCapabilities.maUnicodeRange.empty() || !rFontCapabilities.maCodePageRange.empty();
}
-void CoreTextFontData::ReadOs2Table() const
+void CoreTextFontFace::ReadOs2Table() const
{
// read this only once per font
if( mbOs2Read )
@@ -182,25 +182,25 @@ void CoreTextFontData::ReadOs2Table() const
// prepare to get the OS/2 table raw data
const int nBufSize = GetFontTable( "OS/2", nullptr );
- DBG_ASSERT( (nBufSize > 0), "CoreTextFontData::ReadOs2Table : GetFontTable1 failed!\n");
+ DBG_ASSERT( (nBufSize > 0), "CoreTextFontFace::ReadOs2Table : GetFontTable1 failed!\n");
if( nBufSize <= 0 )
return;
// get the OS/2 raw data
ByteVector aBuffer( nBufSize );
const int nRawLength = GetFontTable( "cmap", &aBuffer[0] );
- DBG_ASSERT( (nRawLength > 0), "CoreTextFontData::ReadOs2Table : GetFontTable2 failed!\n");
+ DBG_ASSERT( (nRawLength > 0), "CoreTextFontFace::ReadOs2Table : GetFontTable2 failed!\n");
if( nRawLength <= 0 )
return;
- DBG_ASSERT( (nBufSize==nRawLength), "CoreTextFontData::ReadOs2Table : ByteCount mismatch!\n");
+ DBG_ASSERT( (nBufSize==nRawLength), "CoreTextFontFace::ReadOs2Table : ByteCount mismatch!\n");
mbHasOs2Table = true;
// parse the OS/2 raw data
// TODO: also analyze panose info, etc.
}
-void CoreTextFontData::ReadMacCmapEncoding() const
+void CoreTextFontFace::ReadMacCmapEncoding() const
{
// read this only once per font
if( mbCmapEncodingRead )
@@ -217,7 +217,7 @@ void CoreTextFontData::ReadMacCmapEncoding() const
const int nRawLength = GetFontTable( "cmap", &aBuffer[0] );
if( nRawLength < 24 )
return;
- DBG_ASSERT( (nBufSize==nRawLength), "CoreTextFontData::ReadMacCmapEncoding : ByteCount mismatch!\n");
+ DBG_ASSERT( (nBufSize==nRawLength), "CoreTextFontFace::ReadMacCmapEncoding : ByteCount mismatch!\n");
const unsigned char* pCmap = &aBuffer[0];
if( GetUShort( pCmap ) != 0x0000 )
@@ -430,7 +430,7 @@ sal_uInt16 AquaSalGraphics::SetFont( FontSelectPattern* pReqFont, int /*nFallbac
}
// update the text style
- mpFontData = static_cast<const CoreTextFontData*>( pReqFont->mpFontData );
+ mpFontData = static_cast<const CoreTextFontFace*>( pReqFont->mpFontData );
mpTextStyle = new CoreTextStyle( *pReqFont );
SAL_INFO("vcl.ct",
@@ -506,7 +506,7 @@ static void FakeDirEntry( const char aTag[5], ByteCount nOfs, ByteCount nLen,
bool AquaSalGraphics::GetRawFontData( const PhysicalFontFace* pFontData,
ByteVector& rBuffer, bool* pJustCFF )
{
- const CoreTextFontData* pMacFont = static_cast<const CoreTextFontData*>(pFontData);
+ const CoreTextFontFace* pMacFont = static_cast<const CoreTextFontFace*>(pFontData);
// short circuit for CFF-only fonts
const int nCffSize = pMacFont->GetFontTable( "CFF ", nullptr);