From dcd2e14c58d0e454c05f9e24cf12f415b3c3c4df Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 25 Jun 2000 07:43:15 +0000 Subject: [PATCH] forgotten fixes. --- src/base/ftobjs.c | 6 ++-- src/cid/cidafm.c | 4 +-- src/cid/cidafm.h | 4 +-- src/cid/type1cid.c | 2 +- src/truetype/ttgload.c | 70 +++++++++++++++++++++++++----------------- 5 files changed, 50 insertions(+), 36 deletions(-) diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 843bf0f2b..beb8dcc3d 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -2360,7 +2360,7 @@ /* */ /* To add a new renderer, simply use FT_Add_Module(). To retrieve a */ /* renderer by its name, use FT_Get_Module(). */ - /* + /* */ FT_EXPORT_FUNC( FT_Renderer ) FT_Get_Renderer( FT_Library library, FT_Glyph_Format format ) { @@ -2587,7 +2587,7 @@ FT_UInt nn; -#define FREETYPE_VER_FIXED ( ( (FT_Long)FREETYPE_MAJOR << 16 ) | +#define FREETYPE_VER_FIXED ( ( (FT_Long)FREETYPE_MAJOR << 16 ) | \ FREETYPE_MINOR ) if ( !library || !clazz ) @@ -2786,7 +2786,7 @@ /* */ /* */ /* The module object is destroyed by the function in case of success. */ - /* + /* */ FT_EXPORT_FUNC( FT_Error ) FT_Remove_Module( FT_Library library, FT_Module module ) { diff --git a/src/cid/cidafm.c b/src/cid/cidafm.c index f75f5b7bc..f7709505c 100644 --- a/src/cid/cidafm.c +++ b/src/cid/cidafm.c @@ -36,7 +36,7 @@ #define FT_COMPONENT trace_cidafm -#if 0 +#if 1 LOCAL_FUNC void CID_Done_AFM( FT_Memory memory, @@ -281,7 +281,7 @@ kerning->y = 0; } -#endif /* 0 */ +#endif /* 1 */ /* END */ diff --git a/src/cid/cidafm.h b/src/cid/cidafm.h index 00babec7e..30d4f0e14 100644 --- a/src/cid/cidafm.h +++ b/src/cid/cidafm.h @@ -38,7 +38,7 @@ } T1_AFM; -#if 0 +#if 1 LOCAL_DEF FT_Error CID_Read_AFM( FT_Face t1_face, @@ -54,7 +54,7 @@ FT_UInt glyph2, FT_Vector* kerning ); -#endif /* 0 */ +#endif /* 1 */ #endif /* CIDAFM_H */ diff --git a/src/cid/type1cid.c b/src/cid/type1cid.c index 855f564d2..dca723cb9 100644 --- a/src/cid/type1cid.c +++ b/src/cid/type1cid.c @@ -24,7 +24,7 @@ #include #include -#if 0 +#if 1 #include #endif diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 8f1fefa27..6e017eea6 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -108,9 +108,9 @@ /*************************************************************************/ /* */ - /* Returns the horizontal metrics in font units for a given glyph. */ - /* If `check' is true, take care of monospaced fonts by returning the */ - /* advance width maximum. */ + /* Returns the horizontal metrics in font units for a given glyph. If */ + /* `check' is true, take care of monospaced fonts by returning the */ + /* advance width maximum. */ /* */ static void Get_HMetrics( TT_Face face, @@ -415,8 +415,8 @@ FT_Error TT_Load_Composite_Glyph( TT_Loader* loader ) { FT_Error error; - FT_Stream stream = loader->stream; - FT_GlyphLoader* gloader = loader->gloader; + FT_Stream stream = loader->stream; + FT_GlyphLoader* gloader = loader->gloader; FT_SubGlyph* subglyph; FT_UInt num_subglyphs; @@ -429,7 +429,7 @@ /* check that we can load a new subglyph */ - error = FT_GlyphLoader_Check_Subglyphs( gloader, num_subglyphs+1 ); + error = FT_GlyphLoader_Check_Subglyphs( gloader, num_subglyphs + 1 ); if ( error ) goto Fail; @@ -480,8 +480,7 @@ subglyph->transform.yy = yy; num_subglyphs++; - } - while (subglyph->flags & MORE_COMPONENTS); + } while ( subglyph->flags & MORE_COMPONENTS ); gloader->current.num_subglyphs = num_subglyphs; @@ -562,7 +561,7 @@ /* Note that we return two more points that are not */ /* part of the glyph outline. */ - n_points += 2; + n_points += 2; /* set up zone for hinting */ tt_prepare_zone( zone, &gloader->current, 0, 0 ); @@ -691,7 +690,7 @@ Get_HMetrics( face, index, (FT_Bool)!(loader->load_flags & - FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH), + FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH), &left_bearing, &advance_width ); @@ -721,8 +720,10 @@ loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale ); #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER + if ( loader->exec ) loader->exec->glyphSize = 0; + #endif error = FT_Err_Ok; goto Exit; @@ -777,13 +778,20 @@ #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER { TT_Size size = (TT_Size)loader->size; + + error = TT_Process_Simple_Glyph( loader, (FT_Bool)( size && size->debug ) ); } + #else + error = Process_Simple_Glyph( loader, 0 ); + #endif - if ( error ) goto Fail; + + if ( error ) + goto Fail; FT_GlyphLoader_Add( gloader ); @@ -830,15 +838,14 @@ } - /***********************************************************************/ - /***********************************************************************/ - /***********************************************************************/ - /*********************************************************************/ - /* Now, read each subglyph independently.. */ + /*********************************************************************/ + /*********************************************************************/ + + /* Now, read each subglyph independently. */ { FT_Int n, num_base_points, num_new_points; - FT_SubGlyph* subglyph; + FT_SubGlyph* subglyph = 0; FT_UInt num_subglyphs = gloader->current.num_subglyphs; FT_UInt num_base_subgs = gloader->base.num_subglyphs; @@ -851,6 +858,7 @@ FT_Vector pp1, pp2; FT_Pos x, y; + /* Each time we call load_truetype_glyph in this loop, the */ /* value of `gloader.base.subglyphs' can change due to table */ /* reallocations. We thus need to recompute the subglyph */ @@ -879,7 +887,7 @@ loader->pp2 = pp2; } - num_points = gloader->base.outline.n_points; + num_points = gloader->base.outline.n_points; num_new_points = num_points - num_base_points; @@ -895,6 +903,7 @@ num_base_points; FT_Vector* limit = cur + num_new_points; + for ( ; cur < limit; cur++, org++ ) { FT_Vector_Transform( cur, &subglyph->transform ); @@ -949,9 +958,9 @@ cur_to_org( num_new_points, &loader->zone ); } - /***********************************************************************/ - /***********************************************************************/ - /***********************************************************************/ + /*******************************************************************/ + /*******************************************************************/ + /*******************************************************************/ /* we have finished loading all sub-glyphs, now, look for */ /* instructions for this composite! */ @@ -1036,11 +1045,11 @@ cur_to_org( n_points, pts ); /* now consider hinting */ - if ( IS_HINTED(loader->load_flags) && n_ins > 0 ) + if ( IS_HINTED( loader->load_flags ) && n_ins > 0 ) { exec->is_composite = TRUE; exec->pedantic_hinting = - (FT_Bool)(loader->load_flags & FT_LOAD_PEDANTIC); + (FT_Bool)( loader->load_flags & FT_LOAD_PEDANTIC ); error = TT_Run_Context( exec, ((TT_Size)loader->size)->debug ); if ( error && exec->pedantic_hinting ) @@ -1051,7 +1060,9 @@ loader->pp1 = pp1[0]; loader->pp2 = pp1[1]; } + #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ + } /* end of composite loading */ } @@ -1059,7 +1070,6 @@ /***********************************************************************/ /***********************************************************************/ /***********************************************************************/ - /***********************************************************************/ Fail: if ( opened_frame ) @@ -1080,6 +1090,7 @@ TT_GlyphSlot glyph = loader->glyph; TT_Size size = (TT_Size)loader->size; + x_scale = 0x10000L; y_scale = 0x10000L; if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ) @@ -1234,12 +1245,14 @@ glyph->metrics.vertAdvance = advance; } - /* Adjust advance width to the value contained in the hdmx table. */ + /* adjust advance width to the value contained in the hdmx table */ if ( !face->postscript.isFixedPitch && size && IS_HINTED( loader->load_flags ) ) { FT_Byte* widths = Get_Advance_Widths( face, size->root.metrics.x_ppem ); + + if ( widths ) glyph->metrics.horiAdvance = widths[glyph_index] << 6; } @@ -1247,7 +1260,6 @@ /* set glyph dimensions */ glyph->metrics.width = bbox.xMax - bbox.xMin; glyph->metrics.height = bbox.yMax - bbox.yMin; - } @@ -1367,7 +1379,7 @@ error = face->goto_table( face, TTAG_glyf, stream, 0 ); if ( error ) { - FT_ERROR(( "TT_Load_Glyph: Could not access glyph table\n" )); + FT_ERROR(( "TT_Load_Glyph: could not access glyph table\n" )); goto Exit; } @@ -1439,9 +1451,11 @@ compute_glyph_metrics( &loader, glyph_index ); #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER + if ( !size || !size->debug ) TT_Done_Context( loader.exec ); -#endif + +#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ Exit: return error;