tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

afdummy.c (2160B)


      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 (C) 2003-2025 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                        AF_StyleMetrics  metrics )
     45  {
     46    FT_Error  error;
     47 
     48    FT_UNUSED( glyph_index );
     49    FT_UNUSED( metrics );
     50 
     51 
     52    error = af_glyph_hints_reload( hints, outline );
     53    if ( !error )
     54      af_glyph_hints_save( hints, outline );
     55 
     56    return error;
     57  }
     58 
     59 
     60  AF_DEFINE_WRITING_SYSTEM_CLASS(
     61    af_dummy_writing_system_class,
     62 
     63    AF_WRITING_SYSTEM_DUMMY,
     64 
     65    sizeof ( AF_StyleMetricsRec ),
     66 
     67    (AF_WritingSystem_InitMetricsFunc) NULL,                /* style_metrics_init    */
     68    (AF_WritingSystem_ScaleMetricsFunc)NULL,                /* style_metrics_scale   */
     69    (AF_WritingSystem_DoneMetricsFunc) NULL,                /* style_metrics_done    */
     70    (AF_WritingSystem_GetStdWidthsFunc)NULL,                /* style_metrics_getstdw */
     71 
     72    (AF_WritingSystem_InitHintsFunc)   af_dummy_hints_init, /* style_hints_init      */
     73    (AF_WritingSystem_ApplyHintsFunc)  af_dummy_hints_apply /* style_hints_apply     */
     74  )
     75 
     76 
     77 /* END */