diff options
author | Philipp Lohmann <pl@openoffice.org> | 2002-11-15 15:15:06 +0000 |
---|---|---|
committer | Philipp Lohmann <pl@openoffice.org> | 2002-11-15 15:15:06 +0000 |
commit | 9b73de5f99f99a1e0571286f81bb15461ea900fc (patch) | |
tree | 5b0c44819b21d418ee78ae62a39b52b33442e1db /psprint | |
parent | 48643ca716385a4a31a12e537cd78fe89039b3f7 (diff) |
#104664# create cmap table for glyphIDs higher than 255
Diffstat (limited to 'psprint')
-rw-r--r-- | psprint/source/fontmanager/fontmanager.cxx | 19 | ||||
-rw-r--r-- | psprint/source/fontsubset/ttcr.c | 38 |
2 files changed, 45 insertions, 12 deletions
diff --git a/psprint/source/fontmanager/fontmanager.cxx b/psprint/source/fontmanager/fontmanager.cxx index e55d3f3f80b6..8fb6ad133878 100644 --- a/psprint/source/fontmanager/fontmanager.cxx +++ b/psprint/source/fontmanager/fontmanager.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fontmanager.cxx,v $ * - * $Revision: 1.30 $ + * $Revision: 1.31 $ * - * last change: $Author: pl $ $Date: 2002-10-25 15:13:05 $ + * last change: $Author: pl $ $Date: 2002-11-15 16:15:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -3140,8 +3140,9 @@ bool PrintFontManager::createFontSubset( sal_uInt16 pGID[256]; sal_uInt8 pOldIndex[256]; - pEnc[ 0 ] = 0; - pGID[ 0 ] = 0; + memset( pEnc, 0, sizeof( pEnc ) ); + memset( pGID, 0, sizeof( pGID ) ); + memset( pOldIndex, 0, sizeof( pOldIndex ) ); int nChar = 1; for( int i = 0; i < nGlyphs; i++ ) { @@ -3151,9 +3152,12 @@ bool PrintFontManager::createFontSubset( } else { - pEnc[ nChar ] = nChar; - pGID[ nChar ] = (sal_uInt16)pGlyphIDs[ i ]; - pOldIndex[ nChar ] = i; + DBG_ASSERT( !(pGlyphIDs[i] & 0xffff0000), "overlong glyph id" ); + DBG_ASSERT( (int)pNewEncoding[i] < nGlyphs, "encoding wrong" ); + DBG_ASSERT( pEnc[pNewEncoding[i]] == 0 && pGID[pNewEncoding[i]] == 0, "duplicate encoded glyph" ); + pEnc[ pNewEncoding[i] ] = pNewEncoding[i]; + pGID[ pNewEncoding[i] ] = (sal_uInt16)pGlyphIDs[ i ]; + pOldIndex[ pNewEncoding[i] ] = i; nChar++; } } @@ -3167,7 +3171,6 @@ bool PrintFontManager::createFontSubset( if( OpenTTFont( aFromFile.GetBuffer(), pTTFontFile->m_nCollectionEntry < 0 ? 0 : pTTFontFile->m_nCollectionEntry, &pTTFont ) != SF_OK ) return false; - TTSimpleGlyphMetrics* pMetrics = GetTTSimpleGlyphMetrics( pTTFont, pGID, nGlyphs, diff --git a/psprint/source/fontsubset/ttcr.c b/psprint/source/fontsubset/ttcr.c index 750807ccb58b..a3e9c207f1e5 100644 --- a/psprint/source/fontsubset/ttcr.c +++ b/psprint/source/fontsubset/ttcr.c @@ -2,9 +2,9 @@ * * $RCSfile: ttcr.c,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: pl $ $Date: 2002-08-02 12:11:24 $ + * last change: $Author: pl $ $Date: 2002-11-15 16:15:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -59,7 +59,7 @@ * ************************************************************************/ -/* $Id: ttcr.c,v 1.2 2002-08-02 12:11:24 pl Exp $ */ +/* $Id: ttcr.c,v 1.3 2002-11-15 16:15:06 pl Exp $ */ /* * TrueTypeCreator method implementation @@ -769,11 +769,41 @@ static sal_uInt8 *PackCmapType0(CmapSubTable *s, sal_uInt32 *length) return ptr; } +static sal_uInt8 *PackCmapType6(CmapSubTable *s, sal_uInt32 *length) +{ + sal_uInt8 *ptr = smalloc(s->n*2 + 10); + sal_uInt8 *p = ptr + 10; + sal_uInt32 i, j; + sal_uInt16 g; + + PutUInt16(6, ptr, 0, 1); + PutUInt16(s->n*2+10, ptr, 2, 1); + PutUInt16(0, ptr, 4, 1); + PutUInt16(0, ptr, 6, 1); + PutUInt16(s->n, ptr, 8, 1 ); + + for (i = 0; i < s->n; i++) { + g = 0; + for (j = 0; j < s->n; j++) { + if (s->xc[j] == i) { + g = (sal_uInt16) s->xg[j]; + } + } + PutUInt16( g, p, 2*i, 1 ); + } + *length = s->n*2+10; + return ptr; +} + + /* XXX it only handles Format 0 encoding tables */ static sal_uInt8 *PackCmap(CmapSubTable *s, sal_uInt32 *length) { - return PackCmapType0(s, length); + if( s->xg[s->n-1] > 0xff ) + return PackCmapType6(s, length); + else + return PackCmapType0(s, length); } static int GetRawData_cmap(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *len, sal_uInt32 *tag) |