summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaled@aliftype.com>2022-10-01 07:45:32 +0200
committerخالد حسني <khaled@aliftype.com>2022-10-01 13:09:23 +0200
commitc107d08460938270cbc2a32a89d995fc0ae8ebea (patch)
tree3893c32c1f7d1b066fd15be9144f05c4468beaf7
parentcaa10a1f80da856debf4f397503f27c86199208f (diff)
vcl: Remove unused AquaSalGraphics::GetRawFontData()
It was used for subsetting, but we switched subsetting to a more generic code path a while ago. Change-Id: I6066b7697268e9444587d73810f9465488aa4740 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140825 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
-rw-r--r--vcl/inc/quartz/salgdi.h6
-rw-r--r--vcl/quartz/ctfonts.cxx9
-rw-r--r--vcl/quartz/salgdi.cxx215
3 files changed, 0 insertions, 230 deletions
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 4435e9fd86c9..ec63592431e3 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -67,7 +67,6 @@ public:
sal_IntPtr GetFontId() const override;
int GetFontTable( uint32_t nTagCode, unsigned char* ) const;
- int GetFontTable( const char pTagName[5], unsigned char* ) const;
rtl::Reference<LogicalFontInstance> CreateFontInstance(const vcl::font::FontSelectPattern&) const override;
@@ -552,11 +551,6 @@ public:
virtual SystemGraphicsData
GetGraphicsData() const override;
-
-private:
- static bool GetRawFontData( const vcl::font::PhysicalFontFace* pFontData,
- std::vector<unsigned char>& rBuffer,
- bool* pJustCFF );
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index 83412955c0a4..9166d323f7dd 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -302,15 +302,6 @@ rtl::Reference<LogicalFontInstance> CoreTextFontFace::CreateFontInstance(const v
return new CoreTextStyle(*this, rFSD);
}
-int CoreTextFontFace::GetFontTable( const char pTagName[5], unsigned char* pResultBuf ) const
-{
- SAL_WARN_IF( pTagName[4]!='\0', "vcl", "CoreTextFontFace::GetFontTable with invalid tagname!" );
-
- const CTFontTableTag nTagCode = (pTagName[0]<<24) + (pTagName[1]<<16) + (pTagName[2]<<8) + (pTagName[3]<<0);
-
- return GetFontTable(nTagCode, pResultBuf);
-}
-
int CoreTextFontFace::GetFontTable(uint32_t nTagCode, unsigned char* pResultBuf ) const
{
// get the raw table length
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index e27b2f1c2c32..7267e1a83cad 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -484,221 +484,6 @@ bool AquaSalGraphics::GetFontCapabilities(vcl::FontCapabilities &rFontCapabiliti
return mpTextStyle[0]->GetFontFace()->GetFontCapabilities(rFontCapabilities);
}
-// fake a SFNT font directory entry for a font table
-// see http://developer.apple.com/fonts/TTRefMan/RM06/Chap6.html#Directory
-static void FakeDirEntry( const char aTag[5], ByteCount nOfs, ByteCount nLen,
- const unsigned char* /*pData*/, unsigned char*& rpDest )
-{
- // write entry tag
- rpDest[ 0] = aTag[0];
- rpDest[ 1] = aTag[1];
- rpDest[ 2] = aTag[2];
- rpDest[ 3] = aTag[3];
- // TODO: get entry checksum and write it
- // not too important since the subsetter doesn't care currently
- // for( pData+nOfs ... pData+nOfs+nLen )
- // write entry offset
- rpDest[ 8] = static_cast<char>(nOfs >> 24);
- rpDest[ 9] = static_cast<char>(nOfs >> 16);
- rpDest[10] = static_cast<char>(nOfs >> 8);
- rpDest[11] = static_cast<char>(nOfs >> 0);
- // write entry length
- rpDest[12] = static_cast<char>(nLen >> 24);
- rpDest[13] = static_cast<char>(nLen >> 16);
- rpDest[14] = static_cast<char>(nLen >> 8);
- rpDest[15] = static_cast<char>(nLen >> 0);
- // advance to next entry
- rpDest += 16;
-}
-
-// fake a TTF or CFF font as directly accessing font file is not possible
-// when only the fontid is known. This approach also handles *.font fonts.
-bool AquaSalGraphics::GetRawFontData( const vcl::font::PhysicalFontFace* pFontData,
- std::vector<unsigned char>& rBuffer, bool* pJustCFF )
-{
- const CoreTextFontFace* pMacFont = static_cast<const CoreTextFontFace*>(pFontData);
-
- // short circuit for CFF-only fonts
- const int nCffSize = pMacFont->GetFontTable( "CFF ", nullptr);
- if( pJustCFF != nullptr )
- {
- *pJustCFF = (nCffSize > 0);
- if( *pJustCFF)
- {
- rBuffer.resize( nCffSize);
- const int nCffRead = pMacFont->GetFontTable( "CFF ", rBuffer.data());
- if( nCffRead != nCffSize)
- {
- return false;
- }
- return true;
- }
- }
-
- // get font table availability and size in bytes
- const int nHeadSize = pMacFont->GetFontTable( "head", nullptr);
- if( nHeadSize <= 0)
- return false;
-
- const int nMaxpSize = pMacFont->GetFontTable( "maxp", nullptr);
- if( nMaxpSize <= 0)
- return false;
-
- const int nCmapSize = pMacFont->GetFontTable( "cmap", nullptr);
- if( nCmapSize <= 0)
- return false;
-
- const int nNameSize = pMacFont->GetFontTable( "name", nullptr);
- if( nNameSize <= 0)
- return false;
-
- const int nHheaSize = pMacFont->GetFontTable( "hhea", nullptr);
- if( nHheaSize <= 0)
- return false;
-
- const int nHmtxSize = pMacFont->GetFontTable( "hmtx", nullptr);
- if( nHmtxSize <= 0)
- return false;
-
- // get the ttf-glyf outline tables
- int nLocaSize = 0;
- int nGlyfSize = 0;
- if( nCffSize <= 0)
- {
- nLocaSize = pMacFont->GetFontTable( "loca", nullptr);
- if( nLocaSize <= 0)
- return false;
-
- nGlyfSize = pMacFont->GetFontTable( "glyf", nullptr);
- if( nGlyfSize <= 0)
- return false;
- }
-
- int nPrepSize = 0, nCvtSize = 0, nFpgmSize = 0;
- if( nGlyfSize) // TODO: reduce PDF size by making hint subsetting optional
- {
- nPrepSize = pMacFont->GetFontTable( "prep", nullptr);
- nCvtSize = pMacFont->GetFontTable( "cvt ", nullptr);
- nFpgmSize = pMacFont->GetFontTable( "fpgm", nullptr);
- }
-
- // prepare a byte buffer for a fake font
- int nTableCount = 7;
- nTableCount += (nPrepSize>0?1:0) + (nCvtSize>0?1:0) + (nFpgmSize>0?1:0) + (nGlyfSize>0?1:0);
- const ByteCount nFdirSize = 12 + 16*nTableCount;
- ByteCount nTotalSize = nFdirSize;
- nTotalSize += nHeadSize + nMaxpSize + nNameSize + nCmapSize;
-
- if( nGlyfSize )
- {
- nTotalSize += nLocaSize + nGlyfSize;
- }
- else
- {
- nTotalSize += nCffSize;
- }
- nTotalSize += nHheaSize + nHmtxSize;
- nTotalSize += nPrepSize + nCvtSize + nFpgmSize;
- rBuffer.resize( nTotalSize );
-
- // fake a SFNT font directory header
- if( nTableCount < 16 )
- {
- int nLog2 = 0;
- while( (nTableCount >> nLog2) > 1 ) ++nLog2;
- rBuffer[ 1] = 1; // Win-TTF style scaler
- rBuffer[ 5] = nTableCount; // table count
- rBuffer[ 7] = nLog2*16; // searchRange
- rBuffer[ 9] = nLog2; // entrySelector
- rBuffer[11] = (nTableCount-nLog2)*16; // rangeShift
- }
-
- // get font table raw data and update the fake directory entries
- ByteCount nOfs = nFdirSize;
- unsigned char* pFakeEntry = &rBuffer[12];
- if( nCmapSize != pMacFont->GetFontTable( "cmap", &rBuffer[nOfs]))
- return false;
-
- FakeDirEntry( "cmap", nOfs, nCmapSize, rBuffer.data(), pFakeEntry );
- nOfs += nCmapSize;
- if( nCvtSize )
- {
- if( nCvtSize != pMacFont->GetFontTable( "cvt ", &rBuffer[nOfs]))
- return false;
-
- FakeDirEntry( "cvt ", nOfs, nCvtSize, rBuffer.data(), pFakeEntry );
- nOfs += nCvtSize;
- }
- if( nFpgmSize )
- {
- if( nFpgmSize != pMacFont->GetFontTable( "fpgm", &rBuffer[nOfs]))
- return false;
-
- FakeDirEntry( "fpgm", nOfs, nFpgmSize, rBuffer.data(), pFakeEntry );
- nOfs += nFpgmSize;
- }
- if( nCffSize )
- {
- if( nCffSize != pMacFont->GetFontTable( "CFF ", &rBuffer[nOfs]))
- return false;
-
- FakeDirEntry( "CFF ", nOfs, nCffSize, rBuffer.data(), pFakeEntry );
- nOfs += nGlyfSize;
- }
- else
- {
- if( nGlyfSize != pMacFont->GetFontTable( "glyf", &rBuffer[nOfs]))
- return false;
-
- FakeDirEntry( "glyf", nOfs, nGlyfSize, rBuffer.data(), pFakeEntry );
- nOfs += nGlyfSize;
-
- if( nLocaSize != pMacFont->GetFontTable( "loca", &rBuffer[nOfs]))
- return false;
-
- FakeDirEntry( "loca", nOfs, nLocaSize, rBuffer.data(), pFakeEntry );
- nOfs += nLocaSize;
- }
- if( nHeadSize != pMacFont->GetFontTable( "head", &rBuffer[nOfs]))
- return false;
-
- FakeDirEntry( "head", nOfs, nHeadSize, rBuffer.data(), pFakeEntry );
- nOfs += nHeadSize;
-
- if( nHheaSize != pMacFont->GetFontTable( "hhea", &rBuffer[nOfs]))
- return false;
-
- FakeDirEntry( "hhea", nOfs, nHheaSize, rBuffer.data(), pFakeEntry );
- nOfs += nHheaSize;
- if( nHmtxSize != pMacFont->GetFontTable( "hmtx", &rBuffer[nOfs]))
- return false;
-
- FakeDirEntry( "hmtx", nOfs, nHmtxSize, rBuffer.data(), pFakeEntry );
- nOfs += nHmtxSize;
- if( nMaxpSize != pMacFont->GetFontTable( "maxp", &rBuffer[nOfs]))
- return false;
-
- FakeDirEntry( "maxp", nOfs, nMaxpSize, rBuffer.data(), pFakeEntry );
- nOfs += nMaxpSize;
- if( nNameSize != pMacFont->GetFontTable( "name", &rBuffer[nOfs]))
- return false;
-
- FakeDirEntry( "name", nOfs, nNameSize, rBuffer.data(), pFakeEntry );
- nOfs += nNameSize;
- if( nPrepSize )
- {
- if( nPrepSize != pMacFont->GetFontTable( "prep", &rBuffer[nOfs]))
- return false;
-
- FakeDirEntry( "prep", nOfs, nPrepSize, rBuffer.data(), pFakeEntry );
- nOfs += nPrepSize;
- }
-
- SAL_WARN_IF( (nOfs!=nTotalSize), "vcl", "AquaSalGraphics::GetRawFontData (nOfs!=nTotalSize)");
-
- return true;
-}
-
const void* AquaSalGraphics::GetEmbedFontData(const vcl::font::PhysicalFontFace*, tools::Long* /*pDataLen*/)
{
return nullptr;