1 /***************************************************************************/ 2 /* */ 3 /* afdummy.c */ 4 /* */ 5 /* Auto-fitter dummy routines to be used if no hinting should be */ 6 /* performed (body). */ 7 /* */ 8 /* Copyright 2003-2017 by */ 9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 10 /* */ 11 /* This file is part of the FreeType project, and may only be used, */ 12 /* modified, and distributed under the terms of the FreeType project */ 13 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 14 /* this file you indicate that you have read the license and */ 15 /* understand and accept it fully. */ 16 /* */ 17 /***************************************************************************/ 18 19 20 #include "afdummy.h" 21 #include "afhints.h" 22 #include "aferrors.h" 23 24 25 static FT_Error 26 af_dummy_hints_init( AF_GlyphHints hints, 27 AF_StyleMetrics metrics ) 28 { 29 af_glyph_hints_rescale( hints, metrics ); 30 31 hints->x_scale = metrics->scaler.x_scale; 32 hints->y_scale = metrics->scaler.y_scale; 33 hints->x_delta = metrics->scaler.x_delta; 34 hints->y_delta = metrics->scaler.y_delta; 35 36 return FT_Err_Ok; 37 } 38 39 40 static FT_Error 41 af_dummy_hints_apply( FT_UInt glyph_index, 42 AF_GlyphHints hints, 43 FT_Outline* outline ) 44 { 45 FT_Error error; 46 47 FT_UNUSED( glyph_index ); 48 49 50 error = af_glyph_hints_reload( hints, outline ); 51 if ( !error ) 52 af_glyph_hints_save( hints, outline ); 53 54 return error; 55 } 56 57 58 AF_DEFINE_WRITING_SYSTEM_CLASS( 59 af_dummy_writing_system_class, 60 61 AF_WRITING_SYSTEM_DUMMY, 62 63 sizeof ( AF_StyleMetricsRec ), 64 65 (AF_WritingSystem_InitMetricsFunc) NULL, /* style_metrics_init */ 66 (AF_WritingSystem_ScaleMetricsFunc)NULL, /* style_metrics_scale */ 67 (AF_WritingSystem_DoneMetricsFunc) NULL, /* style_metrics_done */ 68 (AF_WritingSystem_GetStdWidthsFunc)NULL, /* style_metrics_getstdw */ 69 70 (AF_WritingSystem_InitHintsFunc) af_dummy_hints_init, /* style_hints_init */ 71 (AF_WritingSystem_ApplyHintsFunc) af_dummy_hints_apply /* style_hints_apply */ 72 ) 73 74 75 /* END */ 76