summaryrefslogtreecommitdiff
path: root/patches/OOO_1_1_2/vcl-source-glyphs.diff
diff options
context:
space:
mode:
Diffstat (limited to 'patches/OOO_1_1_2/vcl-source-glyphs.diff')
-rw-r--r--patches/OOO_1_1_2/vcl-source-glyphs.diff792
1 files changed, 792 insertions, 0 deletions
diff --git a/patches/OOO_1_1_2/vcl-source-glyphs.diff b/patches/OOO_1_1_2/vcl-source-glyphs.diff
new file mode 100644
index 000000000..b401f7d15
--- /dev/null
+++ b/patches/OOO_1_1_2/vcl-source-glyphs.diff
@@ -0,0 +1,792 @@
+Index: vcl/source/glyphs/gcach_ftyp.cxx
+===================================================================
+RCS file: /cvs/gsl/vcl/source/glyphs/gcach_ftyp.cxx,v
+retrieving revision 1.98.20.2
+diff -u -p -u -r1.98.20.2 gcach_ftyp.cxx
+--- vcl/source/glyphs/gcach_ftyp.cxx 28 Jan 2004 15:22:42 -0000 1.98.20.2
++++ vcl/source/glyphs/gcach_ftyp.cxx 5 Jul 2004 14:01:28 -0000
+@@ -58,13 +59,10 @@
+ *
+ ************************************************************************/
+
+-#if defined(WIN32)
+-#ifndef _SV_SVSYS_HXX
+-
++#ifdef WNT
+ #include <svsys.h>
+ #undef CreateFont
+ #endif
+-#endif
+
+ #include <gcach_ftyp.hxx>
+
+@@ -72,17 +70,25 @@
+ #include <outfont.hxx>
+ #include <bitmap.hxx>
+ #include <bmpacc.hxx>
+-#include <poly.hxx>
++
++#ifndef _TL_POLY_HXX
++#include <tools/poly.hxx>
++#endif
+
+ #include <osl/file.hxx>
+ #include <osl/thread.hxx>
+
+-#include "freetype/freetype.h"
+-#include "freetype/ftglyph.h"
+-#include "freetype/ftoutln.h"
+-#include "freetype/tttables.h"
+-#include "freetype/tttags.h"
+-#include "freetype/ttnameid.h"
++#ifndef INCLUDED_RTL_INSTANCE_HXX
++#include <rtl/instance.hxx>
++#endif
++
++#include "ft2build.h"
++#include FT_FREETYPE_H
++#include FT_GLYPH_H
++#include FT_OUTLINE_H
++#include FT_TRUETYPE_TABLES_H
++#include FT_TRUETYPE_TAGS_H
++#include FT_TRUETYPE_IDS_H
+
+ #ifndef FREETYPE_PATCH
+ // VERSION_MINOR in freetype.h is too coarse
+@@ -251,15 +258,22 @@ void FtFontFile::Unmap()
+ // =======================================================================
+
+ FtFontInfo::FtFontInfo( const ImplFontData& rFontData,
+- const ::rtl::OString& rNativeFileName, int nFaceNum, int nFontId, int nSynthetic )
+-: mpFontFile( FtFontFile::FindFontFile( rNativeFileName ) ),
++ const ::rtl::OString& rNativeFileName,
++ int nFaceNum, int nFontId, int nSynthetic,
++ const unicodeKernMap* pKern
++ )
++:
+ maFontData( rFontData ),
++ mpFontFile( FtFontFile::FindFontFile( rNativeFileName ) ),
+ mnFaceNum( nFaceNum ),
+- mnFontId( nFontId ),
+ mnSynthetic( nSynthetic ),
++ mnFontId( nFontId ),
+ maFaceFT( NULL ),
+ mnRefCount( 0 )
+ {
++ if( pKern )
++ maUnicodeKernPairs = *pKern;
++
+ maFontData.mpSysData = (void*)nFontId;
+ maFontData.mpNext = NULL;
+
+@@ -336,6 +350,43 @@ void FtFontInfo::ReleaseFaceFT( FT_FaceR
+ }
+ }
+
++void FtFontInfo::CacheGlyphIndex( sal_Unicode cChar, int nGI ) const
++{
++ maGlyphMap[ cChar ] = nGI;
++
++ if( maUnicodeKernPairs.size() != maGlyphKernPairs.size() )
++ {
++ // move kerning to glyph kerning map
++ unicodeKernMap::const_iterator left_it =
++ maUnicodeKernPairs.find( cChar );
++ std::map< sal_Unicode, int >::const_iterator right_it;
++ for( left_it = maUnicodeKernPairs.begin(); left_it != maUnicodeKernPairs.end(); ++left_it )
++ {
++ if( left_it->first == cChar )
++ {
++ for( right_it = left_it->second.begin(); right_it != left_it->second.end(); ++right_it )
++ {
++ int nRightGlyph = GetGlyphIndex( right_it->first );
++ if( nRightGlyph != -1 )
++ maGlyphKernPairs[ nGI ][ nRightGlyph ] = right_it->second;
++ }
++ }
++ else
++ {
++ int nLeftGlyph = GetGlyphIndex( left_it->first );
++ if( nLeftGlyph != -1 )
++ {
++ for( right_it = left_it->second.begin(); right_it != left_it->second.end(); ++right_it )
++ {
++ if( right_it->first == cChar )
++ maGlyphKernPairs[ nLeftGlyph ][ nGI ] = right_it->second;
++ }
++ }
++ }
++ }
++ }
++}
++
+ // -----------------------------------------------------------------------
+
+ static unsigned GetUInt( const unsigned char* p ) { return((p[0]<<24)+(p[1]<<16)+(p[2]<<8)+p[3]);}
+@@ -382,11 +433,10 @@ const unsigned char* FtFontInfo::GetTabl
+ // =======================================================================
+
+ FreetypeManager::FreetypeManager()
+-: mnNextFontId( 0x1000 ),
+- mnMaxFontId( 0 )
++: mnMaxFontId( 0 ), mnNextFontId( 0x1000 )
+ {
+ FT_Error rcFT = FT_Init_FreeType( &aLibFT );
+-
++
+ #ifdef RTLD_DEFAULT // true if a good dlfcn.h header was included
+ // Get version of freetype library to enable workarounds.
+ // Freetype <= 2.0.9 does not have FT_Library_Version().
+@@ -449,7 +499,10 @@ void* FreetypeManager::GetFontHandle( in
+ // -----------------------------------------------------------------------
+
+ void FreetypeManager::AddFontFile( const rtl::OString& rNormalizedName,
+- int nFaceNum, int nFontId, const ImplFontData* pData )
++ int nFaceNum, int nFontId,
++ const ImplFontData* pData,
++ const unicodeKernMap* pKern
++ )
+ {
+ if( !rNormalizedName.getLength() )
+ return;
+@@ -457,7 +510,7 @@ void FreetypeManager::AddFontFile( const
+ if( maFontList.find( nFontId ) != maFontList.end() )
+ return;
+
+- FtFontInfo* pFI = new FtFontInfo( *pData, rNormalizedName, nFaceNum, nFontId, 0 );
++ FtFontInfo* pFI = new FtFontInfo( *pData, rNormalizedName, nFaceNum, nFontId, 0, pKern );
+ maFontList[ nFontId ] = pFI;
+ if( mnMaxFontId < nFontId )
+ mnMaxFontId = nFontId;
+@@ -482,8 +535,8 @@ long FreetypeManager::AddFontDir( const
+ rcOSL = aDirItem.getFileStatus( aFileStatus );
+
+ ::rtl::OUString aUSytemPath;
+- OSL_VERIFY( osl_File_E_None
+- == ::osl::FileBase::getSystemPathFromFileURL( aFileStatus.getFileURL(), aUSytemPath ));
++ OSL_VERIFY( osl::FileBase::E_None
++ == osl::FileBase::getSystemPathFromFileURL( aFileStatus.getFileURL(), aUSytemPath ));
+ ::rtl::OString aCFileName = rtl::OUStringToOString( aUSytemPath, theEncoding );
+ const char* pszFontFileName = aCFileName.getStr();
+
+@@ -556,8 +609,21 @@ long FreetypeManager::FetchFontList( Imp
+ for( FontList::const_iterator it(maFontList.begin()); it != maFontList.end(); ++it, ++nCount )
+ {
+ const FtFontInfo& rFFI = *it->second;
+- ImplFontData* pFontData = new ImplFontData( rFFI.GetFontData() );
+- pToAdd->Add( pFontData );
++ rtl::OUString aFamilyName = rFFI.GetFontData().maName;
++ sal_Int32 nIndex = 0;
++ rtl::OUString aAliasNames = rFFI.GetFontData().maMapNames;
++
++ do
++ {
++ ImplFontData* pFontData = new ImplFontData( rFFI.GetFontData() );
++ pFontData->maName = aFamilyName;
++ pFontData->maMapNames.Erase();
++ pToAdd->Add( pFontData );
++ if( nIndex >= 0 )
++ aFamilyName = aAliasNames.getToken( 0, ';', nIndex );
++ else
++ aFamilyName = rtl::OUString();
++ } while( aFamilyName.getLength() );
+ }
+
+ return nCount;
+@@ -581,7 +647,7 @@ FreetypeServerFont* FreetypeManager::Cre
+ if( it != maFontList.end() )
+ {
+ FtFontInfo* pFI = it->second;
+- FreetypeServerFont* pFont = new FreetypeServerFont( rFSD, pFI );
++ FreetypeServerFont* pFont = new FreetypeServerFont( rFSD, pFI, pFI->GetGlyphKernMap(), pFI->GetUnicodeKernMap() );
+ return pFont;
+ }
+
+@@ -592,8 +658,8 @@ FreetypeServerFont* FreetypeManager::Cre
+ // FreetypeServerFont
+ // =======================================================================
+
+-FreetypeServerFont::FreetypeServerFont( const ImplFontSelectData& rFSD, FtFontInfo* pFI )
+-: ServerFont( rFSD ),
++FreetypeServerFont::FreetypeServerFont( const ImplFontSelectData& rFSD, FtFontInfo* pFI, const glyphKernMap* pKern, const unicodeKernMap* pUniKern )
++: ServerFont( rFSD, pKern, pUniKern ),
+ mpFontInfo( pFI ),
+ maFaceFT( NULL ),
+ maSizeFT( NULL ),
+@@ -856,23 +944,23 @@ int FreetypeServerFont::ApplyGlyphTransf
+ case GF_ROTL: // left
+ nAngle += 900;
+ bStretched = (mfStretch != 1.0);
+- aVector.x = +rMetrics.descender * mfStretch;
++ aVector.x = (long)((double)+rMetrics.descender * mfStretch);
+ aVector.y = -rMetrics.ascender;
+- aMatrix.xx = -nSin / mfStretch;
+- aMatrix.yy = -nSin * mfStretch;
+- aMatrix.xy = -nCos * mfStretch;
+- aMatrix.yx = +nCos / mfStretch;
++ aMatrix.xx = (long)((double)-nSin / mfStretch);
++ aMatrix.yy = (long)((double)-nSin * mfStretch);
++ aMatrix.xy = (long)((double)-nCos * mfStretch);
++ aMatrix.yx = (long)((double)+nCos / mfStretch);
+ break;
+ case GF_ROTR: // right
+ nAngle -= 900;
+ bStretched = (mfStretch != 1.0);
+ aVector.x = -maFaceFT->glyph->metrics.horiAdvance;
+- aVector.x += (rMetrics.descender * nSin/65536.0);
+- aVector.y = -(rMetrics.descender * mfStretch * nCos/65536.0);
+- aMatrix.xx = +nSin / mfStretch;
+- aMatrix.yy = +nSin * mfStretch;
+- aMatrix.xy = +nCos * mfStretch;
+- aMatrix.yx = -nCos / mfStretch;
++ aVector.x += (long)((double)rMetrics.descender * nSin/65536.0);
++ aVector.y = -(long)((double)rMetrics.descender * mfStretch * nCos/65536.0);
++ aMatrix.xx = (long)((double)+nSin / mfStretch);
++ aMatrix.yy = (long)((double)+nSin * mfStretch);
++ aMatrix.xy = (long)((double)+nCos * mfStretch);
++ aMatrix.yx = (long)((double)-nCos / mfStretch);
+ break;
+ }
+
+@@ -1049,9 +1137,9 @@ void FreetypeServerFont::InitGlyphData(
+ if( nGlyphFlags & GF_ROTMASK ) { // for bVertical rotated glyphs
+ const FT_Size_Metrics& rMetrics = maFaceFT->size->metrics;
+ #if (FTVERSION < 2000)
+- nCharWidth = (rMetrics.height - rMetrics.descender) * mfStretch;
++ nCharWidth = (long)((double)(rMetrics.height - rMetrics.descender) * mfStretch);
+ #else
+- nCharWidth = (rMetrics.height + rMetrics.descender) * mfStretch;
++ nCharWidth = (long)((double)(rMetrics.height + rMetrics.descender) * mfStretch);
+ #endif
+ }
+ rGD.SetCharWidth( (nCharWidth + 32) >> 6 );
+@@ -1314,34 +1402,6 @@ ULONG FreetypeServerFont::GetFontCodeRan
+ {
+ int nRangeCount = 0;
+
+-#if 0 && (FTVERSION >= 2102)
+- // TODO: enable new version when it is fast enough for big fonts
+- // TODO: implement Get_Next_Missing_Char() and use this
+- FT_UInt nGlyphIndex = 0;
+- sal_uInt32 aChar = FT_Get_First_Char( maFaceFT, &nGlyphIndex );
+- if( nGlyphIndex )
+- nRangeCount = 1;
+- if( pCodes )
+- *(pCodes++) = aChar; // start of first range
+- for(;;)
+- {
+- sal_uInt32 bChar = FT_Get_Next_Char( maFaceFT, aChar, &nGlyphIndex );
+- if( !nGlyphIndex )
+- break;
+- if( bChar != aChar+1 )
+- {
+- ++nRangeCount;
+- if( pCodes )
+- {
+- *(pCodes++) = aChar+1; // end of old range
+- *(pCodes++) = bChar; // start of new range
+- }
+- }
+- aChar = bChar;
+- }
+- if( pCodes && nRangeCount )
+- *(pCodes++) = aChar+1; // end of last range
+-#else
+ const unsigned char* pCmap = NULL;
+ ULONG nLength = 0;
+ if( FT_IS_SFNT( maFaceFT ) )
+@@ -1409,8 +1469,6 @@ ULONG FreetypeServerFont::GetFontCodeRan
+ *(pCodes++) = cCode;
+ }
+ }
+-#endif
+-
+ return nRangeCount;
+ }
+ // -----------------------------------------------------------------------
+@@ -1420,7 +1478,10 @@ ULONG FreetypeServerFont::GetFontCodeRan
+ int FreetypeServerFont::GetGlyphKernValue( int nGlyphLeft, int nGlyphRight ) const
+ {
+ if( maSizeFT )
++
+ pFTActivateSize( maSizeFT );
++ if( !FT_HAS_KERNING( maFaceFT ) || !FT_IS_SFNT( maFaceFT ) )
++ return ServerFont::GetGlyphKernValue( nGlyphLeft, nGlyphRight );
+
+ FT_Vector aKernVal;
+ FT_Error rcFT = FT_Get_Kerning( maFaceFT, nGlyphLeft, nGlyphRight,
+@@ -1438,7 +1499,7 @@ ULONG FreetypeServerFont::GetKernPairs(
+
+ *ppKernPairs = NULL;
+ if( !FT_HAS_KERNING( maFaceFT ) || !FT_IS_SFNT( maFaceFT ) )
+- return 0;
++ return ServerFont::GetKernPairs( ppKernPairs );
+
+ // first figure out which glyph pairs are involved in kerning
+ ULONG nKernLength = 0;
+Index: vcl/source/glyphs/gcach_ftyp.hxx
+===================================================================
+RCS file: /cvs/gsl/vcl/source/glyphs/gcach_ftyp.hxx,v
+retrieving revision 1.24
+retrieving revision 1.27
+diff -u -p -u -r1.24 -r1.27
+--- vcl/source/glyphs/gcach_ftyp.hxx 4 Jul 2003 12:51:33 -0000 1.24
++++ vcl/source/glyphs/gcach_ftyp.hxx 18 May 2004 10:55:11 -0000 1.27
+@@ -65,11 +65,15 @@
+ #include <glyphcache.hxx>
+ #include <rtl/textcvt.h>
+
+-typedef int FT_Int;
+-struct FT_GlyphRec_;
++#include "ft2build.h"
++#include FT_FREETYPE_H
++#include FT_GLYPH_H
++#include FT_OUTLINE_H
++#include FT_TRUETYPE_TABLES_H
++#include FT_TRUETYPE_TAGS_H
++#include FT_TRUETYPE_IDS_H
+ class FreetypeServerFont;
+-struct FT_FaceRec_;
+-struct FT_SizeRec_;
++struct FT_GlyphRec_;
+
+ // -----------------------------------------------------------------------
+
+@@ -87,7 +85,6 @@ public:
+ const unsigned char* GetBuffer() const { return mpFileMap; }
+ int GetFileSize() const { return mnFileSize; }
+ const ::rtl::OString* GetFileName() const { return &maNativeFileName; }
+-
+ private:
+ FtFontFile( const ::rtl::OString& rNativeFileName );
+
+@@ -104,7 +101,9 @@ class FtFontInfo
+ {
+ public:
+ FtFontInfo( const ImplFontData&, const ::rtl::OString&,
+- int nFaceNum, int nFontId, int nSynthetic );
++ int nFaceNum, int nFontId, int nSynthetic,
++ const unicodeKernMap* pUnicodeKern = NULL
++ );
+
+ const unsigned char* GetTable( const char*, ULONG* pLength=0 ) const;
+
+@@ -121,6 +120,11 @@ public:
+
+ int GetGlyphIndex( sal_Unicode cChar ) const;
+ void CacheGlyphIndex( sal_Unicode cChar, int nGI ) const;
++ const glyphKernMap* GetGlyphKernMap() const
++ { return (maUnicodeKernPairs.size() || maGlyphKernPairs.size()) ? &maGlyphKernPairs : NULL; }
++ const unicodeKernMap* GetUnicodeKernMap() const
++ { return maUnicodeKernPairs.size() ? &maUnicodeKernPairs : NULL; }
++
+
+ private:
+ ImplFontData maFontData;
+@@ -135,6 +139,9 @@ private:
+ // cache unicode->glyphid mapping because looking it up is expensive
+ typedef ::std::hash_map<sal_Unicode,int> FIGlyphMap;
+ mutable FIGlyphMap maGlyphMap;
++
++ mutable glyphKernMap maGlyphKernPairs;
++ unicodeKernMap maUnicodeKernPairs;
+ };
+
+ // these two inlines are very important for performance
+@@ -147,11 +154,6 @@ inline int FtFontInfo::GetGlyphIndex( sa
+ return -1;
+ }
+
+-inline void FtFontInfo::CacheGlyphIndex( sal_Unicode cChar, int nGI ) const
+-{
+- maGlyphMap[ cChar ] = nGI;
+-}
+-
+ // -----------------------------------------------------------------------
+
+ class FreetypeManager
+@@ -162,7 +164,9 @@ public:
+
+ long AddFontDir( const String& rUrlName );
+ void AddFontFile( const rtl::OString& rNormalizedName,
+- int nFaceNum, int nFontId, const ImplFontData* );
++ int nFaceNum, int nFontId, const ImplFontData*,
++ const unicodeKernMap* pKern = NULL
++ );
+ long FetchFontList( ImplDevFontList* ) const;
+ void ClearFontList();
+
+@@ -182,7 +186,7 @@ private:
+ class FreetypeServerFont : public ServerFont
+ {
+ public:
+- FreetypeServerFont( const ImplFontSelectData&, FtFontInfo* );
++ FreetypeServerFont( const ImplFontSelectData&, FtFontInfo*, const glyphKernMap*, const unicodeKernMap* );
+ virtual ~FreetypeServerFont();
+
+ virtual const ::rtl::OString* GetFontFileName() const { return mpFontInfo->GetFontFileName(); }
+@@ -206,9 +210,10 @@ public:
+ const unsigned char* GetTable( const char* pName, ULONG* pLength )
+ { return mpFontInfo->GetTable( pName, pLength ); }
+ int GetEmUnits() const;
++ const FT_Size_Metrics& GetMetricsFT() const { return maSizeFT->metrics; }
+
+ protected:
+-friend GlyphCache;
++ friend class GlyphCache;
+
+ int ApplyGlyphTransform( int nGlyphFlags, FT_GlyphRec_* ) const;
+ virtual void InitGlyphData( int nGlyphIndex, GlyphData& ) const;
+Index: vcl/source/glyphs/gcach_layout.cxx
+===================================================================
+RCS file: /cvs/gsl/vcl/source/glyphs/gcach_layout.cxx,v
+retrieving revision 1.23.20.1
+retrieving revision 1.29
+diff -u -p -u -r1.23.20.1 -r1.29
+--- vcl/source/glyphs/gcach_layout.cxx 9 Jan 2004 18:13:49 -0000 1.23.20.1
++++ vcl/source/glyphs/gcach_layout.cxx 25 Jun 2004 17:09:25 -0000 1.29
+@@ -59,30 +59,29 @@
+ ************************************************************************/
+
+ #define ENABLE_ICU_LAYOUT
+-#if OSL_DEBUG_LEVEL > 1
+-//#define VERBOSE_DEBUG
+-#endif
+-
+-#if !defined(_SV_SALUNX_HXX) && !defined(WIN32)
+-#include <salunx.h>
+-#endif
+
+ #ifndef _SV_GCACHFTYP_HXX
+-#include <freetype/freetype.h>
+ #include <gcach_ftyp.hxx>
+ #endif
+
+ #ifndef _SV_SALLAYOUT_HXX
+ #include <sallayout.hxx>
+ #endif
++#ifndef _SV_SALGDI_HXX
++#include <salgdi.hxx>
++#endif
+
+ #ifdef WIN32
+ #include <malloc.h>
+ #define alloca _alloca
+-#elif !defined(FREEBSD) && !defined(NETBSD) && !defined(MACOSX)
+-#include <alloca.h>
++#elif defined(SOLARIS) || defined(IRIX)
++ #include <alloca.h>
++#else
++#ifndef MACOSX
++ #include <malloc.h>
++#endif
+ #endif
+
+ #if OSL_DEBUG_LEVEL > 1
+ #include <cstdio>
+ #endif
+@@ -446,6 +446,13 @@
+ meScriptCode( USCRIPT_INVALID_CODE )
+ {}
+
++void ServerFontLayout::DrawText( SalGraphics& rSalGraphics ) const
++{
++ rSalGraphics.DrawServerFontLayout( *this );
++}
++
++//--------------------------------------------------------------------------
++
+ // -----------------------------------------------------------------------
+
+ IcuLayoutEngine::~IcuLayoutEngine()
+Index: vcl/source/glyphs/gcach_rbmp.cxx
+===================================================================
+RCS file: /cvs/gsl/vcl/source/glyphs/gcach_rbmp.cxx,v
+retrieving revision 1.3
+retrieving revision 1.4
+diff -u -p -u -r1.3 -r1.4
+--- vcl/source/glyphs/gcach_rbmp.cxx 13 Dec 2001 14:54:19 -0000 1.3
++++ vcl/source/glyphs/gcach_rbmp.cxx 6 Jan 2004 13:58:48 -0000 1.4
+@@ -64,7 +64,7 @@
+ //------------------------------------------------------------------------
+
+ RawBitmap::RawBitmap()
+-: mnAllocated(0), mpBits(0)
++: mpBits(0), mnAllocated(0)
+ {}
+
+ //------------------------------------------------------------------------
+Index: vcl/source/glyphs/gcach_vdev.cxx
+===================================================================
+RCS file: /cvs/gsl/vcl/source/glyphs/gcach_vdev.cxx,v
+retrieving revision 1.11
+retrieving revision 1.15
+diff -u -p -u -r1.11 -r1.15
+--- vcl/source/glyphs/gcach_vdev.cxx 5 Aug 2002 07:19:22 -0000 1.11
++++ vcl/source/glyphs/gcach_vdev.cxx 17 Jun 2004 12:21:43 -0000 1.15
+@@ -75,10 +75,6 @@
+
+ long VirtDevServerFont::FetchFontList( ImplDevFontList* pToAdd )
+ {
+-#if 0
+- // TODO: add fonts on server but not on client to the list
+- long nCount = 0;
+-#else
+ // TODO: get fonts on server but not on client,
+ // problem is that currently there is no serverside virtual device...
+ VirtualDevice vdev( 1 );
+@@ -112,8 +108,6 @@ long VirtDevServerFont::FetchFontList( I
+
+ pToAdd->Add( new ImplFontData( rData ) ); // TODO: avoid copy if possible
+ }
+-#endif
+-
+ return nCount;
+ }
+
+@@ -202,13 +197,16 @@ void VirtDevServerFont::InitGlyphData( i
+ vdev.SetFont( aFont );
+
+ // get glyph metrics
+- long nCharWidth = 10;
++ sal_Int32 nCharWidth = 10;
+ // TODO: vdev.GetCharWidth( nGlyphIndex, nGlyphIndex, &nCharWidth );
+ rGD.SetCharWidth( nCharWidth );
+
+- const Rectangle aRect = vdev.GetTextRect( aRect, nGlyphIndex );
++ const Rectangle aRect = vdev.GetTextRect(
++ aRect, String(static_cast< sal_Unicode >(nGlyphIndex)) );
+ rGD.SetOffset( aRect.Top(), aRect.Left() );
+- rGD.SetDelta( vdev.GetTextWidth( nGlyphIndex ), 0 );
++ rGD.SetDelta(
++ vdev.GetTextWidth( String(static_cast< sal_Unicode >(nGlyphIndex)) ),
++ 0 );
+ rGD.SetSize( aRect.GetSize() );
+ }
+
+@@ -223,7 +221,7 @@ bool VirtDevServerFont::GetAntialiasAdvi
+
+ bool VirtDevServerFont::GetGlyphBitmap1( int nGlyphIndex, RawBitmap& ) const
+ {
+-#if 0
++ /*
+ // draw bitmap
+ vdev.SetOutputSizePixel( aSize, TRUE );
+ vdev.DrawText( Point(0,0)-rGD.GetMetric().GetOffset(), nGlyphIndex );
+@@ -233,9 +231,8 @@ bool VirtDevServerFont::GetGlyphBitmap1(
+ const Bitmap& rBitmap = vdev.GetBitmap( Point(0,0), aSize );
+ rGD.SetBitmap( new Bitmap( rBitmap ) );
+ return true;
+-#else
++ */
+ return false;
+-#endif
+ }
+
+ // -----------------------------------------------------------------------
+@@ -295,9 +292,8 @@ ULONG VirtDevServerFont::GetKernPairs( I
+
+ bool VirtDevServerFont::GetGlyphOutline( int nGlyphIndex, PolyPolygon& rPolyPoly ) const
+ {
+-#if 1
+ return false;
+-#else
++ /*
+ Font aFont;
+ aFont.SetName ( GetFontSelData().maName );
+ aFont.SetStyleName ( GetFontSelData().maStyleName );
+@@ -311,7 +307,7 @@ bool VirtDevServerFont::GetGlyphOutline(
+
+ const bool bOptimize = true;
+ return vdev.GetGlyphOutline( nGlyphIndex, rPolyPoly, bOptimize );
+-#endif
++ */
+ }
+
+ // =======================================================================
+Index: vcl/source/glyphs/gcach_vdev.hxx
+===================================================================
+RCS file: /cvs/gsl/vcl/source/glyphs/gcach_vdev.hxx,v
+retrieving revision 1.5
+retrieving revision 1.7
+diff -u -p -u -r1.5 -r1.7
+--- vcl/source/glyphs/gcach_vdev.hxx 15 Feb 2002 15:58:57 -0000 1.5
++++ vcl/source/glyphs/gcach_vdev.hxx 4 Feb 2004 15:59:34 -0000 1.7
+@@ -72,7 +72,7 @@ public:
+ virtual bool GetGlyphOutline( int nGlyphIndex, PolyPolygon& ) const;
+
+ protected:
+-friend GlyphCache;
++ friend class GlyphCache;
+ static long FetchFontList( ImplDevFontList* );
+ static void ClearFontList();
+
+Index: vcl/source/glyphs/glyphcache.cxx
+===================================================================
+RCS file: /cvs/gsl/vcl/source/glyphs/glyphcache.cxx,v
+retrieving revision 1.22.40.2
+retrieving revision 1.26
+diff -u -p -u -r1.22.40.2 -r1.26
+--- vcl/source/glyphs/glyphcache.cxx 26 Jan 2004 17:23:59 -0000 1.22.40.2
++++ vcl/source/glyphs/glyphcache.cxx 18 May 2004 10:55:25 -0000 1.26
+@@ -88,8 +88,8 @@ GlyphCache::GlyphCache( ULONG nMaxSize )
+ mnBytesUsed(sizeof(GlyphCache)),
+ mnLruIndex(0),
+ mnGlyphCount(0),
+- mpFtManager(NULL),
+- mpCurrentGCFont(NULL)
++ mpCurrentGCFont(NULL),
++ mpFtManager(NULL)
+ {
+ mpFtManager = new FreetypeManager;
+ }
+@@ -167,7 +167,7 @@ void GlyphCache::RemoveFont( const ImplF
+ FontList::iterator it_next = maFontList.begin(), it;
+ while( it_next != maFontList.end() )
+ {
+- it = it_next++;
++ it = it_next++;
+ if( pFontData != it->first.mpFontData )
+ continue;
+
+@@ -219,10 +219,12 @@ void GlyphCache::AddFontPath( const Stri
+ // -----------------------------------------------------------------------
+
+ void GlyphCache::AddFontFile( const rtl::OString& rNormalizedName, int nFaceNum,
+- int nFontId, const ImplFontData* pFontData )
++ int nFontId, const ImplFontData* pFontData,
++ const unicodeKernMap* pKern
++ )
+ {
+ if( mpFtManager )
+- mpFtManager->AddFontFile( rNormalizedName, nFaceNum, nFontId, pFontData );
++ mpFtManager->AddFontFile( rNormalizedName, nFaceNum, nFontId, pFontData, pKern );
+ }
+
+ // -----------------------------------------------------------------------
+@@ -337,7 +339,7 @@ void GlyphCache::GarbageCollect()
+ FontList::iterator it_next = maFontList.begin(), it;
+ while( it_next != maFontList.end() )
+ {
+- it = it_next++;
++ it = it_next++;
+ ServerFont* pSF = it->second;
+ if( (pSF != NULL)
+ && (pSF->GetRefCount() <= 0)
+@@ -401,15 +403,17 @@ inline void GlyphCache::RemovingGlyph( S
+ // ServerFont
+ // =======================================================================
+
+-ServerFont::ServerFont( const ImplFontSelectData& rFSD )
++ServerFont::ServerFont( const ImplFontSelectData& rFSD, const glyphKernMap* pKern, const unicodeKernMap* pUniKern )
+ : maFontSelData(rFSD),
+ mnExtInfo(0),
+ mnRefCount(1),
+ mnBytesUsed( sizeof(ServerFont) ),
+- mpNextGCFont( NULL ),
+ mpPrevGCFont( NULL ),
++ mpNextGCFont( NULL ),
+ nCos( 0x10000),
+- nSin( 0)
++ nSin( 0),
++ mpKernPairs( pKern ),
++ mpUnicodeKernPairs( pUniKern )
+ {
+ if( rFSD.mnOrientation != 0 )
+ {
+@@ -440,6 +444,65 @@ long ServerFont::Release() const
+
+ // -----------------------------------------------------------------------
+
++int ServerFont::GetGlyphKernValue( int left, int right ) const
++{
++ int kern = 0;
++ if( mpKernPairs )
++ {
++ std::map< int, std::map< int, int > >::const_iterator left_it =
++ mpKernPairs->find( left );
++ if( left_it != mpKernPairs->end() )
++ {
++ std::map< int, int >::const_iterator right_it = left_it->second.find( right );
++ if( right_it != left_it->second.end() )
++ kern = right_it->second;
++ }
++ }
++ return kern*(maFontSelData.mnWidth ? maFontSelData.mnWidth : maFontSelData.mnHeight)/1000;
++}
++
++// -----------------------------------------------------------------------
++
++ULONG ServerFont::GetKernPairs( struct ImplKernPairData** ppKernPairs ) const
++{
++ int nKernEntry = 0;
++ unicodeKernMap::const_iterator left_it;
++ std::map< sal_Unicode, int >::const_iterator right_it;
++ if( mpUnicodeKernPairs )
++ {
++ // count the kern entries
++ for( left_it = mpUnicodeKernPairs->begin(); left_it != mpUnicodeKernPairs->end(); ++left_it )
++ {
++ nKernEntry += left_it->second.size();
++ }
++ }
++
++ // allocate kern pair table
++ if( nKernEntry )
++ {
++ *ppKernPairs = new ImplKernPairData[ nKernEntry ];
++
++ // fill in kern pairs
++ nKernEntry = 0;
++ for( left_it = mpUnicodeKernPairs->begin(); left_it != mpUnicodeKernPairs->end(); ++left_it )
++ {
++ for( right_it = left_it->second.begin(); right_it != left_it->second.end(); ++right_it )
++ {
++ (*ppKernPairs)[ nKernEntry ].mnChar1 = (USHORT)left_it->first;
++ (*ppKernPairs)[ nKernEntry ].mnChar2 = (USHORT)right_it->first;
++ (*ppKernPairs)[ nKernEntry ].mnKern = right_it->second*(maFontSelData.mnWidth ? maFontSelData.mnWidth : maFontSelData.mnHeight)/1000;
++ nKernEntry++;
++ }
++ }
++ }
++ else
++ *ppKernPairs = NULL;
++
++ return (ULONG)nKernEntry;
++}
++
++// -----------------------------------------------------------------------
++
+ GlyphData& ServerFont::GetGlyphData( int nGlyphIndex )
+ {
+ // usually the GlyphData is cached
+@@ -465,7 +528,7 @@ void ServerFont::GarbageCollect( long nM
+ GlyphList::iterator it_next = maGlyphList.begin(), it;
+ while( it_next != maGlyphList.end() )
+ {
+- it = it_next++;
++ it = it_next++;
+ GlyphData& rGD = it->second;
+ if( (nMinLruIndex - rGD.GetLruValue()) > 0 )
+ {
+Index: vcl/source/glyphs/makefile.mk
+===================================================================
+RCS file: /cvs/gsl/vcl/source/glyphs/makefile.mk,v
+retrieving revision 1.5
+retrieving revision 1.6
+diff -u -p -u -r1.5 -r1.6
+--- vcl/source/glyphs/makefile.mk 15 Feb 2002 15:52:27 -0000 1.5
++++ vcl/source/glyphs/makefile.mk 6 Jan 2004 14:00:38 -0000 1.6
+@@ -76,11 +76,9 @@ TARGET=glyphs
+ SLOFILES=\
+ $(SLO)$/glyphcache.obj \
+ $(SLO)$/gcach_rbmp.obj \
++ $(SLO)$/gcach_layout.obj \
+ $(SLO)$/gcach_vdev.obj \
+ $(SLO)$/gcach_ftyp.obj
+-.IF "$(ENABLE_CTL)" != ""
+-SLOFILES+=$(SLO)$/gcach_layout.obj
+-.ENDIF
+ .ENDIF
+
+ # --- Targets ------------------------------------------------------