X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fautofit%2Fafloader.c;h=34ef9d8098518d01fcb4aa06bb30735067736ee8;hb=refs%2Fheads%2Fmaster;hp=6dd9f2a314a15b8a1358cbac9356841219ef9710;hpb=6941c0eff765270ceacc7e8975cd18bc03c8d1de;p=framework%2Fgraphics%2Ffreetype.git diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c index 6dd9f2a..34ef9d8 100644 --- a/src/autofit/afloader.c +++ b/src/autofit/afloader.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter glyph loading routines (body). */ /* */ -/* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ +/* Copyright 2003-2009, 2011-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -22,6 +22,8 @@ #include "aferrors.h" + /* Initialize glyph loader. */ + FT_LOCAL_DEF( FT_Error ) af_loader_init( AF_Loader loader, FT_Memory memory ) @@ -29,13 +31,15 @@ FT_ZERO( loader ); af_glyph_hints_init( &loader->hints, memory ); -#ifdef AF_DEBUG +#ifdef FT_DEBUG_AUTOFIT _af_debug_hints = &loader->hints; #endif return FT_GlyphLoader_New( memory, &loader->gloader ); } + /* Reset glyph loader and compute globals if necessary. */ + FT_LOCAL_DEF( FT_Error ) af_loader_reset( AF_Loader loader, FT_Face face ) @@ -64,6 +68,8 @@ } + /* Finalize glyph loader. */ + FT_LOCAL_DEF( void ) af_loader_done( AF_Loader loader ) { @@ -72,7 +78,7 @@ loader->face = NULL; loader->globals = NULL; -#ifdef AF_DEBUG +#ifdef FT_DEBUG_AUTOFIT _af_debug_hints = NULL; #endif FT_GlyphLoader_Done( loader->gloader ); @@ -80,6 +86,10 @@ } + /* Load a single glyph component. This routine calls itself */ + /* recursively, if necessary, and does the main work of */ + /* `af_loader_load_glyph.' */ + static FT_Error af_loader_load_g( AF_Loader loader, AF_Scaler scaler, @@ -169,8 +179,8 @@ &gloader->current.outline, metrics ); - /* we now need to hint the metrics according to the change in */ - /* width/positioning that occurred during the hinting process */ + /* we now need to adjust the metrics according to the change in */ + /* width/positioning that occurred during the hinting process */ if ( scaler->render_mode != FT_RENDER_MODE_LIGHT ) { FT_Pos old_rsb, old_lsb, new_lsb; @@ -265,7 +275,7 @@ gloader->current.num_subglyphs = num_subglyphs; num_base_subgs = gloader->base.num_subglyphs; - /* now, read each subglyph independently */ + /* now read each subglyph independently */ for ( nn = 0; nn < num_subglyphs; nn++ ) { FT_Vector pp1, pp2; @@ -305,7 +315,7 @@ num_points = gloader->base.outline.n_points; num_new_points = num_points - num_base_points; - /* now perform the transform required for this subglyph */ + /* now perform the transformation required for this subglyph */ if ( subglyph->flags & ( FT_SUBGLYPH_FLAG_SCALE | FT_SUBGLYPH_FLAG_XY_SCALE | @@ -423,9 +433,10 @@ slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance, x_scale ); #else - if ( FT_IS_FIXED_WIDTH( slot->face ) || - ( af_face_globals_is_digit( loader->globals, glyph_index ) && - metrics->digits_have_same_width ) ) + if ( scaler->render_mode != FT_RENDER_MODE_LIGHT && + ( FT_IS_FIXED_WIDTH( slot->face ) || + ( af_face_globals_is_digit( loader->globals, glyph_index ) && + metrics->digits_have_same_width ) ) ) { slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance, metrics->scaler.x_scale ); @@ -444,7 +455,7 @@ #endif slot->metrics.vertAdvance = FT_MulFix( slot->metrics.vertAdvance, - metrics->scaler.y_scale ); + metrics->scaler.y_scale ); slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance ); slot->metrics.vertAdvance = FT_PIX_ROUND( slot->metrics.vertAdvance ); @@ -455,24 +466,28 @@ if ( error ) goto Exit; - slot->outline = internal->loader->base.outline; + /* reassign all outline fields except flags to protect them */ + slot->outline.n_contours = internal->loader->base.outline.n_contours; + slot->outline.n_points = internal->loader->base.outline.n_points; + slot->outline.points = internal->loader->base.outline.points; + slot->outline.tags = internal->loader->base.outline.tags; + slot->outline.contours = internal->loader->base.outline.contours; + slot->format = FT_GLYPH_FORMAT_OUTLINE; } -#ifdef DEBUG_HINTER - af_debug_hinter = hinter; -#endif - Exit: return error; } + /* Load a glyph. */ + FT_LOCAL_DEF( FT_Error ) af_loader_load_glyph( AF_Loader loader, FT_Face face, FT_UInt gindex, - FT_UInt32 load_flags ) + FT_Int32 load_flags ) { FT_Error error; FT_Size size = face->size;