Home | History | Annotate | Download | only in autofit
      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-2015 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( AF_GlyphHints  hints,
     42                         FT_Outline*    outline )
     43   {
     44     FT_Error  error;
     45 
     46 
     47     error = af_glyph_hints_reload( hints, outline );
     48     if ( !error )
     49       af_glyph_hints_save( hints, outline );
     50 
     51     return error;
     52   }
     53 
     54 
     55   AF_DEFINE_WRITING_SYSTEM_CLASS(
     56     af_dummy_writing_system_class,
     57 
     58     AF_WRITING_SYSTEM_DUMMY,
     59 
     60     sizeof ( AF_StyleMetricsRec ),
     61 
     62     (AF_WritingSystem_InitMetricsFunc) NULL,
     63     (AF_WritingSystem_ScaleMetricsFunc)NULL,
     64     (AF_WritingSystem_DoneMetricsFunc) NULL,
     65 
     66     (AF_WritingSystem_InitHintsFunc)   af_dummy_hints_init,
     67     (AF_WritingSystem_ApplyHintsFunc)  af_dummy_hints_apply
     68   )
     69 
     70 
     71 /* END */
     72