| Index: src/autofit/afloader.c
|
| diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c
|
| index 34ef9d8098518d01fcb4aa06bb30735067736ee8..17a6fb7c3b8862a0fcc34d196e4974903e276a5f 100644
|
| --- a/src/autofit/afloader.c
|
| +++ b/src/autofit/afloader.c
|
| @@ -4,7 +4,7 @@
|
| /* */
|
| /* Auto-fitter glyph loading routines (body). */
|
| /* */
|
| -/* Copyright 2003-2009, 2011-2012 by */
|
| +/* Copyright 2003-2009, 2011-2013 by */
|
| /* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
| /* */
|
| /* This file is part of the FreeType project, and may only be used, */
|
| @@ -16,18 +16,22 @@
|
| /***************************************************************************/
|
|
|
|
|
| +#include "afglobal.h"
|
| #include "afloader.h"
|
| #include "afhints.h"
|
| -#include "afglobal.h"
|
| #include "aferrors.h"
|
| +#include "afmodule.h"
|
|
|
|
|
| /* Initialize glyph loader. */
|
|
|
| FT_LOCAL_DEF( FT_Error )
|
| - af_loader_init( AF_Loader loader,
|
| - FT_Memory memory )
|
| + af_loader_init( AF_Module module )
|
| {
|
| + AF_Loader loader = module->loader;
|
| + FT_Memory memory = module->root.library->memory;
|
| +
|
| +
|
| FT_ZERO( loader );
|
|
|
| af_glyph_hints_init( &loader->hints, memory );
|
| @@ -41,10 +45,11 @@
|
| /* Reset glyph loader and compute globals if necessary. */
|
|
|
| FT_LOCAL_DEF( FT_Error )
|
| - af_loader_reset( AF_Loader loader,
|
| + af_loader_reset( AF_Module module,
|
| FT_Face face )
|
| {
|
| - FT_Error error = AF_Err_Ok;
|
| + FT_Error error = FT_Err_Ok;
|
| + AF_Loader loader = module->loader;
|
|
|
|
|
| loader->face = face;
|
| @@ -54,7 +59,7 @@
|
|
|
| if ( loader->globals == NULL )
|
| {
|
| - error = af_face_globals_new( face, &loader->globals );
|
| + error = af_face_globals_new( face, &loader->globals, module );
|
| if ( !error )
|
| {
|
| face->autohint.data =
|
| @@ -71,8 +76,11 @@
|
| /* Finalize glyph loader. */
|
|
|
| FT_LOCAL_DEF( void )
|
| - af_loader_done( AF_Loader loader )
|
| + af_loader_done( AF_Module module )
|
| {
|
| + AF_Loader loader = module->loader;
|
| +
|
| +
|
| af_glyph_hints_done( &loader->hints );
|
|
|
| loader->face = NULL;
|
| @@ -104,9 +112,11 @@
|
| AF_GlyphHints hints = &loader->hints;
|
| FT_GlyphSlot slot = face->glyph;
|
| FT_Slot_Internal internal = slot->internal;
|
| + FT_Int32 flags;
|
|
|
|
|
| - error = FT_Load_Glyph( face, glyph_index, load_flags );
|
| + flags = load_flags | FT_LOAD_LINEAR_DESIGN;
|
| + error = FT_Load_Glyph( face, glyph_index, flags );
|
| if ( error )
|
| goto Exit;
|
|
|
| @@ -124,10 +134,6 @@
|
| FT_Vector_Transform( &loader->trans_delta, &inverse );
|
| }
|
|
|
| - /* set linear metrics */
|
| - slot->linearHoriAdvance = slot->metrics.horiAdvance;
|
| - slot->linearVertAdvance = slot->metrics.vertAdvance;
|
| -
|
| switch ( slot->format )
|
| {
|
| case FT_GLYPH_FORMAT_OUTLINE:
|
| @@ -137,8 +143,8 @@
|
| loader->trans_delta.x,
|
| loader->trans_delta.y );
|
|
|
| - /* copy the outline points in the loader's current */
|
| - /* extra points which is used to keep original glyph coordinates */
|
| + /* copy the outline points in the loader's current */
|
| + /* extra points which are used to keep original glyph coordinates */
|
| error = FT_GLYPHLOADER_CHECK_POINTS( gloader,
|
| slot->outline.n_points + 4,
|
| slot->outline.n_contours );
|
| @@ -343,14 +349,14 @@
|
| if ( start_point + k >= num_base_points ||
|
| l >= (FT_UInt)num_new_points )
|
| {
|
| - error = AF_Err_Invalid_Composite;
|
| + error = FT_THROW( Invalid_Composite );
|
| goto Exit;
|
| }
|
|
|
| l += num_base_points;
|
|
|
| - /* for now, only use the current point coordinates; */
|
| - /* we may consider another approach in the near future */
|
| + /* for now, only use the current point coordinates; */
|
| + /* we eventually may consider another approach */
|
| p1 = gloader->base.outline.points + start_point + k;
|
| p2 = gloader->base.outline.points + start_point + l;
|
|
|
| @@ -381,7 +387,7 @@
|
|
|
| default:
|
| /* we don't support other formats (yet?) */
|
| - error = AF_Err_Unimplemented_Feature;
|
| + error = FT_THROW( Unimplemented_Feature );
|
| }
|
|
|
| Hint_Metrics:
|
| @@ -484,18 +490,19 @@
|
| /* Load a glyph. */
|
|
|
| FT_LOCAL_DEF( FT_Error )
|
| - af_loader_load_glyph( AF_Loader loader,
|
| + af_loader_load_glyph( AF_Module module,
|
| FT_Face face,
|
| FT_UInt gindex,
|
| FT_Int32 load_flags )
|
| {
|
| FT_Error error;
|
| - FT_Size size = face->size;
|
| + FT_Size size = face->size;
|
| + AF_Loader loader = module->loader;
|
| AF_ScalerRec scaler;
|
|
|
|
|
| if ( !size )
|
| - return AF_Err_Invalid_Argument;
|
| + return FT_THROW( Invalid_Argument );
|
|
|
| FT_ZERO( &scaler );
|
|
|
| @@ -508,7 +515,7 @@
|
| scaler.render_mode = FT_LOAD_TARGET_MODE( load_flags );
|
| scaler.flags = 0; /* XXX: fix this */
|
|
|
| - error = af_loader_reset( loader, face );
|
| + error = af_loader_reset( module, face );
|
| if ( !error )
|
| {
|
| AF_ScriptMetrics metrics;
|
|
|