summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/vcl/fontmanager.hxx17
-rw-r--r--vcl/generic/fontmanager/fontmanager.cxx291
-rw-r--r--vcl/generic/glyphs/gcach_ftyp.cxx298
-rw-r--r--vcl/generic/glyphs/gcach_ftyp.hxx11
-rw-r--r--vcl/generic/glyphs/gcach_layout.cxx6
-rw-r--r--vcl/generic/glyphs/glyphcache.cxx35
-rw-r--r--vcl/generic/print/genpspgraphics.cxx44
-rw-r--r--vcl/generic/print/text_gfx.cxx22
-rw-r--r--vcl/headless/svptext.cxx54
-rw-r--r--vcl/inc/generic/glyphcache.hxx35
-rw-r--r--vcl/inc/generic/printergfx.hxx3
-rw-r--r--vcl/unx/generic/gdi/salgdi3.cxx53
12 files changed, 19 insertions, 850 deletions
diff --git a/include/vcl/fontmanager.hxx b/include/vcl/fontmanager.hxx
index 2cc0ac97a3ef..a0196d14fbab 100644
--- a/include/vcl/fontmanager.hxx
+++ b/include/vcl/fontmanager.hxx
@@ -129,14 +129,6 @@ struct CharacterMetric
{ return rOther.width != width || rOther.height != height; }
};
-struct KernPair
-{
- sal_Unicode first, second;
- short int kern_x, kern_y;
-
- KernPair() : first( 0 ), second( 0 ), kern_x( 0 ), kern_y( 0 ) {}
-};
-
class FontCache;
// a class to manage printable fonts
@@ -175,12 +167,9 @@ class VCL_PLUGIN_PUBLIC PrintFontManager
// a single pass, then all bits should be set
char m_aPages[32];
- bool m_bKernPairsQueried;
- std::list< KernPair > m_aXKernPairs;
- std::list< KernPair > m_aYKernPairs;
boost::unordered_map< sal_Unicode, bool > m_bVerticalSubstitutions;
- PrintFontMetrics() : m_bKernPairsQueried( false ) {}
+ PrintFontMetrics() {}
bool isEmpty() const { return m_aMetrics.empty(); }
};
@@ -471,10 +460,6 @@ public:
// the encoding vector contains -1 for non encoded glyphs
const std::map< sal_Unicode, sal_Int32 >* getEncodingMap( fontID nFontID, const std::map< sal_Unicode, OString >** ppNonEncoded ) const;
- // to get font substitution transparently use the
- // getKernPairs method of PrinterGfx
- const std::list< KernPair >& getKernPairs( fontID nFontID, bool bVertical = false ) const;
-
// evaluates copyright flags for TrueType fonts for printing/viewing
// type1 fonts do not have such a feature, so return for them is true
// returns true for builtin fonts (surprise!)
diff --git a/vcl/generic/fontmanager/fontmanager.cxx b/vcl/generic/fontmanager/fontmanager.cxx
index 6d47ed5f5c56..7d2710fd7a22 100644
--- a/vcl/generic/fontmanager/fontmanager.cxx
+++ b/vcl/generic/fontmanager/fontmanager.cxx
@@ -225,7 +225,7 @@ bool PrintFontManager::BuiltinFont::queryMetricPage( int /*nPage*/, MultiAtomPro
// -------------------------------------------------------------------------
-bool PrintFontManager::TrueTypeFontFile::queryMetricPage( int nPage, MultiAtomProvider* pProvider )
+bool PrintFontManager::TrueTypeFontFile::queryMetricPage( int nPage, MultiAtomProvider* /*pProvider*/ )
{
bool bSuccess = false;
@@ -284,236 +284,6 @@ bool PrintFontManager::TrueTypeFontFile::queryMetricPage( int nPage, MultiAtomPr
}
free( pMetrics );
}
-
- if( ! m_pMetrics->m_bKernPairsQueried )
- {
- m_pMetrics->m_bKernPairsQueried = true;
- // this is really a hack
- // in future MapString/KernGlyphs should be used
- // but vcl is not in a state where that could be used
- // so currently we get kernpairs by accessing the raw data
- struct _TrueTypeFont* pImplTTFont = (struct _TrueTypeFont*)pTTFont;
-
- //-----------------------------------------------------------------
- // Kerning: KT_MICROSOFT
- //-----------------------------------------------------------------
- if( pImplTTFont->nkern && pImplTTFont->kerntype == KT_MICROSOFT )
- {
- // create a glyph -> character mapping
- ::boost::unordered_map< sal_uInt16, sal_Unicode > aGlyphMap;
- ::boost::unordered_map< sal_uInt16, sal_Unicode >::iterator left, right;
- for( i = 21; i < 0xfffd; i++ )
- {
- sal_uInt16 nGlyph = MapChar( pTTFont, (sal_Unicode)i, 0 ); // kerning for horz only
- if( nGlyph != 0 )
- aGlyphMap[ nGlyph ] = (sal_Unicode)i;
- }
-
-
- KernPair aPair;
- for( i = 0; i < (int)pImplTTFont->nkern; i++ )
- {
- const sal_uInt8* pTable = pImplTTFont->kerntables[i];
-
- /*sal_uInt16 nVersion =*/ getUInt16BE( pTable );
- /*sal_uInt16 nLength =*/ getUInt16BE( pTable );
- sal_uInt16 nCoverage = getUInt16BE( pTable );
-
- aPair.kern_x = 0;
- aPair.kern_y = 0;
- switch( nCoverage >> 8 )
- {
- case 0:
- {
- sal_uInt16 nPairs = getUInt16BE( pTable );
- pTable += 6;
- for( int n = 0; n < nPairs; n++ )
- {
- sal_uInt16 nLeftGlyph = getUInt16BE( pTable );
- sal_uInt16 nRightGlyph = getUInt16BE( pTable );
- sal_Int16 nKern = (sal_Int16)getUInt16BE( pTable );
-
- left = aGlyphMap.find( nLeftGlyph );
- right = aGlyphMap.find( nRightGlyph );
- if( left != aGlyphMap.end() && right != aGlyphMap.end() )
- {
- aPair.first = left->second;
- aPair.second = right->second;
- switch( nCoverage & 1 )
- {
- case 1:
- aPair.kern_x = (int)nKern * 1000 / pImplTTFont->unitsPerEm;
- m_pMetrics->m_aXKernPairs.push_back( aPair );
- break;
- case 0:
- aPair.kern_y = (int)nKern * 1000 / pImplTTFont->unitsPerEm;
- m_pMetrics->m_aYKernPairs.push_back( aPair );
- break;
- }
- }
- }
- }
- break;
-
- case 2:
- {
- const sal_uInt8* pSubTable = pTable;
- /*sal_uInt16 nRowWidth =*/ getUInt16BE( pTable );
- sal_uInt16 nOfLeft = getUInt16BE( pTable );
- sal_uInt16 nOfRight = getUInt16BE( pTable );
- /*sal_uInt16 nOfArray =*/ getUInt16BE( pTable );
- const sal_uInt8* pTmp = pSubTable + nOfLeft;
- sal_uInt16 nFirstLeft = getUInt16BE( pTmp );
- sal_uInt16 nLastLeft = getUInt16BE( pTmp ) + nFirstLeft - 1;
- pTmp = pSubTable + nOfRight;
- sal_uInt16 nFirstRight = getUInt16BE( pTmp );
- sal_uInt16 nLastRight = getUInt16BE( pTmp ) + nFirstRight -1;
-
- // int nPairs = (int)(nLastLeft-nFirstLeft+1)*(int)(nLastRight-nFirstRight+1);
- for( aPair.first = nFirstLeft; aPair.first < nLastLeft; aPair.first++ )
- {
- for( aPair.second = 0; aPair.second < nLastRight; aPair.second++ )
- {
- sal_Int16 nKern = (sal_Int16)getUInt16BE( pTmp );
- switch( nCoverage & 1 )
- {
- case 1:
- aPair.kern_x = (int)nKern * 1000 / pImplTTFont->unitsPerEm;
- m_pMetrics->m_aXKernPairs.push_back( aPair );
- break;
- case 0:
- aPair.kern_y = (int)nKern * 1000 / pImplTTFont->unitsPerEm;
- m_pMetrics->m_aYKernPairs.push_back( aPair );
- break;
- }
- }
- }
- }
- break;
- }
- }
- }
-
- //-----------------------------------------------------------------
- // Kerning: KT_APPLE_NEW
- //-----------------------------------------------------------------
- if( pImplTTFont->nkern && pImplTTFont->kerntype == KT_APPLE_NEW )
- {
- // create a glyph -> character mapping
- ::boost::unordered_map< sal_uInt16, sal_Unicode > aGlyphMap;
- ::boost::unordered_map< sal_uInt16, sal_Unicode >::iterator left, right;
- for( i = 21; i < 0xfffd; i++ )
- {
- sal_uInt16 nGlyph = MapChar( pTTFont, (sal_Unicode)i, 0 ); // kerning for horz only
- if( nGlyph != 0 )
- aGlyphMap[ nGlyph ] = (sal_Unicode)i;
- }
-
- // Loop through each of the 'kern' subtables
- KernPair aPair;
- for( i = 0; (unsigned int)i < pImplTTFont->nkern; i++ )
- {
- const sal_uInt8* pTable = pImplTTFont->kerntables[i];
-
- /*sal_uInt32 nLength =*/ getUInt32BE( pTable );
- sal_uInt16 nCoverage = getUInt16BE( pTable );
- /*sal_uInt16 nTupleIndex =*/ getUInt16BE( pTable );
-
- // Get kerning type
- // sal_Bool bKernVertical = nCoverage & 0x8000;
- // sal_Bool bKernCrossStream = nCoverage & 0x4000;
- // sal_Bool bKernVariation = nCoverage & 0x2000;
-
- // Kerning sub-table format, 0 through 3
- sal_uInt8 nSubTableFormat = nCoverage & 0x00FF;
-
- aPair.kern_x = 0;
- aPair.kern_y = 0;
- switch( nSubTableFormat )
- {
- case 0:
- {
- // Grab the # of kern pairs but skip over the:
- // searchRange
- // entrySelector
- // rangeShift
- sal_uInt16 nPairs = getUInt16BE( pTable );
- pTable += 6;
-
- for( int n = 0; n < nPairs; n++ )
- {
- sal_uInt16 nLeftGlyph = getUInt16BE( pTable );
- sal_uInt16 nRightGlyph = getUInt16BE( pTable );
- sal_Int16 nKern = (sal_Int16)getUInt16BE( pTable );
-
- left = aGlyphMap.find( nLeftGlyph );
- right = aGlyphMap.find( nRightGlyph );
- if( left != aGlyphMap.end() && right != aGlyphMap.end() )
- {
- aPair.first = left->second;
- aPair.second = right->second;
-
- // Only support horizontal kerning for now
- aPair.kern_x = (int)nKern * 1000 / pImplTTFont->unitsPerEm;
- aPair.kern_y = 0;
- m_pMetrics->m_aXKernPairs.push_back( aPair );
- }
- }
- }
- break;
-
- case 2:
- {
- const sal_uInt8* pSubTable = pTable;
- /*sal_uInt16 nRowWidth =*/ getUInt16BE( pTable );
- sal_uInt16 nOfLeft = getUInt16BE( pTable );
- sal_uInt16 nOfRight = getUInt16BE( pTable );
- /*sal_uInt16 nOfArray =*/ getUInt16BE( pTable );
- const sal_uInt8* pTmp = pSubTable + nOfLeft;
- sal_uInt16 nFirstLeft = getUInt16BE( pTmp );
- sal_uInt16 nLastLeft = getUInt16BE( pTmp ) + nFirstLeft - 1;
- pTmp = pSubTable + nOfRight;
- sal_uInt16 nFirstRight = getUInt16BE( pTmp );
- sal_uInt16 nLastRight = getUInt16BE( pTmp ) + nFirstRight -1;
-
- for( aPair.first = nFirstLeft; aPair.first < nLastLeft; aPair.first++ )
- {
- for( aPair.second = 0; aPair.second < nLastRight; aPair.second++ )
- {
- sal_Int16 nKern = (sal_Int16)getUInt16BE( pTmp );
- switch( nCoverage & 1 )
- {
- case 1:
- aPair.kern_x = (int)nKern * 1000 / pImplTTFont->unitsPerEm;
- m_pMetrics->m_aXKernPairs.push_back( aPair );
- break;
- case 0:
- aPair.kern_y = (int)nKern * 1000 / pImplTTFont->unitsPerEm;
- m_pMetrics->m_aYKernPairs.push_back( aPair );
- break;
- }
- }
- }
- }
- break;
-
- default:
- fprintf( stderr, "Found unsupported Apple-style kern subtable type %d.\n", nSubTableFormat );
- break;
- }
- }
- }
-
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "found %" SAL_PRI_SIZET "u/%" SAL_PRI_SIZET "u kern pairs for %s\n",
- m_pMetrics->m_aXKernPairs.size(),
- m_pMetrics->m_aYKernPairs.size(),
- OUStringToOString( pProvider->getString( ATOM_FAMILYNAME, m_nFamilyName ), RTL_TEXTENCODING_MS_1252 ).getStr() );
-#else
- (void) pProvider; /* avoid warnings */
-#endif
- }
-
CloseTTFont( pTTFont );
bSuccess = true;
}
@@ -905,48 +675,6 @@ bool PrintFontManager::PrintFont::readAfmMetrics( MultiAtomProvider* pProvider,
}
}
}
-
- m_pMetrics->m_aXKernPairs.clear();
- m_pMetrics->m_aYKernPairs.clear();
-
- // now fill in the kern pairs
- // parseAFM.cxx effectively only supports direction 0 (horizontal)
- PairKernData* pKern = pInfo->pkd;
- KernPair aPair;
- for( i = 0; i < pInfo->numOfPairs; i++, pKern++ )
- {
- // #i37703# broken kern table
- if( ! pKern->name1 || ! pKern->name2 )
- continue;
-
- aPair.first = 0;
- aPair.second = 0;
- // currently we have to find the adobe character names
- // in the already parsed character metrics to find
- // the corresponding UCS2 code which is a bit dangerous
- // since the character names are not required
- // in the metric descriptions
- pChar = pInfo->cmi;
- for( int j = 0;
- j < pInfo->numOfChars && ( aPair.first == 0 || aPair.second == 0 );
- j++, pChar++ )
- {
- if( pChar->code != -1 )
- {
- if( ! strcmp( pKern->name1, pChar->name ? pChar->name : "" ) )
- aPair.first = pUnicodes[ j ];
- if( ! strcmp( pKern->name2, pChar->name ? pChar->name : "" ) )
- aPair.second = pUnicodes[ j ];
- }
- }
- if( aPair.first && aPair.second )
- {
- aPair.kern_x = pKern->xamt;
- aPair.kern_y = pKern->yamt;
- m_pMetrics->m_aXKernPairs.push_back( aPair );
- }
- }
- m_pMetrics->m_bKernPairsQueried = true;
}
freeFontInfo( pInfo );
@@ -2390,23 +2118,6 @@ void PrintFontManager::hasVerticalSubstitutions( fontID nFontID,
// -------------------------------------------------------------------------
-const ::std::list< KernPair >& PrintFontManager::getKernPairs( fontID nFontID, bool bVertical ) const
-{
- static ::std::list< KernPair > aEmpty;
-
- PrintFont* pFont = getFont( nFontID );
- if( ! pFont )
- return aEmpty;
-
- if( ! pFont->m_pMetrics || ! pFont->m_pMetrics->m_bKernPairsQueried )
- pFont->queryMetricPage( 0, m_pAtoms );
- if( ! pFont->m_pMetrics || ! pFont->m_pMetrics->m_bKernPairsQueried )
- return aEmpty;
- return bVertical ? pFont->m_pMetrics->m_aYKernPairs : pFont->m_pMetrics->m_aXKernPairs;
-}
-
-// -------------------------------------------------------------------------
-
bool PrintFontManager::isFontDownloadingAllowedForPrinting( fontID nFont ) const
{
static const char* pEnable = getenv( "PSPRINT_ENABLE_TTF_COPYRIGHTAWARENESS" );
diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx
index c1f2640328d4..384de84505f5 100644
--- a/vcl/generic/glyphs/gcach_ftyp.cxx
+++ b/vcl/generic/glyphs/gcach_ftyp.cxx
@@ -65,14 +65,6 @@ typedef const FT_Vector* FT_Vector_CPtr;
#include <sys/mman.h>
#include "vcl/fontmanager.hxx"
-typedef const unsigned char* CPU8;
-inline sal_uInt16 NEXT_U16( CPU8& p ) { p+=2; return (p[-2]<<8)|p[-1]; }
-inline sal_Int16 NEXT_S16( CPU8& p ) { return (sal_Int16)NEXT_U16(p); }
-inline sal_uInt32 NEXT_U32( CPU8& p ) { p+=4; return (p[-4]<<24)|(p[-3]<<16)|(p[-2]<<8)|p[-1]; }
-//inline sal_Int32 NEXT_S32( U8*& p ) { return (sal_Int32)NEXT_U32(p); }
-
-// -----------------------------------------------------------------------
-
// the gamma table makes artificial bold look better for CJK glyphs
static unsigned char aGammaTable[257];
@@ -232,8 +224,7 @@ const void * graphiteFontTable(const void* appFaceHandle, unsigned int name, siz
// =======================================================================
FtFontInfo::FtFontInfo( const ImplDevFontAttributes& rDevFontAttributes,
- const OString& rNativeFileName, int nFaceNum, sal_IntPtr nFontId, int nSynthetic,
- const ExtraKernInfo* pExtraKernInfo )
+ const OString& rNativeFileName, int nFaceNum, sal_IntPtr nFontId, int nSynthetic)
:
maFaceFT( NULL ),
mpFontFile( FtFontFile::FindFontFile( rNativeFileName ) ),
@@ -248,16 +239,12 @@ FtFontInfo::FtFontInfo( const ImplDevFontAttributes& rDevFontAttributes,
maDevFontAttributes( rDevFontAttributes ),
mpFontCharMap( NULL ),
mpChar2Glyph( NULL ),
- mpGlyph2Char( NULL ),
- mpExtraKernInfo( pExtraKernInfo )
+ mpGlyph2Char( NULL )
{
// prefer font with low ID
maDevFontAttributes.mnQuality += 10000 - nFontId;
// prefer font with matching file names
maDevFontAttributes.mnQuality += mpFontFile->GetLangBoost();
- // prefer font with more external info
- if( pExtraKernInfo )
- maDevFontAttributes.mnQuality += 100;
}
// -----------------------------------------------------------------------
@@ -266,7 +253,6 @@ FtFontInfo::~FtFontInfo()
{
if( mpFontCharMap )
mpFontCharMap->DeReference();
- delete mpExtraKernInfo;
delete mpChar2Glyph;
delete mpGlyph2Char;
#if ENABLE_GRAPHITE
@@ -335,27 +321,6 @@ void FtFontInfo::ReleaseFaceFT()
// -----------------------------------------------------------------------
-bool FtFontInfo::HasExtraKerning() const
-{
- if( !mpExtraKernInfo )
- return false;
- // TODO: how to enable the line below without getting #i29881# back?
- // on the other hand being too optimistic doesn't cause problems
- // return mpExtraKernInfo->HasKernPairs();
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-int FtFontInfo::GetExtraKernPairs( ImplKernPairData** ppKernPairs ) const
-{
- if( !mpExtraKernInfo )
- return 0;
- return mpExtraKernInfo->GetUnscaledKernPairs( ppKernPairs );
-}
-
-// -----------------------------------------------------------------------
-
static unsigned GetUInt( const unsigned char* p ) { return((p[0]<<24)+(p[1]<<16)+(p[2]<<8)+p[3]);}
static unsigned GetUShort( const unsigned char* p ){ return((p[0]<<8)+p[1]);}
//static signed GetSShort( const unsigned char* p ){ return((short)((p[0]<<8)+p[1]));}
@@ -454,8 +419,7 @@ FreetypeManager::~FreetypeManager()
// -----------------------------------------------------------------------
void FreetypeManager::AddFontFile( const OString& rNormalizedName,
- int nFaceNum, sal_IntPtr nFontId, const ImplDevFontAttributes& rDevFontAttr,
- const ExtraKernInfo* pExtraKernInfo )
+ int nFaceNum, sal_IntPtr nFontId, const ImplDevFontAttributes& rDevFontAttr)
{
if( rNormalizedName.isEmpty() )
return;
@@ -464,7 +428,7 @@ void FreetypeManager::AddFontFile( const OString& rNormalizedName,
return;
FtFontInfo* pFontInfo = new FtFontInfo( rDevFontAttr,
- rNormalizedName, nFaceNum, nFontId, 0, pExtraKernInfo );
+ rNormalizedName, nFaceNum, nFontId, 0);
maFontList[ nFontId ] = pFontInfo;
if( mnMaxFontId < nFontId )
mnMaxFontId = nFontId;
@@ -727,7 +691,7 @@ void ServerFont::FetchFontMetric( ImplFontMetricData& rTo, long& rFactor ) const
rTo.mbScalableFont = true;
rTo.mbDevice = true;
- rTo.mbKernableFont = (FT_HAS_KERNING( maFaceFT ) != 0) || mpFontInfo->HasExtraKerning();
+ rTo.mbKernableFont = FT_HAS_KERNING( maFaceFT ) != 0;
rTo.mnOrientation = GetFontSelData().mnOrientation;
//Always consider [star]symbol as symbol fonts
@@ -1475,258 +1439,6 @@ bool ServerFont::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) c
}
// -----------------------------------------------------------------------
-
-sal_uLong ServerFont::GetKernPairs( ImplKernPairData** ppKernPairs ) const
-{
- // if no kerning info is available in the font file
- *ppKernPairs = NULL;
- if( !FT_HAS_KERNING( maFaceFT ) || !FT_IS_SFNT( maFaceFT ) )
- {
- // then we have may have extra kerning info from e.g. psprint
- int nCount = mpFontInfo->GetExtraKernPairs( ppKernPairs );
- // scale the kern values to match the font size
- const FontSelectPattern& rFSD = GetFontSelData();
- int nFontWidth = rFSD.mnWidth ? rFSD.mnWidth : rFSD.mnHeight;
- ImplKernPairData* pKernPair = *ppKernPairs;
- for( int i = nCount; --i >= 0; ++pKernPair )
- {
- long& rVal = pKernPair->mnKern;
- rVal = ((rVal * nFontWidth) + 500) / 1000;
- }
- return nCount;
- }
-
- // when font faces of different sizes share the same maFaceFT
- // then we have to make sure that it uses the correct maSizeFT
- FT_Activate_Size( maSizeFT );
-
- // first figure out which glyph pairs are involved in kerning
- sal_uLong nKernLength = 0;
- const FT_Byte* const pKern = mpFontInfo->GetTable( "kern", &nKernLength );
- if( !pKern )
- return 0;
-
- // combine TTF/OTF tables from the font file to build a vector of
- // unicode kerning pairs using Freetype's glyph kerning calculation
- // for the kerning value
-
- // TODO: is it worth to share the glyph->unicode mapping between
- // different instances of the same font face?
-
- typedef std::vector<ImplKernPairData> KernVector;
- KernVector aKernGlyphVector;
- ImplKernPairData aKernPair;
- aKernPair.mnKern = 0; // To prevent "is used uninitialized" warning...
-
- const FT_Byte* pBuffer = pKern;
- sal_uLong nVersion = GetUShort( pBuffer+0 );
- sal_uInt16 nTableCnt = GetUShort( pBuffer+2 );
-
- // Microsoft/Old TrueType style kern table
- if ( nVersion == 0 )
- {
- pBuffer += 4;
-
- for( sal_uInt16 nTableIdx = 0; nTableIdx < nTableCnt; ++nTableIdx )
- {
- // sal_uInt16 nSubVersion = GetUShort( pBuffer+0 );
- // sal_uInt16 nSubLength = GetUShort( pBuffer+2 );
- sal_uInt16 nSubCoverage = GetUShort( pBuffer+4 );
- pBuffer += 6;
- if( (nSubCoverage&0x03) != 0x01 ) // no interest in minimum info here
- continue;
- switch( nSubCoverage >> 8 )
- {
- case 0: // version 0, kerning format 0
- {
- sal_uInt16 nPairs = GetUShort( pBuffer );
- pBuffer += 8; // skip search hints
- aKernGlyphVector.reserve( aKernGlyphVector.size() + nPairs );
- for( int i = 0; i < nPairs; ++i )
- {
- aKernPair.mnChar1 = GetUShort( pBuffer+0 );
- aKernPair.mnChar2 = GetUShort( pBuffer+2 );
- //long nUnscaledKern= GetSShort( pBuffer );
- pBuffer += 6;
- aKernGlyphVector.push_back( aKernPair );
- }
- }
- break;
-
- case 2: // version 0, kerning format 2
- {
- const FT_Byte* pSubTable = pBuffer;
- //sal_uInt16 nRowWidth = GetUShort( pBuffer+0 );
- sal_uInt16 nOfsLeft = GetUShort( pBuffer+2 );
- sal_uInt16 nOfsRight = GetUShort( pBuffer+4 );
- sal_uInt16 nOfsArray = GetUShort( pBuffer+6 );
- pBuffer += 8;
-
- const FT_Byte* pTmp = pSubTable + nOfsLeft;
- sal_uInt16 nFirstLeft = GetUShort( pTmp+0 );
- sal_uInt16 nLastLeft = GetUShort( pTmp+2 ) + nFirstLeft - 1;
-
- pTmp = pSubTable + nOfsRight;
- sal_uInt16 nFirstRight = GetUShort( pTmp+0 );
- sal_uInt16 nLastRight = GetUShort( pTmp+2 ) + nFirstRight - 1;
-
- sal_uLong nPairs = (sal_uLong)(nLastLeft - nFirstLeft + 1) * (nLastRight - nFirstRight + 1);
- aKernGlyphVector.reserve( aKernGlyphVector.size() + nPairs );
-
- pTmp = pSubTable + nOfsArray;
- for( int nLeft = nFirstLeft; nLeft < nLastLeft; ++nLeft )
- {
- aKernPair.mnChar1 = nLeft;
- for( int nRight = 0; nRight < nLastRight; ++nRight )
- {
- if( GetUShort( pTmp ) != 0 )
- {
- aKernPair.mnChar2 = nRight;
- aKernGlyphVector.push_back( aKernPair );
- }
- pTmp += 2;
- }
- }
- }
- break;
- }
- }
- }
-
- // Apple New style kern table
- pBuffer = pKern;
- nVersion = NEXT_U32( pBuffer );
- nTableCnt = NEXT_U32( pBuffer );
- if ( nVersion == 0x00010000 )
- {
- for( sal_uInt16 nTableIdx = 0; nTableIdx < nTableCnt; ++nTableIdx )
- {
- /*sal_uLong nLength =*/ NEXT_U32( pBuffer );
- sal_uInt16 nCoverage = NEXT_U16( pBuffer );
- /*sal_uInt16 nTupleIndex =*/ NEXT_U16( pBuffer );
-
- // Kerning sub-table format, 0 through 3
- sal_uInt8 nSubTableFormat = nCoverage & 0x00FF;
-
- switch( nSubTableFormat )
- {
- case 0: // version 0, kerning format 0
- {
- sal_uInt16 nPairs = NEXT_U16( pBuffer );
- pBuffer += 6; // skip search hints
- aKernGlyphVector.reserve( aKernGlyphVector.size() + nPairs );
- for( int i = 0; i < nPairs; ++i )
- {
- aKernPair.mnChar1 = NEXT_U16( pBuffer );
- aKernPair.mnChar2 = NEXT_U16( pBuffer );
- /*long nUnscaledKern=*/ NEXT_S16( pBuffer );
- aKernGlyphVector.push_back( aKernPair );
- }
- }
- break;
-
- case 2: // version 0, kerning format 2
- {
- const FT_Byte* pSubTable = pBuffer;
- /*sal_uInt16 nRowWidth =*/ NEXT_U16( pBuffer );
- sal_uInt16 nOfsLeft = NEXT_U16( pBuffer );
- sal_uInt16 nOfsRight = NEXT_U16( pBuffer );
- sal_uInt16 nOfsArray = NEXT_U16( pBuffer );
-
- const FT_Byte* pTmp = pSubTable + nOfsLeft;
- sal_uInt16 nFirstLeft = NEXT_U16( pTmp );
- sal_uInt16 nLastLeft = NEXT_U16( pTmp ) + nFirstLeft - 1;
-
- pTmp = pSubTable + nOfsRight;
- sal_uInt16 nFirstRight = NEXT_U16( pTmp );
- sal_uInt16 nLastRight = NEXT_U16( pTmp ) + nFirstRight - 1;
-
- sal_uLong nPairs = (sal_uLong)(nLastLeft - nFirstLeft + 1) * (nLastRight - nFirstRight + 1);
- aKernGlyphVector.reserve( aKernGlyphVector.size() + nPairs );
-
- pTmp = pSubTable + nOfsArray;
- for( int nLeft = nFirstLeft; nLeft < nLastLeft; ++nLeft )
- {
- aKernPair.mnChar1 = nLeft;
- for( int nRight = 0; nRight < nLastRight; ++nRight )
- {
- if( NEXT_S16( pTmp ) != 0 )
- {
- aKernPair.mnChar2 = nRight;
- aKernGlyphVector.push_back( aKernPair );
- }
- }
- }
- }
- break;
-
- default:
- fprintf( stderr, "gcach_ftyp.cxx: Found unsupported Apple-style kern subtable type %d.\n", nSubTableFormat );
- break;
- }
- }
- }
-
- // now create VCL's ImplKernPairData[] format for all glyph pairs
- sal_uLong nKernCount = aKernGlyphVector.size();
- if( nKernCount )
- {
- // prepare glyphindex to character mapping
- // TODO: this is needed to support VCL's existing kerning infrastructure,
- // eliminate it up by redesigning kerning infrastructure to work with glyph indices
- typedef boost::unordered_multimap<sal_uInt16,sal_Unicode> Cmap;
- Cmap aCmap;
- for( sal_Unicode aChar = 0x0020; aChar < 0xFFFE; ++aChar )
- {
- sal_uInt16 nGlyphIndex = GetGlyphIndex( aChar );
- if( nGlyphIndex )
- aCmap.insert( Cmap::value_type( nGlyphIndex, aChar ) );
- }
-
- // translate both glyph indices in kerning pairs to characters
- // problem is that these are 1:n mappings...
- KernVector aKernCharVector;
- aKernCharVector.reserve( nKernCount );
- KernVector::iterator it;
- for( it = aKernGlyphVector.begin(); it != aKernGlyphVector.end(); ++it )
- {
- FT_Vector aKernVal;
- FT_Error rcFT = FT_Get_Kerning( maFaceFT, it->mnChar1, it->mnChar2,
- FT_KERNING_DEFAULT, &aKernVal );
- aKernPair.mnKern = aKernVal.x >> 6;
- if( (aKernPair.mnKern == 0) || (rcFT != FT_Err_Ok) )
- continue;
-
- typedef std::pair<Cmap::iterator,Cmap::iterator> CPair;
- const CPair p1 = aCmap.equal_range( it->mnChar1 );
- const CPair p2 = aCmap.equal_range( it->mnChar2 );
- for( Cmap::const_iterator i1 = p1.first; i1 != p1.second; ++i1 )
- {
- aKernPair.mnChar1 = (*i1).second;
- for( Cmap::const_iterator i2 = p2.first; i2 != p2.second; ++i2 )
- {
- aKernPair.mnChar2 = (*i2).second;
- aKernCharVector.push_back( aKernPair );
- }
- }
- }
-
- // now move the resulting vector into VCL's ImplKernPairData[] format
- nKernCount = aKernCharVector.size();
- ImplKernPairData* pTo = new ImplKernPairData[ nKernCount ];
- *ppKernPairs = pTo;
- for( it = aKernCharVector.begin(); it != aKernCharVector.end(); ++it, ++pTo )
- {
- pTo->mnChar1 = it->mnChar1;
- pTo->mnChar2 = it->mnChar2;
- pTo->mnKern = it->mnKern;
- }
- }
-
- return nKernCount;
-}
-
-// -----------------------------------------------------------------------
// outline stuff
// -----------------------------------------------------------------------
diff --git a/vcl/generic/glyphs/gcach_ftyp.hxx b/vcl/generic/glyphs/gcach_ftyp.hxx
index 83cec6183368..e2527b316b08 100644
--- a/vcl/generic/glyphs/gcach_ftyp.hxx
+++ b/vcl/generic/glyphs/gcach_ftyp.hxx
@@ -63,8 +63,7 @@ class FtFontInfo
public:
FtFontInfo( const ImplDevFontAttributes&,
const OString& rNativeFileName,
- int nFaceNum, sal_IntPtr nFontId, int nSynthetic,
- const ExtraKernInfo* );
+ int nFaceNum, sal_IntPtr nFontId, int nSynthetic);
~FtFontInfo();
const unsigned char* GetTable( const char*, sal_uLong* pLength=0 ) const;
@@ -90,9 +89,6 @@ public:
bool GetFontCodeRanges( CmapResult& ) const;
const ImplFontCharMap* GetImplFontCharMap( void );
- bool HasExtraKerning() const;
- int GetExtraKernPairs( ImplKernPairData** ) const;
-
private:
FT_FaceRec_* maFaceFT;
FtFontFile* mpFontFile;
@@ -114,8 +110,6 @@ private:
mutable Int2IntMap* mpChar2Glyph;
mutable Int2IntMap* mpGlyph2Char;
void InitHashes() const;
-
- const ExtraKernInfo* mpExtraKernInfo;
};
// these two inlines are very important for performance
@@ -147,8 +141,7 @@ public:
~FreetypeManager();
void AddFontFile( const OString& rNormalizedName,
- int nFaceNum, sal_IntPtr nFontId, const ImplDevFontAttributes&,
- const ExtraKernInfo* );
+ int nFaceNum, sal_IntPtr nFontId, const ImplDevFontAttributes&);
void AnnounceFonts( ImplDevFontList* ) const;
void ClearFontList();
diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index 01d0904e3d97..e207c5ee901a 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -214,12 +214,6 @@ static hb_position_t getGlyphKerningH(hb_font_t* /*font*/, void* pFontData,
{
// This callback is for old style 'kern' table, GPOS kerning is handled by HarfBuzz directly
- // XXX: there is ServerFont::GetKernPairs() but it does many "smart" things
- // that I'm not sure about, so I'm using FreeType directly
- // P.S. if we decided not to use ServerFont::GetKernPairs() then it and all
- // other implementattions should be removed, don't seem to be used
- // anywhere.
-
ServerFont* pFont = (ServerFont*) pFontData;
FT_Face aFace = pFont->GetFtFace();
diff --git a/vcl/generic/glyphs/glyphcache.cxx b/vcl/generic/glyphs/glyphcache.cxx
index f9a2ee36c3bb..39cccd377d1d 100644
--- a/vcl/generic/glyphs/glyphcache.cxx
+++ b/vcl/generic/glyphs/glyphcache.cxx
@@ -154,10 +154,10 @@ GlyphCache& GlyphCache::GetInstance()
void GlyphCache::AddFontFile( const OString& rNormalizedName, int nFaceNum,
- sal_IntPtr nFontId, const ImplDevFontAttributes& rDFA, const ExtraKernInfo* pExtraKern )
+ sal_IntPtr nFontId, const ImplDevFontAttributes& rDFA)
{
if( mpFtManager )
- mpFtManager->AddFontFile( rNormalizedName, nFaceNum, nFontId, rDFA, pExtraKern );
+ mpFtManager->AddFontFile( rNormalizedName, nFaceNum, nFontId, rDFA);
}
@@ -402,35 +402,4 @@ ImplServerFontEntry::~ImplServerFontEntry()
if (mpServerFont)
mpServerFont->Release();
}
-
-
-ExtraKernInfo::ExtraKernInfo( sal_IntPtr nFontId )
-: mbInitialized( false ),
- mnFontId( nFontId ),
- maUnicodeKernPairs( 0 )
-{}
-
-
-int ExtraKernInfo::GetUnscaledKernPairs( ImplKernPairData** ppKernPairs ) const
-{
- if( !mbInitialized )
- Initialize();
-
- // return early if no kerning available
- if( maUnicodeKernPairs.empty() )
- return 0;
-
- // allocate kern pair table
- int nKernCount = maUnicodeKernPairs.size();
- *ppKernPairs = new ImplKernPairData[ nKernCount ];
-
- // fill in unicode kern pairs with the kern value scaled to the font width
- ImplKernPairData* pKernData = *ppKernPairs;
- UnicodeKernPairs::const_iterator it = maUnicodeKernPairs.begin();
- for(; it != maUnicodeKernPairs.end(); ++it )
- *(pKernData++) = *it;
-
- return nKernCount;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx
index c0e24e50896a..d6e6bd6cc314 100644
--- a/vcl/generic/print/genpspgraphics.cxx
+++ b/vcl/generic/print/genpspgraphics.cxx
@@ -660,29 +660,6 @@ bool PspFontLayout::LayoutText( ImplLayoutArgs& rArgs )
if( aMetric.width == -1 && aMetric.height == -1 )
rArgs.NeedFallback( nCharPos, bRightToLeft );
- // apply pair kerning to prev glyph if requested
- if( SAL_LAYOUT_KERNING_PAIRS & rArgs.mnFlags )
- {
- if( nOldGlyphId > 0 )
- {
- const std::list< KernPair >& rKernPairs = mrPrinterGfx.getKernPairs(mbVertical);
- for( std::list< KernPair >::const_iterator it = rKernPairs.begin();
- it != rKernPairs.end(); ++it )
- {
- if( it->first == nOldGlyphId && it->second == nGlyphIndex )
- {
- int nTextScale = mrPrinterGfx.GetFontWidth();
- if( ! nTextScale )
- nTextScale = mrPrinterGfx.GetFontHeight();
- int nKern = (mbVertical ? it->kern_y : it->kern_x) * nTextScale;
- nGlyphWidth += nKern;
- aPrevItem.mnNewWidth = nGlyphWidth;
- break;
- }
- }
- }
- }
-
// finish previous glyph
if( nOldGlyphId >= 0 )
AppendGlyph( aPrevItem );
@@ -973,26 +950,9 @@ void GenPspGraphics::GetFontMetric( ImplFontMetricData *pMetric, int )
}
}
-sal_uLong GenPspGraphics::GetKernPairs( sal_uLong nPairs, ImplKernPairData *pKernPairs )
+sal_uLong GenPspGraphics::GetKernPairs( sal_uLong, ImplKernPairData* )
{
- const ::std::list< ::psp::KernPair >& rPairs( m_pPrinterGfx->getKernPairs() );
- sal_uLong nHavePairs = rPairs.size();
- if( pKernPairs && nPairs )
- {
- ::std::list< ::psp::KernPair >::const_iterator it;
- unsigned int i;
- int nTextScale = m_pPrinterGfx->GetFontWidth();
- if( ! nTextScale )
- nTextScale = m_pPrinterGfx->GetFontHeight();
- for( i = 0, it = rPairs.begin(); i < nPairs && i < nHavePairs; i++, ++it )
- {
- pKernPairs[i].mnChar1 = it->first;
- pKernPairs[i].mnChar2 = it->second;
- pKernPairs[i].mnKern = it->kern_x * nTextScale / 1000;
- }
-
- }
- return nHavePairs;
+ return 0;
}
sal_Bool GenPspGraphics::GetGlyphBoundRect( sal_GlyphId nGlyphIndex, Rectangle& rRect )
diff --git a/vcl/generic/print/text_gfx.cxx b/vcl/generic/print/text_gfx.cxx
index 841a9db7a355..751936b9d414 100644
--- a/vcl/generic/print/text_gfx.cxx
+++ b/vcl/generic/print/text_gfx.cxx
@@ -664,28 +664,6 @@ PrinterGfx::GetCharWidth (sal_Unicode nFrom, sal_Unicode nTo, long *pWidthArray)
return 1000;
}
-const ::std::list< KernPair >& PrinterGfx::getKernPairs( bool bVertical ) const
-{
- /*
- * Note: this is only a 80% solution: if a font is only
- * partially substituted in a string due to missing glyphs
- * the results may not be perfect; the more so the more the
- * substitution differs from the original metricwise. But
- * vcl only asks for KernPairs for each font once and NOT
- * in a string context this is the best we can do.
- * In future the kerning should be done on a per string basis.
- */
- fontID nFont = mnFontID;
- if( mpFontSubstitutes )
- {
- ::boost::unordered_map< fontID, fontID >::const_iterator it =
- mpFontSubstitutes->find( mnFontID );
- if( it != mpFontSubstitutes->end() )
- nFont = it->second;
- }
- return mrFontMgr.getKernPairs( nFont, bVertical );
-}
-
/*
* spool the converted truetype fonts to the page header after the page body is
* complete
diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx
index ff316039ac6f..ce90850ecd3e 100644
--- a/vcl/headless/svptext.cxx
+++ b/vcl/headless/svptext.cxx
@@ -189,37 +189,6 @@ void SvpGlyphPeer::RemovingGlyph( GlyphData& rGlyphData )
delete pGcpHelper;
}
-
-// PspKernInfo allows on-demand-querying of psprint provided kerning info (#i29881#)
-class PspKernInfo : public ExtraKernInfo
-{
-public:
- PspKernInfo( int nFontId ) : ExtraKernInfo(nFontId) {}
-protected:
- virtual void Initialize() const;
-};
-
-
-void PspKernInfo::Initialize() const
-{
- mbInitialized = true;
-
- // get the kerning pairs from psprint
- const psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
- typedef std::list< psp::KernPair > PspKernPairs;
- const PspKernPairs& rKernPairs = rMgr.getKernPairs( mnFontId );
- if( rKernPairs.empty() )
- return;
-
- PspKernPairs::const_iterator it = rKernPairs.begin();
- for(; it != rKernPairs.end(); ++it )
- {
- ImplKernPairData aKernPair = { it->first, it->second, it->kern_x };
- maUnicodeKernPairs.insert( aKernPair );
- }
-}
-
-
sal_uInt16 SvpSalGraphics::SetFont( FontSelectPattern* pIFSD, int nFallbackLevel )
{
// release all no longer needed font resources
@@ -268,20 +237,9 @@ void SvpSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLe
}
-sal_uLong SvpSalGraphics::GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs )
+sal_uLong SvpSalGraphics::GetKernPairs( sal_uLong, ImplKernPairData* )
{
- sal_uLong nGotPairs = 0;
-
- if( m_pServerFont[0] != NULL )
- {
- ImplKernPairData* pTmpKernPairs = NULL;
- nGotPairs = m_pServerFont[0]->GetKernPairs( &pTmpKernPairs );
- for( sal_uLong i = 0; i < nPairs && i < nGotPairs; ++i )
- pKernPairs[ i ] = pTmpKernPairs[ i ];
- delete[] pTmpKernPairs;
- }
-
- return nGotPairs;
+ return 0;
}
@@ -325,17 +283,11 @@ void SvpSalGraphics::GetDevFontList( ImplDevFontList* pDevFontList )
// normalize face number to the GlyphCache
int nFaceNum = rMgr.getFontFaceNumber( aInfo.m_nID );
- // for fonts where extra kerning info can be provided on demand
- // an ExtraKernInfo object is supplied
- const ExtraKernInfo* pExtraKernInfo = NULL;
- if( aInfo.m_eType == psp::fonttype::Type1 )
- pExtraKernInfo = new PspKernInfo( *it );
-
// inform GlyphCache about this font provided by the PsPrint subsystem
ImplDevFontAttributes aDFA = GenPspGraphics::Info2DevFontAttributes( aInfo );
aDFA.mnQuality += 4096;
const OString& rFileName = rMgr.getFontFileSysPath( aInfo.m_nID );
- rGC.AddFontFile( rFileName, nFaceNum, aInfo.m_nID, aDFA, pExtraKernInfo );
+ rGC.AddFontFile( rFileName, nFaceNum, aInfo.m_nID, aDFA );
}
// announce glyphcache fonts
diff --git a/vcl/inc/generic/glyphcache.hxx b/vcl/inc/generic/glyphcache.hxx
index 2c227fc2610f..179c2b25c2fb 100644
--- a/vcl/inc/generic/glyphcache.hxx
+++ b/vcl/inc/generic/glyphcache.hxx
@@ -29,7 +29,6 @@ class ServerFont;
class GlyphCachePeer;
class ServerFontLayoutEngine;
class ServerFontLayout;
-class ExtraKernInfo;
struct ImplKernPairData;
class ImplFontOptions;
@@ -75,8 +74,7 @@ public:
static GlyphCache& GetInstance();
void AddFontFile( const OString& rNormalizedName,
- int nFaceNum, sal_IntPtr nFontId, const ImplDevFontAttributes&,
- const ExtraKernInfo* = NULL );
+ int nFaceNum, sal_IntPtr nFontId, const ImplDevFontAttributes&);
void AnnounceFonts( ImplDevFontList* ) const;
ServerFont* CacheFont( const FontSelectPattern& );
@@ -200,7 +198,6 @@ public:
const FontSelectPattern& GetFontSelData() const { return maFontSelData; }
void FetchFontMetric( ImplFontMetricData&, long& rFactor ) const;
- sal_uLong GetKernPairs( ImplKernPairData** ) const;
const unsigned char* GetTable( const char* pName, sal_uLong* pLength );
int GetEmUnits() const;
const FT_Size_Metrics& GetMetricsFT() const { return maSizeFT->metrics; }
@@ -372,36 +369,6 @@ public:
int mnYOffset;
};
-// =======================================================================
-
-// ExtraKernInfo allows an on-demand query of extra kerning info #i29881#
-// The kerning values have to be scaled to match the font size before use
-class VCL_DLLPUBLIC ExtraKernInfo
-{
-public:
- ExtraKernInfo( sal_IntPtr nFontId );
- virtual ~ExtraKernInfo() {}
-
- int GetUnscaledKernPairs( ImplKernPairData** ) const;
-
-protected:
- mutable bool mbInitialized;
- virtual void Initialize() const = 0;
-
-protected:
- sal_IntPtr mnFontId;
-
- // container to map a unicode pair to an unscaled kerning value
- struct PairEqual{ int operator()(const ImplKernPairData& rA, const ImplKernPairData& rB) const
- { return (rA.mnChar1 == rB.mnChar1) && (rA.mnChar2 == rB.mnChar2); } };
- struct PairHash{ int operator()(const ImplKernPairData& rA) const
- { return (rA.mnChar1) * 256 ^ rA.mnChar2; } };
- typedef boost::unordered_set< ImplKernPairData, PairHash, PairEqual > UnicodeKernPairs;
- mutable UnicodeKernPairs maUnicodeKernPairs;
-};
-
-// =======================================================================
-
#endif // _SV_GLYPHCACHE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/generic/printergfx.hxx b/vcl/inc/generic/printergfx.hxx
index 68a1069c07dc..94848cbfe80b 100644
--- a/vcl/inc/generic/printergfx.hxx
+++ b/vcl/inc/generic/printergfx.hxx
@@ -121,7 +121,6 @@ class Font3;
class GlyphSet;
class PrinterJob;
class PrintFontManager;
-struct KernPair;
struct CharacterMetric;
/*
@@ -401,8 +400,6 @@ public:
{ maTextColor = rTextColor; }
sal_Int32 GetCharWidth (sal_uInt16 nFrom, sal_uInt16 nTo,
long *pWidthArray);
- const ::std::list< KernPair >& getKernPairs( bool bVertical = false ) const;
-
// for CTL
void DrawGlyphs( const Point& rPoint,
sal_GlyphId* pGlyphIds,
diff --git a/vcl/unx/generic/gdi/salgdi3.cxx b/vcl/unx/generic/gdi/salgdi3.cxx
index ba6628a8ab71..4a5f84ffd2b5 100644
--- a/vcl/unx/generic/gdi/salgdi3.cxx
+++ b/vcl/unx/generic/gdi/salgdi3.cxx
@@ -88,37 +88,6 @@ struct _XRegion
BOX *rects;
BOX extents;
};
-// ===========================================================================
-
-// PspKernInfo allows on-demand-querying of psprint provided kerning info (#i29881#)
-class PspKernInfo : public ExtraKernInfo
-{
-public:
- PspKernInfo( int nFontId ) : ExtraKernInfo(nFontId) {}
-protected:
- virtual void Initialize() const;
-};
-
-//--------------------------------------------------------------------------
-
-void PspKernInfo::Initialize() const
-{
- mbInitialized = true;
-
- // get the kerning pairs from psprint
- const psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
- typedef std::list< psp::KernPair > PspKernPairs;
- const PspKernPairs& rKernPairs = rMgr.getKernPairs( mnFontId );
- if( rKernPairs.empty() )
- return;
-
- PspKernPairs::const_iterator it = rKernPairs.begin();
- for(; it != rKernPairs.end(); ++it )
- {
- ImplKernPairData aKernPair = { it->first, it->second, it->kern_x };
- maUnicodeKernPairs.insert( aKernPair );
- }
-}
// ----------------------------------------------------------------------------
//
@@ -593,17 +562,11 @@ void X11SalGraphics::GetDevFontList( ImplDevFontList *pList )
// normalize face number to the GlyphCache
int nFaceNum = rMgr.getFontFaceNumber( aInfo.m_nID );
- // for fonts where extra kerning info can be provided on demand
- // an ExtraKernInfo object is supplied
- const ExtraKernInfo* pExtraKernInfo = NULL;
- if( aInfo.m_eType == psp::fonttype::Type1 )
- pExtraKernInfo = new PspKernInfo( *it );
-
// inform GlyphCache about this font provided by the PsPrint subsystem
ImplDevFontAttributes aDFA = GenPspGraphics::Info2DevFontAttributes( aInfo );
aDFA.mnQuality += 4096;
const OString& rFileName = rMgr.getFontFileSysPath( aInfo.m_nID );
- rGC.AddFontFile( rFileName, nFaceNum, aInfo.m_nID, aDFA, pExtraKernInfo );
+ rGC.AddFontFile( rFileName, nFaceNum, aInfo.m_nID, aDFA );
}
// announce glyphcache fonts
@@ -665,20 +628,8 @@ X11SalGraphics::GetFontMetric( ImplFontMetricData *pMetric, int nFallbackLevel )
// ---------------------------------------------------------------------------
sal_uLong
-X11SalGraphics::GetKernPairs( sal_uLong nPairs, ImplKernPairData *pKernPairs )
+X11SalGraphics::GetKernPairs( sal_uLong, ImplKernPairData* )
{
- if( ! bPrinter_ )
- {
- if( mpServerFont[0] != NULL )
- {
- ImplKernPairData* pTmpKernPairs;
- sal_uLong nGotPairs = mpServerFont[0]->GetKernPairs( &pTmpKernPairs );
- for( unsigned int i = 0; i < nPairs && i < nGotPairs; ++i )
- pKernPairs[ i ] = pTmpKernPairs[ i ];
- delete[] pTmpKernPairs;
- return nGotPairs;
- }
- }
return 0;
}