shithub: freetype+ttf2subf

Download patch

ref: bd7e1c3ce049aca25b34b8b50a162c6e2f297b82
parent: a6d36573bd796e5a8dbee545c83475beeb55f4f7
author: Werner Lemberg <[email protected]>
date: Thu Dec 6 12:17:30 EST 2007

Pass options from one configure script to another as-is (not
expanded).  This is needed for options like
--includedir='${prefix}/include'.

* builds/unix/detect.mk, configure: Prevent argument expansion in
call to the (real) `configure' script.



* src/truetype/ttgload.c (load_truetype_glyph): Fix compilation if
TT_USE_BYTECODE_INTERPRETER isn't defined.



There exist CFFs which contain opcodes for the Type 1 operators
`hsbw' and `closepath' which are both invalid in Type 2 charstrings.
However, it doesn't harm to support them.

* src/cff/cffgload.c (CFF_Operator): Add `cff_op_hsbw' and
`cff_op_closepath.'
(cff_argument_counts): Ditto.

(cff_decoder_parse_charstrings): Handle Type 1 opcodes 9 (closepath)
and 13 (hsbw) which are invalid in Type 2 charstrings.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,36 @@
+2007-12-06  Fix  <[email protected]>
+
+	Pass options from one configure script to another as-is (not
+	expanded).  This is needed for options like
+	--includedir='${prefix}/include'.
+
+	* builds/unix/detect.mk, configure: Prevent argument expansion in
+	call to the (real) `configure' script.
+
+2007-12-06  Werner Lemberg  <[email protected]>
+
+	* src/truetype/ttgload.c (load_truetype_glyph): Fix compilation if
+	TT_USE_BYTECODE_INTERPRETER isn't defined.
+
+2007-12-06  Werner Lemberg  <[email protected]>
+
+	There exist CFFs which contain opcodes for the Type 1 operators
+	`hsbw' and `closepath' which are both invalid in Type 2 charstrings.
+	However, it doesn't harm to support them.
+
+	* src/cff/cffgload.c (CFF_Operator): Add `cff_op_hsbw' and
+	`cff_op_closepath.'
+	(cff_argument_counts): Ditto.
+
+	(cff_decoder_parse_charstrings): Handle Type 1 opcodes 9 (closepath)
+	and 13 (hsbw) which are invalid in Type 2 charstrings.
+
 2007-12-06  suzuki toshiya  <[email protected]>
 
-	* src/base/ftrfork.c (raccess_guess_darwin_newvfs): New function
-	to support new pathname syntax "..namedfork/rsrc" to access
-	a resource fork on Mac OS X. The legacy syntax "/rsrc" does not
-	work on case-sensitive HFS+.
+	* src/base/ftrfork.c (raccess_guess_darwin_newvfs): New function to
+	support new pathname syntax `..namedfork/rsrc' to access a resource
+	fork on Mac OS X.  The legacy syntax `/rsrc' does not work on
+	case-sensitive HFS+.
 	(raccess_guess_darwin_hfsplus): Fix a bug in the calculation of
 	buffer size to store a pathname.
 	* include/freetype/internal/ftrfork.h: Increment the number of
@@ -11,9 +38,9 @@
 
 2007-12-06  suzuki toshiya  <[email protected]>
 
-	* builds/unix/configure.raw: improve the compile tests to search
+	* builds/unix/configure.raw: Improve the compile tests to search
 	Carbon functions.
-	* builds/mac/ftmac.c: import fixes for Carbon incompatibilities
+	* builds/mac/ftmac.c: Import fixes for Carbon incompatibilities
 	proposed by Sean McBride from src/base/ftmac.c (see 2007-11-16).
 
 2007-12-06  suzuki toshiya  <[email protected]>
--- a/builds/unix/detect.mk
+++ b/builds/unix/detect.mk
@@ -79,9 +79,9 @@
   ifdef must_configure
     ifneq ($(have_Makefile),)
       # we are building FT2 not in the src tree
-	      $(TOP_DIR)/builds/unix/configure $(CFG)
+	      $(TOP_DIR)/builds/unix/configure $(value CFG)
     else
-	      cd builds/unix; ./configure $(CFG)
+	      cd builds/unix; ./configure $(value CFG)
     endif
   endif
 
--- a/configure
+++ b/configure
@@ -93,7 +93,7 @@
 
 CFG=
 for x in ${1+"$@"}; do
-  CFG="$CFG \"$x\""
+  CFG="$CFG '$x'"
 done
 CFG=$CFG $GNUMAKE setup unix
 
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -110,6 +110,9 @@
     cff_op_callgsubr,
     cff_op_return,
 
+    cff_op_hsbw,        /* Type 1 opcode: invalid but seen in real life */
+    cff_op_closepath,   /* ditto */
+
     /* do not remove */
     cff_op_max
 
@@ -187,6 +190,9 @@
 
     1, /* callsubr */
     1,
+    0,
+
+    2, /* hsbw */
     0
   };
 
@@ -393,7 +399,7 @@
         error = CFF_Err_Invalid_File_Format;
         goto Exit;
       }
-        
+
       sub = cff->subfonts[fd_index];
     }
 
@@ -954,6 +960,9 @@
         case 8:
           op = cff_op_rrcurveto;
           break;
+        case 9:
+          op = cff_op_closepath;
+          break;
         case 10:
           op = cff_op_callsubr;
           break;
@@ -1055,6 +1064,9 @@
             }
           }
           break;
+        case 13:
+          op = cff_op_hsbw;
+          break;
         case 14:
           op = cff_op_endchar;
           break;
@@ -1168,7 +1180,7 @@
           req_args            = 0;
         }
 
-        req_args &= 15;
+        req_args &= 0x000F;
         if ( num_args < req_args )
           goto Stack_Underflow;
         args     -= req_args;
@@ -2020,6 +2032,30 @@
         case cff_op_dotsection:
           /* this operator is deprecated and ignored by the parser */
           FT_TRACE4(( " dotsection" ));
+          break;
+
+        case cff_op_closepath:
+          /* this is an invalid Type 2 operator; however, there        */
+          /* exist fonts which are incorrectly converted from probably */
+          /* Type 1 to CFF, and some parsers seem to accept it         */
+
+          FT_TRACE4(( " closepath (invalid op)" ));
+
+          args = stack;
+          break;
+
+        case cff_op_hsbw:
+          /* this is an invalid Type 2 operator; however, there        */
+          /* exist fonts which are incorrectly converted from probably */
+          /* Type 1 to CFF, and some parsers seem to accept it         */
+
+          FT_TRACE4(( " hsbw (invalid op)" ));
+
+          decoder->glyph_width = decoder->nominal_width +
+                                   (args[1] >> 16);
+          x    = args[0];
+          y    = 0;
+          args = stack;
           break;
 
         case cff_op_and:
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -1402,11 +1402,13 @@
 
         FT_Stream         old_stream     = loader->stream;
 
+#ifdef TT_USE_BYTECODE_INTERPRETER
         TT_GraphicsState  saved_GS;
 
 
         if ( loader->exec )
           saved_GS = loader->exec->GS;
+#endif
 
         FT_GlyphLoader_Add( gloader );
 
@@ -1416,9 +1418,11 @@
           FT_Vector  pp[4];
 
 
+#ifdef TT_USE_BYTECODE_INTERPRETER
           /* reinitialize graphics state */
           if ( loader->exec )
             loader->exec->GS = saved_GS;
+#endif
 
           /* Each time we call load_truetype_glyph in this loop, the   */
           /* value of `gloader.base.subglyphs' can change due to table */