From bd7e1c3ce049aca25b34b8b50a162c6e2f297b82 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 6 Dec 2007 17:17:30 +0000 Subject: [PATCH] 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. --- ChangeLog | 39 +++++++++++++++++++++++++++++++++------ builds/unix/detect.mk | 4 ++-- configure | 2 +- src/cff/cffgload.c | 40 ++++++++++++++++++++++++++++++++++++++-- src/truetype/ttgload.c | 4 ++++ 5 files changed, 78 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index c2a30408f..3189f8970 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,36 @@ +2007-12-06 Fix <4d876b82@gmail.com> + + 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 + + * src/truetype/ttgload.c (load_truetype_glyph): Fix compilation if + TT_USE_BYTECODE_INTERPRETER isn't defined. + +2007-12-06 Werner Lemberg + + 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 - * 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 - * 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 diff --git a/builds/unix/detect.mk b/builds/unix/detect.mk index c4130f9bc..e74af5730 100644 --- a/builds/unix/detect.mk +++ b/builds/unix/detect.mk @@ -79,9 +79,9 @@ ifeq ($(PLATFORM),unix) 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 diff --git a/configure b/configure index f251ae417..c72e44b72 100644 --- a/configure +++ b/configure @@ -93,7 +93,7 @@ fi CFG= for x in ${1+"$@"}; do - CFG="$CFG \"$x\"" + CFG="$CFG '$x'" done CFG=$CFG $GNUMAKE setup unix diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 0e2a179c7..cbd4fda4e 100644 --- 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; @@ -2022,6 +2034,30 @@ 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: { FT_Fixed cond = args[0] && args[1]; diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index c3dedd02a..c17a437a9 100644 --- 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 */