diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2006-06-09 11:18:38 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2006-06-09 11:18:38 +0000 |
commit | 64b26b051914d03b29ee347c03ac0f50e6e85f28 (patch) | |
tree | f470bfc15f008891db86f8f251824604bd446a70 /vcl | |
parent | a71a393e2c4b498123e4978b434f0aca64ffc085 (diff) |
INTEGRATION: CWS vcl59 (1.124.2); FILE MERGED
2006/05/18 10:24:06 hdu 1.124.2.1: #i65507# allow compilation with FT_VERSION>=2200 headers
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/glyphs/gcach_ftyp.cxx | 69 |
1 files changed, 32 insertions, 37 deletions
diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx index 8b2ddd8d0f03..278615dca386 100644 --- a/vcl/source/glyphs/gcach_ftyp.cxx +++ b/vcl/source/glyphs/gcach_ftyp.cxx @@ -4,10 +4,6 @@ * * $RCSfile: gcach_ftyp.cxx,v $ * - * $Revision: 1.126 $ - * - * last change: $Author: hdu $ $Date: 2006-05-18 08:25:12 $ - * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. * @@ -72,6 +68,11 @@ #else #define FTVERSION (1000*FREETYPE_MAJOR + 100*FREETYPE_MINOR + FREETYPE_PATCH) #endif +#if FTVERSION >= 2200 +typedef const FT_Vector* FT_Vector_CPtr; +#else // FTVERSION < 2200 +typedef FT_Vector* FT_Vector_CPtr; +#endif #include <vector> @@ -90,21 +91,15 @@ #define strncasecmp strnicmp #endif -#include "freetype/internal/ftobjs.h" -#include "freetype/internal/sfnt.h" -#include "freetype/internal/ftstream.h" - #include <svapp.hxx> #include <settings.hxx> #include <i18npool/lang.h> -#if defined( FT_NEXT_SHORT ) && !defined( NEXT_Short ) -// Account for differing versions of freetype... -#define NEXT_Short( x ) FT_NEXT_SHORT( x ) -#define NEXT_UShort( x ) FT_NEXT_USHORT( x ) -#define NEXT_Long( x ) FT_NEXT_LONG( x ) -#define NEXT_ULong( x ) FT_NEXT_ULONG( x ) -#endif +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); } // ----------------------------------------------------------------------- @@ -1818,15 +1813,15 @@ ULONG FreetypeServerFont::GetKernPairs( ImplKernPairData** ppKernPairs ) const // Apple New style kern table pBuffer = pKern; - nVersion = NEXT_ULong( pBuffer ); - nTableCnt = NEXT_ULong( pBuffer ); + nVersion = NEXT_U32( pBuffer ); + nTableCnt = NEXT_U32( pBuffer ); if ( nVersion == 0x00010000 ) { for( USHORT nTableIdx = 0; nTableIdx < nTableCnt; ++nTableIdx ) { - ULONG nLength = NEXT_ULong( pBuffer ); - USHORT nCoverage = NEXT_UShort( pBuffer ); - USHORT nTupleIndex = NEXT_UShort( pBuffer ); + ULONG nLength = NEXT_U32( pBuffer ); + USHORT nCoverage = NEXT_U16( pBuffer ); + USHORT nTupleIndex = NEXT_U16( pBuffer ); // Get kerning type sal_Bool bKernVertical = nCoverage & 0x8000; @@ -1840,14 +1835,14 @@ ULONG FreetypeServerFont::GetKernPairs( ImplKernPairData** ppKernPairs ) const { case 0: // version 0, kerning format 0 { - USHORT nPairs = NEXT_UShort( pBuffer ); + USHORT nPairs = NEXT_U16( pBuffer ); pBuffer += 6; // skip search hints aKernGlyphVector.reserve( aKernGlyphVector.size() + nPairs ); for( int i = 0; i < nPairs; ++i ) { - aKernPair.mnChar1 = NEXT_UShort( pBuffer ); - aKernPair.mnChar2 = NEXT_UShort( pBuffer ); - /*long nUnscaledKern=*/ NEXT_Short( pBuffer ); + aKernPair.mnChar1 = NEXT_U16( pBuffer ); + aKernPair.mnChar2 = NEXT_U16( pBuffer ); + /*long nUnscaledKern=*/ NEXT_S16( pBuffer ); aKernGlyphVector.push_back( aKernPair ); } } @@ -1856,18 +1851,18 @@ ULONG FreetypeServerFont::GetKernPairs( ImplKernPairData** ppKernPairs ) const case 2: // version 0, kerning format 2 { const FT_Byte* pSubTable = pBuffer; - /*USHORT nRowWidth =*/ NEXT_UShort( pBuffer ); - USHORT nOfsLeft = NEXT_UShort( pBuffer ); - USHORT nOfsRight = NEXT_UShort( pBuffer ); - USHORT nOfsArray = NEXT_UShort( pBuffer ); + /*USHORT nRowWidth =*/ NEXT_U16( pBuffer ); + USHORT nOfsLeft = NEXT_U16( pBuffer ); + USHORT nOfsRight = NEXT_U16( pBuffer ); + USHORT nOfsArray = NEXT_U16( pBuffer ); const FT_Byte* pTmp = pSubTable + nOfsLeft; - USHORT nFirstLeft = NEXT_UShort( pTmp ); - USHORT nLastLeft = NEXT_UShort( pTmp ) + nFirstLeft - 1; + USHORT nFirstLeft = NEXT_U16( pTmp ); + USHORT nLastLeft = NEXT_U16( pTmp ) + nFirstLeft - 1; pTmp = pSubTable + nOfsRight; - USHORT nFirstRight = NEXT_UShort( pTmp ); - USHORT nLastRight = NEXT_UShort( pTmp ) + nFirstRight - 1; + USHORT nFirstRight = NEXT_U16( pTmp ); + USHORT nLastRight = NEXT_U16( pTmp ) + nFirstRight - 1; ULONG nPairs = (ULONG)(nLastLeft - nFirstLeft + 1) * (nLastRight - nFirstRight + 1); aKernGlyphVector.reserve( aKernGlyphVector.size() + nPairs ); @@ -1878,7 +1873,7 @@ ULONG FreetypeServerFont::GetKernPairs( ImplKernPairData** ppKernPairs ) const aKernPair.mnChar1 = nLeft; for( int nRight = 0; nRight < nLastRight; ++nRight ) { - if( NEXT_Short( pTmp ) != 0 ) + if( NEXT_S16( pTmp ) != 0 ) { aKernPair.mnChar2 = nRight; aKernGlyphVector.push_back( aKernPair ); @@ -2074,7 +2069,7 @@ extern "C" { // TODO: wait till all compilers accept that calling conventions // for functions are the same independent of implementation constness, // then uncomment the const-tokens in the function interfaces below -static int FT_move_to( FT_Vector* /*const*/ p0, void* vpPolyArgs ) +static int FT_move_to( FT_Vector_CPtr p0, void* vpPolyArgs ) { PolyArgs& rA = *reinterpret_cast<PolyArgs*>(vpPolyArgs); @@ -2085,14 +2080,14 @@ static int FT_move_to( FT_Vector* /*const*/ p0, void* vpPolyArgs ) return 0; } -static int FT_line_to( FT_Vector* /*const*/ p1, void* vpPolyArgs ) +static int FT_line_to( FT_Vector_CPtr p1, void* vpPolyArgs ) { PolyArgs& rA = *reinterpret_cast<PolyArgs*>(vpPolyArgs); rA.AddPoint( p1->x, p1->y, POLY_NORMAL ); return 0; } -static int FT_conic_to( FT_Vector* /*const*/ p1, FT_Vector* /*const*/ p2, void* vpPolyArgs ) +static int FT_conic_to( FT_Vector_CPtr p1, FT_Vector_CPtr p2, void* vpPolyArgs ) { PolyArgs& rA = *reinterpret_cast<PolyArgs*>(vpPolyArgs); @@ -2109,7 +2104,7 @@ static int FT_conic_to( FT_Vector* /*const*/ p1, FT_Vector* /*const*/ p2, void* return 0; } -static int FT_cubic_to( FT_Vector* /*const*/ p1, FT_Vector* /*const*/ p2, FT_Vector* /*const*/ p3, void* vpPolyArgs ) +static int FT_cubic_to( FT_Vector_CPtr p1, FT_Vector_CPtr p2, FT_Vector_CPtr p3, void* vpPolyArgs ) { PolyArgs& rA = *reinterpret_cast<PolyArgs*>(vpPolyArgs); rA.AddPoint( p1->x, p1->y, POLY_CONTROL ); |