shithub: freetype+ttf2subf

Download patch

ref: 0e95b3d15c3005a6575c514018613dbc25bec3a1
parent: 1ab1e9ae3011392af97ffaed11cb1abb8d605c89
author: Werner Lemberg <[email protected]>
date: Sun Aug 29 06:46:26 EDT 2010

[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ć <[email protected]>.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,16 +1,28 @@
+2010-08-29  Werner Lemberg  <[email protected]>
+
+	[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ć <[email protected]>.
+
 2010-08-28  suzuki toshiya  <[email protected]>
 
 	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  <[email protected]>
 
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -881,21 +881,8 @@
             goto Exit;
 
           for ( j = 1; j < num_glyphs; j++ )
-          {
-            FT_UShort sid = FT_GET_USHORT();
+            charset->sids[j] = 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;
-            }
-          }
-
           FT_FRAME_EXIT();
         }
         break;
@@ -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. */