diff options
Diffstat (limited to 'src/base/ftobjs.c')
-rw-r--r-- | src/base/ftobjs.c | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index cb44b8c..5069afb 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -4,8 +4,7 @@ /* */ /* The FreeType private base classes (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, */ @@ -131,7 +130,7 @@ { FT_Error error; FT_Memory memory; - FT_Stream stream; + FT_Stream stream = NULL; *astream = 0; @@ -156,6 +155,9 @@ (const FT_Byte*)args->memory_base, args->memory_size ); } + +#ifndef FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT + else if ( args->flags & FT_OPEN_PATHNAME ) { /* create a normal system stream */ @@ -171,6 +173,9 @@ FT_FREE( stream ); stream = args->stream; } + +#endif + else error = FT_Err_Invalid_Argument; @@ -375,7 +380,7 @@ FT_Driver driver; FT_Driver_Class clazz; FT_Memory memory; - FT_GlyphSlot slot; + FT_GlyphSlot slot = NULL; if ( !face || !face->driver ) @@ -561,6 +566,7 @@ FT_Library library; FT_Bool autohint = FALSE; FT_Module hinter; + TT_Face ttface = (TT_Face)face; if ( !face || !face->size || !face->glyph ) @@ -601,7 +607,8 @@ * - Then, auto-hint if FT_LOAD_FORCE_AUTOHINT is set or if we don't * have a native font hinter. * - * - Otherwise, auto-hint for LIGHT hinting mode. + * - Otherwise, auto-hint for LIGHT hinting mode or if there isn't + * any hinting bytecode in the TrueType/OpenType font. * * - Exception: The font is `tricky' and requires the native hinter to * load properly. @@ -626,8 +633,13 @@ FT_Render_Mode mode = FT_LOAD_TARGET_MODE( load_flags ); - if ( mode == FT_RENDER_MODE_LIGHT || - face->internal->ignore_unpatented_hinter ) + /* the check for `num_locations' assures that we actually */ + /* test for instructions in a TTF and not in a CFF-based OTF */ + if ( mode == FT_RENDER_MODE_LIGHT || + face->internal->ignore_unpatented_hinter || + ( FT_IS_SFNT( face ) && + ttface->num_locations && + ttface->max_profile.maxSizeOfInstructions == 0 ) ) autohint = TRUE; } } @@ -1283,7 +1295,7 @@ { FT_Error error; FT_Memory memory; - FT_Stream stream; + FT_Stream stream = NULL; if ( !library ) @@ -1458,7 +1470,7 @@ FT_ULong offset, length; FT_Long pos; FT_Bool is_sfnt_cid; - FT_Byte* sfnt_ps; + FT_Byte* sfnt_ps = NULL; FT_UNUSED( num_params ); FT_UNUSED( params ); @@ -1525,7 +1537,7 @@ { FT_Error error = FT_Err_Cannot_Open_Resource; FT_Memory memory = library->memory; - FT_Byte* pfb_data; + FT_Byte* pfb_data = NULL; int i, type, flags; FT_Long len; FT_Long pfb_len, pfb_pos, pfb_lenpos; @@ -1667,7 +1679,7 @@ FT_Face *aface ) { FT_Memory memory = library->memory; - FT_Byte* sfnt_data; + FT_Byte* sfnt_data = NULL; FT_Error error; FT_Long flag_offset; FT_Long rlen; @@ -1869,7 +1881,7 @@ " is already checked and" " no font is found\n", i )); continue; - } + } if ( errors[i] ) { @@ -3148,7 +3160,7 @@ FT_Error error = FT_Err_Ok; FT_Face face; FT_Memory memory; - FT_CMap cmap; + FT_CMap cmap = NULL; if ( clazz == NULL || charmap == NULL || charmap->face == NULL ) @@ -3887,6 +3899,7 @@ error = set_mode( renderer, parameters->tag, parameters->data ); if ( error ) break; + parameters++; } } @@ -4150,7 +4163,7 @@ FT_Renderer renderer = FT_RENDERER( module ); - if ( renderer->clazz->glyph_format == FT_GLYPH_FORMAT_OUTLINE && + if ( renderer->clazz->glyph_format == FT_GLYPH_FORMAT_OUTLINE && renderer->raster ) renderer->clazz->raster_class->raster_done( renderer->raster ); } |