/**************************************************************************** * * pshglob.c * * PostScript hinter global hinting management (body). * Inspired by the new auto-hinter module. * * Copyright (C) 2001-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used * modified and distributed under the terms of the FreeType project * license, LICENSE.TXT. By continuing to use, modify, or distribute * this file you indicate that you have read the license and * understand and accept it fully. * */ #include <freetype/freetype.h> #include <freetype/internal/ftobjs.h> #include <freetype/internal/ftcalc.h> #include "pshglob.h" #ifdef DEBUG_HINTER PSH_Globals ps_debug_globals = NULL; #endif /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** STANDARD WIDTHS *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ /* scale the widths/heights table */ static void psh_globals_scale_widths( PSH_Globals globals, FT_UInt direction ) { … } #if 0 /* org_width is in font units, result in device pixels, 26.6 format */ FT_LOCAL_DEF( FT_Pos ) psh_dimension_snap_width( PSH_Dimension dimension, FT_Int org_width ) { FT_UInt n; FT_Pos width = FT_MulFix( org_width, dimension->scale_mult ); FT_Pos best = 64 + 32 + 2; FT_Pos reference = width; for ( n = 0; n < dimension->stdw.count; n++ ) { FT_Pos w; FT_Pos dist; w = dimension->stdw.widths[n].cur; dist = width - w; if ( dist < 0 ) dist = -dist; if ( dist < best ) { best = dist; reference = w; } } if ( width >= reference ) { width -= 0x21; if ( width < reference ) width = reference; } else { width += 0x21; if ( width > reference ) width = reference; } return width; } #endif /* 0 */ /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** BLUE ZONES *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ static void psh_blues_set_zones_0( PSH_Blues target, FT_Bool is_others, FT_UInt read_count, FT_Short* read, PSH_Blue_Table top_table, PSH_Blue_Table bot_table ) { … } /* Re-read blue zones from the original fonts and store them into our */ /* private structure. This function re-orders, sanitizes, and */ /* fuzz-expands the zones as well. */ static void psh_blues_set_zones( PSH_Blues target, FT_UInt count, FT_Short* blues, FT_UInt count_others, FT_Short* other_blues, FT_Int fuzz, FT_Int family ) { … } /* reset the blues table when the device transform changes */ static void psh_blues_scale_zones( PSH_Blues blues, FT_Fixed scale, FT_Pos delta ) { … } /* calculate the maximum height of given blue zones */ static FT_Short psh_calc_max_height( FT_UInt num, const FT_Short* values, FT_Short cur_max ) { … } FT_LOCAL_DEF( void ) psh_blues_snap_stem( PSH_Blues blues, FT_Int stem_top, FT_Int stem_bot, PSH_Alignment alignment ) { … } /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** GLOBAL HINTS *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ static void psh_globals_destroy( PSH_Globals globals ) { … } static FT_Error psh_globals_new( FT_Memory memory, T1_Private* priv, PSH_Globals *aglobals ) { … } FT_LOCAL_DEF( void ) psh_globals_set_scale( PSH_Globals globals, FT_Fixed x_scale, FT_Fixed y_scale, FT_Fixed x_delta, FT_Fixed y_delta ) { … } FT_LOCAL_DEF( void ) psh_globals_funcs_init( PSH_Globals_FuncsRec* funcs ) { … } /* END */