From 0e95b3d15c3005a6575c514018613dbc25bec3a1 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 29 Aug 2010 10:46:26 +0200 Subject: [PATCH] [cff] Allow SIDs >= 65000. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * src/cff/cffload.c (cff_charset_load): Fix change from 2009-03-20: The threshold for SIDs is not applicable here. I misinterpreted the `SID values 65000 and above are available for implementation use' sentence in the CFF specification. Problem reported by Ivan Ninčić . --- ChangeLog | 24 ++++++++++++++++++------ src/cff/cffload.c | 28 +++------------------------- 2 files changed, 21 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index 03e27a587..d5e536e8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,16 +1,28 @@ +2010-08-29 Werner Lemberg + + [cff] Allow SIDs >= 65000. + + * src/cff/cffload.c (cff_charset_load): Fix change from 2009-03-20: + The threshold for SIDs is not applicable here. I misinterpreted the + `SID values 65000 and above are available for implementation use' + sentence in the CFF specification. + + Problem reported by Ivan Ninčić . + 2010-08-28 suzuki toshiya Force hinting when the font lacks its familyname. - In Type42 or Type11 font embedded in PostScript & PDF, TrueType - sfnt stream may lack `name' table because they are not required. - Hinting for nameless fonts is safer for PDFs including embedded - Chinese fonts. Written by David Bevan, see: + + In Type42 or Type11 font embedded in PostScript & PDF, TrueType sfnt + stream may lack `name' table because they are not required. Hinting + for nameless fonts is safer for PDFs including embedded Chinese + fonts. Written by David Bevan, see: http://lists.gnu.org/archive/html/freetype-devel/2010-08/msg00021.html http://lists.freedesktop.org/archives/poppler/2010-August/006310.html - * src/truetype/ttobjs.c (tt_check_trickyness): If a NULL pointer - by nameless font is given, TRUE is returned to enable hinting. + * src/truetype/ttobjs.c (tt_check_trickyness): If a NULL pointer by + nameless font is given, TRUE is returned to enable hinting. 2010-08-28 suzuki toshiya diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 42e77309a..714572861 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -881,20 +881,7 @@ goto Exit; for ( j = 1; j < num_glyphs; j++ ) - { - FT_UShort sid = FT_GET_USHORT(); - - - /* this constant is given in the CFF specification */ - if ( sid < 65000L ) - charset->sids[j] = sid; - else - { - FT_TRACE0(( "cff_charset_load:" - " invalid SID value %d set to zero\n", sid )); - charset->sids[j] = 0; - } - } + charset->sids[j] = FT_GET_USHORT(); FT_FRAME_EXIT(); } @@ -927,20 +914,11 @@ goto Exit; } - /* check whether the range contains at least one valid glyph; */ - /* the constant is given in the CFF specification */ - if ( glyph_sid >= 65000L ) - { - FT_ERROR(( "cff_charset_load: invalid SID range\n" )); - error = CFF_Err_Invalid_File_Format; - goto Exit; - } - /* try to rescue some of the SIDs if `nleft' is too large */ - if ( nleft > 65000L - 1L || glyph_sid >= 65000L - nleft ) + if ( glyph_sid > 0xFFFFL - nleft ) { FT_ERROR(( "cff_charset_load: invalid SID range trimmed\n" )); - nleft = ( FT_UInt )( 65000L - 1L - glyph_sid ); + nleft = ( FT_UInt )( 0xFFFFL - glyph_sid ); } /* Fill in the range of sids -- `nleft + 1' glyphs. */