diff options
Diffstat (limited to 'freetype/src/autofit/afloader.c')
-rw-r--r-- | freetype/src/autofit/afloader.c | 56 |
1 files changed, 35 insertions, 21 deletions
diff --git a/freetype/src/autofit/afloader.c b/freetype/src/autofit/afloader.c index 17a6fb7c3..0fa3c1278 100644 --- a/freetype/src/autofit/afloader.c +++ b/freetype/src/autofit/afloader.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter glyph loading routines (body). */ /* */ -/* Copyright 2003-2009, 2011-2013 by */ +/* Copyright 2003-2009, 2011-2014 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,6 +21,7 @@ #include "afhints.h" #include "aferrors.h" #include "afmodule.h" +#include "afpic.h" /* Initialize glyph loader. */ @@ -108,7 +109,7 @@ FT_Error error; FT_Face face = loader->face; FT_GlyphLoader gloader = loader->gloader; - AF_ScriptMetrics metrics = loader->metrics; + AF_StyleMetrics metrics = loader->metrics; AF_GlyphHints hints = &loader->hints; FT_GlyphSlot slot = face->glyph; FT_Slot_Internal internal = slot->internal; @@ -180,10 +181,20 @@ /* now load the slot image into the auto-outline and run the */ /* automatic hinting process */ - if ( metrics->clazz->script_hints_apply ) - metrics->clazz->script_hints_apply( hints, - &gloader->current.outline, - metrics ); + { +#ifdef FT_CONFIG_OPTION_PIC + AF_FaceGlobals globals = loader->globals; +#endif + AF_StyleClass style_class = metrics->style_class; + AF_WritingSystemClass writing_system_class = + AF_WRITING_SYSTEM_CLASSES_GET[style_class->writing_system]; + + + if ( writing_system_class->style_hints_apply ) + writing_system_class->style_hints_apply( hints, + &gloader->current.outline, + metrics ); + } /* we now need to adjust the metrics according to the change in */ /* width/positioning that occurred during the hinting process */ @@ -307,12 +318,7 @@ /* recompute subglyph pointer */ subglyph = gloader->base.subglyphs + num_base_subgs + nn; - if ( subglyph->flags & FT_SUBGLYPH_FLAG_USE_MY_METRICS ) - { - pp1 = loader->pp1; - pp2 = loader->pp2; - } - else + if ( !( subglyph->flags & FT_SUBGLYPH_FLAG_USE_MY_METRICS ) ) { loader->pp1 = pp1; loader->pp2 = pp2; @@ -518,34 +524,42 @@ error = af_loader_reset( module, face ); if ( !error ) { - AF_ScriptMetrics metrics; - FT_UInt options = 0; + AF_StyleMetrics metrics; + FT_UInt options = AF_STYLE_NONE_DFLT; #ifdef FT_OPTION_AUTOFIT2 - /* XXX: undocumented hook to activate the latin2 hinter */ + /* XXX: undocumented hook to activate the latin2 writing system */ if ( load_flags & ( 1UL << 20 ) ) - options = 2; + options = AF_STYLE_LTN2_DFLT; #endif error = af_face_globals_get_metrics( loader->globals, gindex, options, &metrics ); if ( !error ) { +#ifdef FT_CONFIG_OPTION_PIC + AF_FaceGlobals globals = loader->globals; +#endif + AF_StyleClass style_class = metrics->style_class; + AF_WritingSystemClass writing_system_class = + AF_WRITING_SYSTEM_CLASSES_GET[style_class->writing_system]; + + loader->metrics = metrics; - if ( metrics->clazz->script_metrics_scale ) - metrics->clazz->script_metrics_scale( metrics, &scaler ); + if ( writing_system_class->style_metrics_scale ) + writing_system_class->style_metrics_scale( metrics, &scaler ); else metrics->scaler = scaler; load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_TRANSFORM; load_flags &= ~FT_LOAD_RENDER; - if ( metrics->clazz->script_hints_init ) + if ( writing_system_class->style_hints_init ) { - error = metrics->clazz->script_hints_init( &loader->hints, - metrics ); + error = writing_system_class->style_hints_init( &loader->hints, + metrics ); if ( error ) goto Exit; } |