diff options
author | marha <marha@users.sourceforge.net> | 2011-07-18 08:30:47 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-07-18 08:30:47 +0200 |
commit | d8e3f99cdf46297afeb26fe15ad30f7c6de8ee7c (patch) | |
tree | 199776414c3aa9aab0a35c1d16d38c7a072d6665 /freetype/src/cff | |
parent | 7723537ddbe5dd4070f2bebbd4e0c93be3244b18 (diff) | |
download | vcxsrv-d8e3f99cdf46297afeb26fe15ad30f7c6de8ee7c.tar.gz vcxsrv-d8e3f99cdf46297afeb26fe15ad30f7c6de8ee7c.tar.bz2 vcxsrv-d8e3f99cdf46297afeb26fe15ad30f7c6de8ee7c.zip |
Switched to freetype 2.4.5
Diffstat (limited to 'freetype/src/cff')
-rw-r--r-- | freetype/src/cff/cffdrivr.c | 2 | ||||
-rw-r--r-- | freetype/src/cff/cffgload.c | 19 | ||||
-rw-r--r-- | freetype/src/cff/cffload.c | 4 | ||||
-rw-r--r-- | freetype/src/cff/cffobjs.c | 60 | ||||
-rw-r--r-- | freetype/src/cff/cfftypes.h | 5 | ||||
-rw-r--r-- | freetype/src/cff/rules.mk | 15 |
6 files changed, 79 insertions, 26 deletions
diff --git a/freetype/src/cff/cffdrivr.c b/freetype/src/cff/cffdrivr.c index 39f04ee1b..4fd3436cc 100644 --- a/freetype/src/cff/cffdrivr.c +++ b/freetype/src/cff/cffdrivr.c @@ -328,7 +328,7 @@ if ( cff && cff->font_info == NULL ) { CFF_FontRecDict dict = &cff->top_font.font_dict; - PS_FontInfoRec *font_info; + PS_FontInfoRec *font_info = NULL; FT_Memory memory = face->root.memory; diff --git a/freetype/src/cff/cffgload.c b/freetype/src/cff/cffgload.c index e99ee706e..cb06bdf10 100644 --- a/freetype/src/cff/cffgload.c +++ b/freetype/src/cff/cffgload.c @@ -4,8 +4,7 @@ /* */ /* OpenType Glyph Loader (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 1996-2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -1159,8 +1158,8 @@ op = cff_op_flex1; break; default: - /* decrement ip for syntax error message */ - ip--; + FT_TRACE4(( " unknown op (12, %d)\n", v )); + break; } } break; @@ -1213,11 +1212,12 @@ op = cff_op_hvcurveto; break; default: + FT_TRACE4(( " unknown op (%d)\n", v )); break; } if ( op == cff_op_unknown ) - goto Syntax_Error; + continue; /* check arguments */ req_args = cff_argument_counts[op]; @@ -1438,9 +1438,14 @@ FT_TRACE4(( op == cff_op_hlineto ? " hlineto\n" : " vlineto\n" )); - if ( num_args < 1 ) + if ( num_args < 0 ) goto Stack_Underflow; + /* there exist subsetted fonts (found in PDFs) */ + /* which call `hlineto' without arguments */ + if ( num_args == 0 ) + break; + if ( cff_builder_start_point ( builder, x, y ) || check_points( builder, num_args ) ) goto Fail; @@ -2701,7 +2706,7 @@ glyph_index ); if ( fd_index >= cff->num_subfonts ) - fd_index = cff->num_subfonts - 1; + fd_index = (FT_Byte)( cff->num_subfonts - 1 ); top_upm = cff->top_font.font_dict.units_per_em; sub_upm = cff->subfonts[fd_index]->font_dict.units_per_em; diff --git a/freetype/src/cff/cffload.c b/freetype/src/cff/cffload.c index 000cbe3ac..98d8e1c8d 100644 --- a/freetype/src/cff/cffload.c +++ b/freetype/src/cff/cffload.c @@ -387,7 +387,7 @@ { FT_Error error = CFF_Err_Ok; FT_Memory memory = idx->stream->memory; - FT_Byte** t; + FT_Byte** t = NULL; FT_Byte* new_bytes = NULL; @@ -1514,7 +1514,7 @@ if ( dict->cid_registry != 0xFFFFU ) { CFF_IndexRec fd_index; - CFF_SubFont sub; + CFF_SubFont sub = NULL; FT_UInt idx; diff --git a/freetype/src/cff/cffobjs.c b/freetype/src/cff/cffobjs.c index 1cd35c96c..cd386762d 100644 --- a/freetype/src/cff/cffobjs.c +++ b/freetype/src/cff/cffobjs.c @@ -4,8 +4,7 @@ /* */ /* OpenType objects manager (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 1996-2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -162,7 +161,7 @@ { CFF_Face face = (CFF_Face)cffsize->face; CFF_Font font = (CFF_Font)face->extra.data; - CFF_Internal internal; + CFF_Internal internal = NULL; PS_PrivateRec priv; FT_Memory memory = cffsize->face->memory; @@ -421,6 +420,7 @@ { for ( idx = 7; idx < length; idx++ ) name[idx - 7] = name[idx]; + length -= 7; } } else @@ -429,6 +429,51 @@ } + /* Remove the style part from the family name (if present). */ + + static void + remove_style( FT_String* family_name, + const FT_String* style_name ) + { + FT_Int32 family_name_length, style_name_length; + + + family_name_length = strlen( family_name ); + style_name_length = strlen( style_name ); + + if ( family_name_length > style_name_length ) + { + FT_Int idx; + + + for ( idx = 1; idx <= style_name_length; ++idx ) + { + if ( family_name[family_name_length - idx] != + style_name[style_name_length - idx] ) + break; + } + + if ( idx > style_name_length ) + { + /* family_name ends with style_name; remove it */ + idx = family_name_length - style_name_length - 1; + + /* also remove special characters */ + /* between real family name and style */ + while ( idx > 0 && + ( family_name[idx] == '-' || + family_name[idx] == ' ' || + family_name[idx] == '_' || + family_name[idx] == '+' ) ) + --idx; + + if ( idx > 0 ) + family_name[idx + 1] = '\0'; + } + } + } + + FT_LOCAL_DEF( FT_Error ) cff_face_init( FT_Stream stream, FT_Face cffface, /* CFF_Face */ @@ -436,14 +481,14 @@ FT_Int num_params, FT_Parameter* params ) { - CFF_Face face = (CFF_Face)cffface; + CFF_Face face = (CFF_Face)cffface; FT_Error error; SFNT_Service sfnt; FT_Service_PsCMaps psnames; PSHinter_Service pshinter; FT_Bool pure_cff = 1; FT_Bool sfnt_format = 0; - FT_Library library = cffface->driver->root.library; + FT_Library library = cffface->driver->root.library; sfnt = (SFNT_Service)FT_Get_Module_Interface( @@ -523,7 +568,7 @@ /* now load and parse the CFF table in the file */ { - CFF_Font cff; + CFF_Font cff = NULL; CFF_FontRecDict dict; FT_Memory memory = cffface->memory; FT_Int32 flags; @@ -758,6 +803,9 @@ /* case, the remaining string in `fullp' will be used as */ /* the style name. */ style_name = cff_strcpy( memory, fullp ); + + /* remove the style part from the family name (if present) */ + remove_style( cffface->family_name, style_name ); } break; } diff --git a/freetype/src/cff/cfftypes.h b/freetype/src/cff/cfftypes.h index d40535765..665ab6f68 100644 --- a/freetype/src/cff/cfftypes.h +++ b/freetype/src/cff/cfftypes.h @@ -5,7 +5,7 @@ /* Basic OpenType/CFF type definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2006, 2007, 2008, 2010 by */ +/* Copyright 1996-2003, 2006-2008, 2010-2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -212,8 +212,7 @@ FT_BEGIN_HEADER } CFF_SubFontRec, *CFF_SubFont; - /* maximum number of sub-fonts in a CID-keyed file */ -#define CFF_MAX_CID_FONTS 32 +#define CFF_MAX_CID_FONTS 256 typedef struct CFF_FontRec_ diff --git a/freetype/src/cff/rules.mk b/freetype/src/cff/rules.mk index 4100c8068..ca7aa5de8 100644 --- a/freetype/src/cff/rules.mk +++ b/freetype/src/cff/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2001, 2003 by +# Copyright 1996-2000, 2001, 2003, 2011 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -23,19 +23,20 @@ CFF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(CFF_DIR)) # CFF driver sources (i.e., C files) # -CFF_DRV_SRC := $(CFF_DIR)/cffobjs.c \ - $(CFF_DIR)/cffload.c \ +CFF_DRV_SRC := $(CFF_DIR)/cffcmap.c \ + $(CFF_DIR)/cffdrivr.c \ $(CFF_DIR)/cffgload.c \ + $(CFF_DIR)/cffload.c \ + $(CFF_DIR)/cffobjs.c \ $(CFF_DIR)/cffparse.c \ - $(CFF_DIR)/cffcmap.c \ - $(CFF_DIR)/cffdrivr.c + $(CFF_DIR)/cffpic.c # CFF driver headers # CFF_DRV_H := $(CFF_DRV_SRC:%.c=%.h) \ + $(CFF_DIR)/cfferrs.h \ $(CFF_DIR)/cfftoken.h \ - $(CFF_DIR)/cfftypes.h \ - $(CFF_DIR)/cfferrs.h + $(CFF_DIR)/cfftypes.h # CFF driver object(s) |