From 94ff531ca59a495547530f5c080d8e04e1f34ace Mon Sep 17 00:00:00 2001 From: Xiaofei Zhang Date: Wed, 29 Sep 2010 15:46:40 +0800 Subject: removetooltypes: #i112600# some more changes in vcl and tools, reverted config strings in l10ntools and rsc --- vcl/source/fontsubset/gsub.cxx | 134 ++++++++++++++++++++--------------------- vcl/source/fontsubset/sft.cxx | 2 +- 2 files changed, 68 insertions(+), 68 deletions(-) (limited to 'vcl/source/fontsubset') diff --git a/vcl/source/fontsubset/gsub.cxx b/vcl/source/fontsubset/gsub.cxx index 37650003eefa..4b18af165f74 100644 --- a/vcl/source/fontsubset/gsub.cxx +++ b/vcl/source/fontsubset/gsub.cxx @@ -41,12 +41,12 @@ namespace vcl { -typedef sal_uInt32 ULONG; -typedef sal_uInt32 UINT32; -typedef sal_uInt16 USHORT; +typedef sal_uInt32 sal_uIntPtr; +typedef sal_uInt32 sal_uInt32; +typedef sal_uInt16 sal_uInt16; typedef sal_uInt8 FT_Byte; -typedef std::map GlyphSubstitution; +typedef std::map GlyphSubstitution; inline long NEXT_Long( const unsigned char* &p ) @@ -56,9 +56,9 @@ inline long NEXT_Long( const unsigned char* &p ) return nVal; } -inline USHORT NEXT_UShort( const unsigned char* &p ) +inline sal_uInt16 NEXT_UShort( const unsigned char* &p ) { - USHORT nVal = (p[0]<<8) + p[1]; + sal_uInt16 nVal = (p[0]<<8) + p[1]; p += 2; return nVal; } @@ -77,50 +77,50 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, // parse GSUB header const FT_Byte* pGsubHeader = pGsubBase; - const ULONG nVersion = NEXT_Long( pGsubHeader ); - const USHORT nOfsScriptList = NEXT_UShort( pGsubHeader ); - const USHORT nOfsFeatureTable = NEXT_UShort( pGsubHeader ); - const USHORT nOfsLookupList = NEXT_UShort( pGsubHeader ); + const sal_uIntPtr nVersion = NEXT_Long( pGsubHeader ); + const sal_uInt16 nOfsScriptList = NEXT_UShort( pGsubHeader ); + const sal_uInt16 nOfsFeatureTable = NEXT_UShort( pGsubHeader ); + const sal_uInt16 nOfsLookupList = NEXT_UShort( pGsubHeader ); // sanity check the GSUB header if( nVersion != 0x00010000 ) if( nVersion != 0x00001000 ) // workaround for SunBatang etc. return -1; // unknown format or broken - typedef std::vector ReqFeatureTagList; + typedef std::vector ReqFeatureTagList; ReqFeatureTagList aReqFeatureTagList; aReqFeatureTagList.push_back( MKTAG("vert") ); - typedef std::vector UshortList; + typedef std::vector UshortList; UshortList aFeatureIndexList; UshortList aFeatureOffsetList; // parse Script Table const FT_Byte* pScriptHeader = pGsubBase + nOfsScriptList; - const USHORT nCntScript = NEXT_UShort( pScriptHeader ); + const sal_uInt16 nCntScript = NEXT_UShort( pScriptHeader ); if( pGsubLimit < pScriptHeader + 6 * nCntScript ) return false; - for( USHORT nScriptIndex = 0; nScriptIndex < nCntScript; ++nScriptIndex ) + for( sal_uInt16 nScriptIndex = 0; nScriptIndex < nCntScript; ++nScriptIndex ) { - const ULONG nTag = NEXT_Long( pScriptHeader ); // e.g. hani/arab/kana/hang - const USHORT nOfsScriptTable= NEXT_UShort( pScriptHeader ); - if( (nTag != (USHORT)nRequestedScript) && (nRequestedScript != 0) ) + const sal_uIntPtr nTag = NEXT_Long( pScriptHeader ); // e.g. hani/arab/kana/hang + const sal_uInt16 nOfsScriptTable= NEXT_UShort( pScriptHeader ); + if( (nTag != (sal_uInt16)nRequestedScript) && (nRequestedScript != 0) ) continue; const FT_Byte* pScriptTable = pGsubBase + nOfsScriptList + nOfsScriptTable; if( pGsubLimit < pScriptTable + 4 ) return false; - const USHORT nDefaultLangsysOfs = NEXT_UShort( pScriptTable ); - const USHORT nCntLangSystem = NEXT_UShort( pScriptTable ); - USHORT nLangsysOffset = 0; + const sal_uInt16 nDefaultLangsysOfs = NEXT_UShort( pScriptTable ); + const sal_uInt16 nCntLangSystem = NEXT_UShort( pScriptTable ); + sal_uInt16 nLangsysOffset = 0; if( pGsubLimit < pScriptTable + 6 * nCntLangSystem ) return false; - for( USHORT nLangsysIndex = 0; nLangsysIndex < nCntLangSystem; ++nLangsysIndex ) + for( sal_uInt16 nLangsysIndex = 0; nLangsysIndex < nCntLangSystem; ++nLangsysIndex ) { - const ULONG nInnerTag = NEXT_Long( pScriptTable ); // e.g. KOR/ZHS/ZHT/JAN - const USHORT nOffset= NEXT_UShort( pScriptTable ); - if( (nInnerTag != (USHORT)nRequestedLangsys) && (nRequestedLangsys != 0) ) + const sal_uIntPtr nInnerTag = NEXT_Long( pScriptTable ); // e.g. KOR/ZHS/ZHT/JAN + const sal_uInt16 nOffset= NEXT_UShort( pScriptTable ); + if( (nInnerTag != (sal_uInt16)nRequestedLangsys) && (nRequestedLangsys != 0) ) continue; nLangsysOffset = nOffset; break; @@ -131,15 +131,15 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, const FT_Byte* pLangSys = pGsubBase + nOfsScriptList + nOfsScriptTable + nDefaultLangsysOfs; if( pGsubLimit < pLangSys + 6 ) return false; - /*const USHORT nLookupOrder =*/ NEXT_UShort( pLangSys ); - const USHORT nReqFeatureIdx = NEXT_UShort( pLangSys ); - const USHORT nCntFeature = NEXT_UShort( pLangSys ); + /*const sal_uInt16 nLookupOrder =*/ NEXT_UShort( pLangSys ); + const sal_uInt16 nReqFeatureIdx = NEXT_UShort( pLangSys ); + const sal_uInt16 nCntFeature = NEXT_UShort( pLangSys ); if( pGsubLimit < pLangSys + 2 * nCntFeature ) return false; aFeatureIndexList.push_back( nReqFeatureIdx ); - for( USHORT i = 0; i < nCntFeature; ++i ) + for( sal_uInt16 i = 0; i < nCntFeature; ++i ) { - const USHORT nFeatureIndex = NEXT_UShort( pLangSys ); + const sal_uInt16 nFeatureIndex = NEXT_UShort( pLangSys ); aFeatureIndexList.push_back( nFeatureIndex ); } } @@ -149,15 +149,15 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, const FT_Byte* pLangSys = pGsubBase + nOfsScriptList + nOfsScriptTable + nLangsysOffset; if( pGsubLimit < pLangSys + 6 ) return false; - /*const USHORT nLookupOrder =*/ NEXT_UShort( pLangSys ); - const USHORT nReqFeatureIdx = NEXT_UShort( pLangSys ); - const USHORT nCntFeature = NEXT_UShort( pLangSys ); + /*const sal_uInt16 nLookupOrder =*/ NEXT_UShort( pLangSys ); + const sal_uInt16 nReqFeatureIdx = NEXT_UShort( pLangSys ); + const sal_uInt16 nCntFeature = NEXT_UShort( pLangSys ); if( pGsubLimit < pLangSys + 2 * nCntFeature ) return false; aFeatureIndexList.push_back( nReqFeatureIdx ); - for( USHORT i = 0; i < nCntFeature; ++i ) + for( sal_uInt16 i = 0; i < nCntFeature; ++i ) { - const USHORT nFeatureIndex = NEXT_UShort( pLangSys ); + const sal_uInt16 nFeatureIndex = NEXT_UShort( pLangSys ); aFeatureIndexList.push_back( nFeatureIndex ); } } @@ -173,13 +173,13 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, const FT_Byte* pFeatureHeader = pGsubBase + nOfsFeatureTable; if( pGsubLimit < pFeatureHeader + 2 ) return false; - const USHORT nCntFeature = NEXT_UShort( pFeatureHeader ); + const sal_uInt16 nCntFeature = NEXT_UShort( pFeatureHeader ); if( pGsubLimit < pFeatureHeader + 6 * nCntFeature ) return false; - for( USHORT nFeatureIndex = 0; nFeatureIndex < nCntFeature; ++nFeatureIndex ) + for( sal_uInt16 nFeatureIndex = 0; nFeatureIndex < nCntFeature; ++nFeatureIndex ) { - const ULONG nTag = NEXT_Long( pFeatureHeader ); // e.g. locl/vert/trad/smpl/liga/fina/... - const USHORT nOffset= NEXT_UShort( pFeatureHeader ); + const sal_uIntPtr nTag = NEXT_Long( pFeatureHeader ); // e.g. locl/vert/trad/smpl/liga/fina/... + const sal_uInt16 nOffset= NEXT_UShort( pFeatureHeader ); // ignore unneeded feature lookups if( aFeatureIndexList[0] != nFeatureIndex ) // do not ignore the required feature @@ -195,12 +195,12 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, const FT_Byte* pFeatureTable = pGsubBase + nOfsFeatureTable + nOffset; if( pGsubLimit < pFeatureTable + 2 ) return false; - const USHORT nCntLookups = NEXT_UShort( pFeatureTable ); + const sal_uInt16 nCntLookups = NEXT_UShort( pFeatureTable ); if( pGsubLimit < pFeatureTable + 2 * nCntLookups ) return false; - for( USHORT i = 0; i < nCntLookups; ++i ) + for( sal_uInt16 i = 0; i < nCntLookups; ++i ) { - const USHORT nLookupIndex = NEXT_UShort( pFeatureTable ); + const sal_uInt16 nLookupIndex = NEXT_UShort( pFeatureTable ); aLookupIndexList.push_back( nLookupIndex ); } if( nCntLookups == 0 ) //### hack needed by Mincho/Gothic/Mingliu/Simsun/... @@ -211,12 +211,12 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, const FT_Byte* pLookupHeader = pGsubBase + nOfsLookupList; if( pGsubLimit < pLookupHeader + 2 ) return false; - const USHORT nCntLookupTable = NEXT_UShort( pLookupHeader ); + const sal_uInt16 nCntLookupTable = NEXT_UShort( pLookupHeader ); if( pGsubLimit < pLookupHeader + 2 * nCntLookupTable ) return false; - for( USHORT nLookupIdx = 0; nLookupIdx < nCntLookupTable; ++nLookupIdx ) + for( sal_uInt16 nLookupIdx = 0; nLookupIdx < nCntLookupTable; ++nLookupIdx ) { - const USHORT nOffset = NEXT_UShort( pLookupHeader ); + const sal_uInt16 nOffset = NEXT_UShort( pLookupHeader ); if( std::count( aLookupIndexList.begin(), aLookupIndexList.end(), nLookupIdx ) ) aLookupOffsetList.push_back( nOffset ); } @@ -224,13 +224,13 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, UshortList::const_iterator it = aLookupOffsetList.begin(); for(; it != aLookupOffsetList.end(); ++it ) { - const USHORT nOfsLookupTable = *it; + const sal_uInt16 nOfsLookupTable = *it; const FT_Byte* pLookupTable = pGsubBase + nOfsLookupList + nOfsLookupTable; if( pGsubLimit < pLookupTable + 6 ) return false; - const USHORT eLookupType = NEXT_UShort( pLookupTable ); - /*const USHORT eLookupFlag =*/ NEXT_UShort( pLookupTable ); - const USHORT nCntLookupSubtable = NEXT_UShort( pLookupTable ); + const sal_uInt16 eLookupType = NEXT_UShort( pLookupTable ); + /*const sal_uInt16 eLookupFlag =*/ NEXT_UShort( pLookupTable ); + const sal_uInt16 nCntLookupSubtable = NEXT_UShort( pLookupTable ); // TODO: switch( eLookupType ) if( eLookupType != 1 ) // TODO: once we go beyond SingleSubst @@ -238,16 +238,16 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, if( pGsubLimit < pLookupTable + 2 * nCntLookupSubtable ) return false; - for( USHORT nSubTableIdx = 0; nSubTableIdx < nCntLookupSubtable; ++nSubTableIdx ) + for( sal_uInt16 nSubTableIdx = 0; nSubTableIdx < nCntLookupSubtable; ++nSubTableIdx ) { - const USHORT nOfsSubLookupTable = NEXT_UShort( pLookupTable ); + const sal_uInt16 nOfsSubLookupTable = NEXT_UShort( pLookupTable ); const FT_Byte* pSubLookup = pGsubBase + nOfsLookupList + nOfsLookupTable + nOfsSubLookupTable; if( pGsubLimit < pSubLookup + 6 ) return false; - const USHORT nFmtSubstitution = NEXT_UShort( pSubLookup ); - const USHORT nOfsCoverage = NEXT_UShort( pSubLookup ); + const sal_uInt16 nFmtSubstitution = NEXT_UShort( pSubLookup ); + const sal_uInt16 nOfsCoverage = NEXT_UShort( pSubLookup ); - typedef std::pair GlyphSubst; + typedef std::pair GlyphSubst; typedef std::vector SubstVector; SubstVector aSubstVector; @@ -255,19 +255,19 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, + nOfsLookupList + nOfsLookupTable + nOfsSubLookupTable + nOfsCoverage; if( pGsubLimit < pCoverage + 4 ) return false; - const USHORT nFmtCoverage = NEXT_UShort( pCoverage ); + const sal_uInt16 nFmtCoverage = NEXT_UShort( pCoverage ); switch( nFmtCoverage ) { case 1: // Coverage Format 1 { - const USHORT nCntGlyph = NEXT_UShort( pCoverage ); + const sal_uInt16 nCntGlyph = NEXT_UShort( pCoverage ); if( pGsubLimit < pCoverage + 2 * nCntGlyph ) // TODO? nCntGlyph = (pGsubLimit - pCoverage) / 2; return false; aSubstVector.reserve( nCntGlyph ); - for( USHORT i = 0; i < nCntGlyph; ++i ) + for( sal_uInt16 i = 0; i < nCntGlyph; ++i ) { - const USHORT nGlyphId = NEXT_UShort( pCoverage ); + const sal_uInt16 nGlyphId = NEXT_UShort( pCoverage ); aSubstVector.push_back( GlyphSubst( nGlyphId, 0 ) ); } } @@ -275,17 +275,17 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, case 2: // Coverage Format 2 { - const USHORT nCntRange = NEXT_UShort( pCoverage ); + const sal_uInt16 nCntRange = NEXT_UShort( pCoverage ); if( pGsubLimit < pCoverage + 6 * nCntRange ) // TODO? nCntGlyph = (pGsubLimit - pCoverage) / 6; return false; for( int i = nCntRange; --i >= 0; ) { - const UINT32 nGlyph0 = NEXT_UShort( pCoverage ); - const UINT32 nGlyph1 = NEXT_UShort( pCoverage ); - const USHORT nCovIdx = NEXT_UShort( pCoverage ); - for( UINT32 j = nGlyph0; j <= nGlyph1; ++j ) - aSubstVector.push_back( GlyphSubst( static_cast(j + nCovIdx), 0 ) ); + const sal_uInt32 nGlyph0 = NEXT_UShort( pCoverage ); + const sal_uInt32 nGlyph1 = NEXT_UShort( pCoverage ); + const sal_uInt16 nCovIdx = NEXT_UShort( pCoverage ); + for( sal_uInt32 j = nGlyph0; j <= nGlyph1; ++j ) + aSubstVector.push_back( GlyphSubst( static_cast(j + nCovIdx), 0 ) ); } } break; @@ -297,7 +297,7 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, { case 1: // Single Substitution Format 1 { - const USHORT nDeltaGlyphId = NEXT_UShort( pSubLookup ); + const sal_uInt16 nDeltaGlyphId = NEXT_UShort( pSubLookup ); for(; subst_it != aSubstVector.end(); ++subst_it ) (*subst_it).second = (*subst_it).first + nDeltaGlyphId; @@ -306,12 +306,12 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, case 2: // Single Substitution Format 2 { - const USHORT nCntGlyph = NEXT_UShort( pSubLookup ); + const sal_uInt16 nCntGlyph = NEXT_UShort( pSubLookup ); for( int i = nCntGlyph; (subst_it != aSubstVector.end()) && (--i>=0); ++subst_it ) { if( pGsubLimit < pSubLookup + 2 ) return false; - const USHORT nGlyphId = NEXT_UShort( pSubLookup ); + const sal_uInt16 nGlyphId = NEXT_UShort( pSubLookup ); (*subst_it).second = nGlyphId; } } @@ -343,7 +343,7 @@ int UseGSUB( struct _TrueTypeFont* pTTFile, int nGlyph, int /*wmode*/ ) GlyphSubstitution* pGlyphSubstitution = (GlyphSubstitution*)pTTFile->pGSubstitution; if( pGlyphSubstitution != 0 ) { - GlyphSubstitution::const_iterator it( pGlyphSubstitution->find( sal::static_int_cast(nGlyph) ) ); + GlyphSubstitution::const_iterator it( pGlyphSubstitution->find( sal::static_int_cast(nGlyph) ) ); if( it != pGlyphSubstitution->end() ) nGlyph = (*it).second; } diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 468d4be36b0a..04e53960b6fa 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -1493,7 +1493,7 @@ static void GetKern(TrueTypeFont *ttf) if( !table ) goto badtable; - if (GetUInt16(table, 0, 1) == 0) { /* Traditional Microsoft style table with USHORT version and nTables fields */ + if (GetUInt16(table, 0, 1) == 0) { /* Traditional Microsoft style table with sal_uInt16 version and nTables fields */ ttf->nkern = GetUInt16(table, 2, 1); ttf->kerntables = (const sal_uInt8**)calloc(ttf->nkern, sizeof(sal_uInt8 *)); assert(ttf->kerntables != 0); -- cgit From b7f5f44df674c7e47a8c1597bf082a8292b14efd Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Wed, 12 Jan 2011 15:07:10 +0100 Subject: removetooltypes01: Exchange misleading type sal_uIntPtr with sal_uLong --- vcl/source/fontsubset/gsub.cxx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'vcl/source/fontsubset') diff --git a/vcl/source/fontsubset/gsub.cxx b/vcl/source/fontsubset/gsub.cxx index 4b18af165f74..403e64768872 100644 --- a/vcl/source/fontsubset/gsub.cxx +++ b/vcl/source/fontsubset/gsub.cxx @@ -41,9 +41,7 @@ namespace vcl { -typedef sal_uInt32 sal_uIntPtr; -typedef sal_uInt32 sal_uInt32; -typedef sal_uInt16 sal_uInt16; +typedef sal_uIntPtr sal_uLong; typedef sal_uInt8 FT_Byte; typedef std::map GlyphSubstitution; @@ -77,7 +75,7 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, // parse GSUB header const FT_Byte* pGsubHeader = pGsubBase; - const sal_uIntPtr nVersion = NEXT_Long( pGsubHeader ); + const sal_uLong nVersion = NEXT_Long( pGsubHeader ); const sal_uInt16 nOfsScriptList = NEXT_UShort( pGsubHeader ); const sal_uInt16 nOfsFeatureTable = NEXT_UShort( pGsubHeader ); const sal_uInt16 nOfsLookupList = NEXT_UShort( pGsubHeader ); @@ -87,7 +85,7 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, if( nVersion != 0x00001000 ) // workaround for SunBatang etc. return -1; // unknown format or broken - typedef std::vector ReqFeatureTagList; + typedef std::vector ReqFeatureTagList; ReqFeatureTagList aReqFeatureTagList; aReqFeatureTagList.push_back( MKTAG("vert") ); @@ -103,7 +101,7 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, return false; for( sal_uInt16 nScriptIndex = 0; nScriptIndex < nCntScript; ++nScriptIndex ) { - const sal_uIntPtr nTag = NEXT_Long( pScriptHeader ); // e.g. hani/arab/kana/hang + const sal_uLong nTag = NEXT_Long( pScriptHeader ); // e.g. hani/arab/kana/hang const sal_uInt16 nOfsScriptTable= NEXT_UShort( pScriptHeader ); if( (nTag != (sal_uInt16)nRequestedScript) && (nRequestedScript != 0) ) continue; @@ -118,7 +116,7 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, return false; for( sal_uInt16 nLangsysIndex = 0; nLangsysIndex < nCntLangSystem; ++nLangsysIndex ) { - const sal_uIntPtr nInnerTag = NEXT_Long( pScriptTable ); // e.g. KOR/ZHS/ZHT/JAN + const sal_uLong nInnerTag = NEXT_Long( pScriptTable ); // e.g. KOR/ZHS/ZHT/JAN const sal_uInt16 nOffset= NEXT_UShort( pScriptTable ); if( (nInnerTag != (sal_uInt16)nRequestedLangsys) && (nRequestedLangsys != 0) ) continue; @@ -178,7 +176,7 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, return false; for( sal_uInt16 nFeatureIndex = 0; nFeatureIndex < nCntFeature; ++nFeatureIndex ) { - const sal_uIntPtr nTag = NEXT_Long( pFeatureHeader ); // e.g. locl/vert/trad/smpl/liga/fina/... + const sal_uLong nTag = NEXT_Long( pFeatureHeader ); // e.g. locl/vert/trad/smpl/liga/fina/... const sal_uInt16 nOffset= NEXT_UShort( pFeatureHeader ); // ignore unneeded feature lookups -- cgit