shithub: freetype+ttf2subf

Download patch

ref: 3d2f06f399d88f2b94447254ddab6c8f54cec868
parent: 6b19e095be24f993db7a2f4293915f007a91e4e8
author: Werner Lemberg <[email protected]>
date: Wed Jul 16 02:13:34 EDT 2008

Handle CID-keyed fonts wrapped in a SFNT (with cmaps) correctly.

* src/cff/cffload.c (cff_font_load): Pass `pure_cff'.
Invert sids table only if `pure_cff' is set.
* src/cff/cffload.h: Udpated.

* src/cff/cffobjs.c (cff_face_init): Updated.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-07-16  Werner Lemberg  <[email protected]>
+
+	Handle CID-keyed fonts wrapped in a SFNT (with cmaps) correctly.
+
+	* src/cff/cffload.c (cff_font_load): Pass `pure_cff'.
+	Invert sids table only if `pure_cff' is set.
+	* src/cff/cffload.h: Udpated.
+
+	* src/cff/cffobjs.c (cff_face_init): Updated.
+
 2008-07-09  Werner Lemberg  <[email protected]>
 
 	* src/truetype/ttpload.c (tt_face_load_loca): Handle buggy fonts
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -1,3 +1,12 @@
+CHANGES BETWEEN 2.3.8 and 2.3.7
+
+  I. IMPORTANT BUG FIXES
+
+    - CID-keyed fonts in an SFNT wrapper were not handled correctly.
+
+
+======================================================================
+
 CHANGES BETWEEN 2.3.7 and 2.3.6
 
   I. IMPORTANT BUG FIXES
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType and CFF data/program tables loader (body).                  */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -1355,7 +1355,8 @@
   FT_LOCAL_DEF( FT_Error )
   cff_font_load( FT_Stream  stream,
                  FT_Int     face_index,
-                 CFF_Font   font )
+                 CFF_Font   font,
+                 FT_Bool    pure_cff )
   {
     static const FT_Frame_Field  cff_header_fields[] =
     {
@@ -1519,7 +1520,7 @@
     /* read the Charset and Encoding tables if available */
     if ( font->num_glyphs > 0 )
     {
-      FT_Bool  invert = FT_BOOL( dict->cid_registry != 0xFFFFU );
+      FT_Bool  invert = FT_BOOL( dict->cid_registry != 0xFFFFU && pure_cff );
 
 
       error = cff_charset_load( &font->charset, font->num_glyphs, stream,
--- a/src/cff/cffload.h
+++ b/src/cff/cffload.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType & CFF data/program tables loader (specification).           */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2007 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2007, 2008 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -60,7 +60,8 @@
   FT_LOCAL( FT_Error )
   cff_font_load( FT_Stream  stream,
                  FT_Int     face_index,
-                 CFF_Font   font );
+                 CFF_Font   font,
+                 FT_Bool    pure_cff );
 
   FT_LOCAL( void )
   cff_font_done( CFF_Font  font );
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -508,7 +508,7 @@
         goto Exit;
 
       face->extra.data = cff;
-      error = cff_font_load( stream, face_index, cff );
+      error = cff_font_load( stream, face_index, cff, pure_cff );
       if ( error )
         goto Exit;