shithub: freetype+ttf2subf

Download patch

ref: 22e970a23e8667aeb0ff6ac1c59ac659ad71059a
parent: 6874d85ba0cb281aa977dfaf1964229879437715
author: Werner Lemberg <[email protected]>
date: Sat Sep 20 08:20:21 EDT 2008

Formatting, minor code fixes.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,8 @@
 	* src/base/ftadvanc.c (FT_Get_Advance, FT_Get_Advances): Use
 	FT_ERROR_BASE.
 
+	* docs/formats.txt: Updated.
+
 2008-09-19  suzuki toshiya  <[email protected]>
 
 	* src/base/ftmac.c: Import sfnt-wrapped Type1 and sfnt-wrapped
@@ -32,10 +34,10 @@
 
 2008-09-19  suzuki toshiya  <[email protected]>
 
-	* src/base/ftobjs.c (Mac_Read_sfnt_Resource): Fix double free bug
-	in sfnt-wrapped Type1 and sfnt-wrapped CID-keyed font support code.
-	open_face_from_buffer() frees the passed buffer when it cannot
-	open a face from the buffer, so the caller must not free it.
+	* src/base/ftobjs.c (Mac_Read_sfnt_Resource): Fix double free bug in
+	sfnt-wrapped Type1 and sfnt-wrapped CID-keyed font support code.
+	`open_face_from_buffer' frees the passed buffer if it cannot open a
+	face from the buffer, so the caller must not free it.
 
 2008-09-19  suzuki toshiya  <[email protected]>
 
@@ -42,7 +44,7 @@
 	* src/base/ftobjs.c (Mac_Read_sfnt_Resource): Add initial support
 	for sfnt-wrapped Type1 and sfnt-wrapped CID-keyed font.
 	(ft_lookup_PS_in_sfnt): New function to look up `TYP1' or `CID '
-	table in sfnt table directory. It is used before loading TrueType
+	table in sfnt table directory.  It is used before loading TrueType
 	font driver.
 
 	* docs/CHANGES: Add note about the current status of sfnt-wrapped
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -2,10 +2,16 @@
 
   I. IMPORTANT BUG FIXES
 
-    - PS Type1 and CID-keyed fonts in an SFNT wrapper were not loaded.
-      In version 2.3.8, the core tables `TYP1' or `CID ' are passed to
-      PS Type1 or CID-keyed font drivers, other tables (`ALMX', `BBOX'
-      etc) are not supported yet.
+    - CID-keyed fonts in an SFNT wrapper were not handled correctly.
+
+
+  II. IMPORTANT CHANGES
+
+    - Rudimentary support for Type 1  fonts and CID-keyed Type 1 fonts
+      in an SFNT wrapper has been  added -- such fonts are used on the
+      Mac.  The core  SFNT tables `TYP1' and `CID '  are passed to the
+      PS Type 1  and CID-keyed PS font drivers;  other tables (`ALMX',
+      `BBOX', etc.) are not supported yet.
 
 
 ======================================================================
--- a/docs/formats.txt
+++ b/docs/formats.txt
@@ -51,12 +51,14 @@
 ---  ---     BDF    ---     ---        bdf      5005.BDF_Spec.pdf, X11
 
 
----  SFNT    PS     TYPE_1  ---        ---      Type 1 GX Font Format
-                                                (for the Mac)
-MAC  SFNT    PS     TYPE_1  ---        ---      Type 1 GX Font Format
-                                                (for the Mac)
----  SFNT    PS     TYPE_1  CID        ---      5180.sfnt.pdf (for the Mac)
-MAC  SFNT    PS     TYPE_1  CID        ---      5180.sfnt.pdf (for the Mac)
+---  SFNT    PS     TYPE_1  ---        type1    Type 1 GX Font Format
+                                                (for the Mac) [3]
+MAC  SFNT    PS     TYPE_1  ---        type1    Type 1 GX Font Format
+                                                (for the Mac) [3]
+---  SFNT    PS     TYPE_1  CID        cid      5180.sfnt.pdf (for the Mac)
+                                                [3]
+MAC  SFNT    PS     TYPE_1  CID        cid      5180.sfnt.pdf (for the Mac)
+                                                [3]
 ---  SFNT    PS     CFF     ---        cff      OT spec, 5176.CFF.pdf
                                                 (`OTTO' format)
 MAC  SFNT    PS     CFF     ---        cff      OT spec, 5176.CFF.pdf
@@ -139,9 +141,11 @@
 
     (free registration required).
 
+[3] Support is rudimentary currently; some tables are not loaded yet.
+
 ------------------------------------------------------------------------
 
-Copyright 2004, 2005 by
+Copyright 2004, 2005, 2008 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This  file is  part  of the  FreeType  project, and  may  only be  used,
--- a/src/base/ftmac.c
+++ b/src/base/ftmac.c
@@ -829,13 +829,14 @@
   }
 
 
-  /* Look up `TYP1' or `CID ' table from sfnt table directory. */
-  /* offset & length must exclude the binary header in tables. */
+  /* Look up `TYP1' or `CID ' table from sfnt table directory.       */
+  /* `offset' and `length' must exclude the binary header in tables. */
 
-  /* For proper support, PS Type1 and CID-keyed font drivers  */
-  /* should recognize sfnt-wrapped format. Here, yet TrueType */
-  /* font driver is not loaded, we must parse by ourselves.   */
-  /* We only care the name of table and offset. */
+  /* Type 1 and CID-keyed font drivers should recognize sfnt-wrapped */
+  /* format too.  Here, since we can't expect that the TrueType font */
+  /* driver is loaded unconditially, we must parse the font by       */
+  /* ourselves.  We are only interested in the name of the table and */
+  /* the offset. */
 
   static FT_Error
   ft_lookup_PS_in_sfnt( FT_Byte*   sfnt,
@@ -847,7 +848,8 @@
     FT_UShort  numTables = FT_NEXT_USHORT( p );
 
 
-    p += ( 2 * 3 ); /* skip binary search header */
+    p += 2 * 3;              /* skip binary search header */
+
     for ( ; numTables > 0 ; numTables -- )
     {
       FT_ULong  tag = FT_NEXT_ULONG( p );
@@ -866,7 +868,7 @@
         return FT_Err_Ok;
       }
 
-      /* see Apple "The Type 1 GX Font Format" */
+      /* see Apple's `The Type 1 GX Font Format' */
       if ( tag == FT_MAKE_TAG( 'T', 'Y', 'P', '1' ) )
       {
         *offset += 24;
@@ -945,6 +947,7 @@
         goto Exit;
       }
     }
+
   Try_OpenType:
     error = open_face_from_buffer( library,
                                    sfnt_data,
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1415,13 +1415,14 @@
   }
 
 
-  /* Look up `TYP1' or `CID ' table from sfnt table directory. */
-  /* offset & length must exclude the binary header in tables. */
+  /* Look up `TYP1' or `CID ' table from sfnt table directory.       */
+  /* `offset' and `length' must exclude the binary header in tables. */
 
-  /* For proper support, PS Type1 and CID-keyed font drivers  */
-  /* should recognize sfnt-wrapped format. Here, yet TrueType */
-  /* font driver is not loaded, we must parse by ourselves.   */
-  /* We only care the name of table and offset. */
+  /* Type 1 and CID-keyed font drivers should recognize sfnt-wrapped */
+  /* format too.  Here, since we can't expect that the TrueType font */
+  /* driver is loaded unconditially, we must parse the font by       */
+  /* ourselves.  We are only interested in the name of the table and */
+  /* the offset. */
 
   static FT_Error
   ft_lookup_PS_in_sfnt( FT_Byte*   sfnt,
@@ -1433,7 +1434,8 @@
     FT_UShort  numTables = FT_NEXT_USHORT( p );
 
 
-    p += ( 2 * 3 ); /* skip binary search header */
+    p += 2 * 3;              /* skip binary search header */
+
     for ( ; numTables > 0 ; numTables -- )
     {
       FT_ULong  tag = FT_NEXT_ULONG( p );
@@ -1452,7 +1454,7 @@
         return FT_Err_Ok;
       }
 
-      /* see Apple "The Type 1 GX Font Format" */
+      /* see Apple's `The Type 1 GX Font Format' */
       if ( tag == FT_MAKE_TAG( 'T', 'Y', 'P', '1' ) )
       {
         *offset += 24;
@@ -1546,6 +1548,7 @@
         goto Exit;
       }
     }
+
   Try_OpenType:
     error = open_face_from_buffer( library,
                                    sfnt_data,
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -1338,6 +1338,8 @@
 
     ras.num_gray_spans = 0;
 
+    FT_TRACE7(( "gray_sweep: start\n" ));
+
     for ( yindex = 0; yindex < ras.ycount; yindex++ )
     {
       PCell   cell  = ras.ycells[yindex];
@@ -1371,6 +1373,8 @@
     if ( ras.render_span && ras.num_gray_spans > 0 )
       ras.render_span( ras.span_y, ras.num_gray_spans,
                        ras.gray_spans, ras.render_span_data );
+
+    FT_TRACE7(( "gray_sweep: end\n" ));
   }