OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* pshglob.c */ | 3 /* pshglob.c */ |
4 /* */ | 4 /* */ |
5 /* PostScript hinter global hinting management (body). */ | 5 /* PostScript hinter global hinting management (body). */ |
6 /* Inspired by the new auto-hinter module. */ | 6 /* Inspired by the new auto-hinter module. */ |
7 /* */ | 7 /* */ |
8 /* Copyright 2001-2004, 2006, 2010, 2012-2014 by */ | 8 /* Copyright 2001-2015 by */ |
9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
10 /* */ | 10 /* */ |
11 /* This file is part of the FreeType project, and may only be used */ | 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 */ | 12 /* modified and distributed under the terms of the FreeType project */ |
13 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 13 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
14 /* this file you indicate that you have read the license and */ | 14 /* this file you indicate that you have read the license and */ |
15 /* understand and accept it fully. */ | 15 /* understand and accept it fully. */ |
16 /* */ | 16 /* */ |
17 /***************************************************************************/ | 17 /***************************************************************************/ |
18 | 18 |
19 | 19 |
20 #include <ft2build.h> | 20 #include <ft2build.h> |
21 #include FT_FREETYPE_H | 21 #include FT_FREETYPE_H |
22 #include FT_INTERNAL_OBJECTS_H | 22 #include FT_INTERNAL_OBJECTS_H |
23 #include "pshglob.h" | 23 #include "pshglob.h" |
24 | 24 |
25 #ifdef DEBUG_HINTER | 25 #ifdef DEBUG_HINTER |
26 PSH_Globals ps_debug_globals = 0; | 26 PSH_Globals ps_debug_globals = NULL; |
27 #endif | 27 #endif |
28 | 28 |
29 | 29 |
30 /*************************************************************************/ | 30 /*************************************************************************/ |
31 /*************************************************************************/ | 31 /*************************************************************************/ |
32 /***** *****/ | 32 /***** *****/ |
33 /***** STANDARD WIDTHS *****/ | 33 /***** STANDARD WIDTHS *****/ |
34 /***** *****/ | 34 /***** *****/ |
35 /*************************************************************************/ | 35 /*************************************************************************/ |
36 /*************************************************************************/ | 36 /*************************************************************************/ |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 static void | 233 static void |
234 psh_blues_set_zones( PSH_Blues target, | 234 psh_blues_set_zones( PSH_Blues target, |
235 FT_UInt count, | 235 FT_UInt count, |
236 FT_Short* blues, | 236 FT_Short* blues, |
237 FT_UInt count_others, | 237 FT_UInt count_others, |
238 FT_Short* other_blues, | 238 FT_Short* other_blues, |
239 FT_Int fuzz, | 239 FT_Int fuzz, |
240 FT_Int family ) | 240 FT_Int family ) |
241 { | 241 { |
242 PSH_Blue_Table top_table, bot_table; | 242 PSH_Blue_Table top_table, bot_table; |
243 FT_Int count_top, count_bot; | 243 FT_UInt count_top, count_bot; |
244 | 244 |
245 | 245 |
246 if ( family ) | 246 if ( family ) |
247 { | 247 { |
248 top_table = &target->family_top; | 248 top_table = &target->family_top; |
249 bot_table = &target->family_bottom; | 249 bot_table = &target->family_bottom; |
250 } | 250 } |
251 else | 251 else |
252 { | 252 { |
253 top_table = &target->normal_top; | 253 top_table = &target->normal_top; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 332 |
333 /* expand the top and bottom of intermediate zones; */ | 333 /* expand the top and bottom of intermediate zones; */ |
334 /* checking that the interval is smaller than the fuzz */ | 334 /* checking that the interval is smaller than the fuzz */ |
335 top = zone->org_top; | 335 top = zone->org_top; |
336 | 336 |
337 for ( count--; count > 0; count-- ) | 337 for ( count--; count > 0; count-- ) |
338 { | 338 { |
339 bot = zone[1].org_bottom; | 339 bot = zone[1].org_bottom; |
340 delta = bot - top; | 340 delta = bot - top; |
341 | 341 |
342 if ( delta < 2 * fuzz ) | 342 if ( delta / 2 < fuzz ) |
343 zone[0].org_top = zone[1].org_bottom = top + delta / 2; | 343 zone[0].org_top = zone[1].org_bottom = top + delta / 2; |
344 else | 344 else |
345 { | 345 { |
346 zone[0].org_top = top + fuzz; | 346 zone[0].org_top = top + fuzz; |
347 zone[1].org_bottom = bot - fuzz; | 347 zone[1].org_bottom = bot - fuzz; |
348 } | 348 } |
349 | 349 |
350 zone++; | 350 zone++; |
351 top = zone->org_top; | 351 top = zone->org_top; |
352 } | 352 } |
353 | 353 |
354 /* expand the top of the highest zone normally */ | 354 /* expand the top of the highest zone normally */ |
355 zone->org_top = top + fuzz; | 355 zone->org_top = top + fuzz; |
356 } | 356 } |
357 zone = bot_table->zones; | 357 zone = bot_table->zones; |
358 count = count_bot; | 358 count = count_bot; |
359 } | 359 } |
360 } | 360 } |
361 } | 361 } |
362 | 362 |
363 | 363 |
364 /* reset the blues table when the device transform changes */ | 364 /* reset the blues table when the device transform changes */ |
365 static void | 365 static void |
366 psh_blues_scale_zones( PSH_Blues blues, | 366 psh_blues_scale_zones( PSH_Blues blues, |
367 FT_Fixed scale, | 367 FT_Fixed scale, |
368 FT_Pos delta ) | 368 FT_Pos delta ) |
369 { | 369 { |
370 FT_UInt count; | 370 FT_UInt count; |
371 FT_UInt num; | 371 FT_UInt num; |
372 PSH_Blue_Table table = 0; | 372 PSH_Blue_Table table = NULL; |
373 | 373 |
374 /* */ | 374 /* */ |
375 /* Determine whether we need to suppress overshoots or */ | 375 /* Determine whether we need to suppress overshoots or */ |
376 /* not. We simply need to compare the vertical scale */ | 376 /* not. We simply need to compare the vertical scale */ |
377 /* parameter to the raw bluescale value. Here is why: */ | 377 /* parameter to the raw bluescale value. Here is why: */ |
378 /* */ | 378 /* */ |
379 /* We need to suppress overshoots for all pointsizes. */ | 379 /* We need to suppress overshoots for all pointsizes. */ |
380 /* At 300dpi that satisfies: */ | 380 /* At 300dpi that satisfies: */ |
381 /* */ | 381 /* */ |
382 /* pointsize < 240*bluescale + 0.49 */ | 382 /* pointsize < 240*bluescale + 0.49 */ |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 globals->dimension[1].stdw.count = 0; | 628 globals->dimension[1].stdw.count = 0; |
629 | 629 |
630 globals->blues.normal_top.count = 0; | 630 globals->blues.normal_top.count = 0; |
631 globals->blues.normal_bottom.count = 0; | 631 globals->blues.normal_bottom.count = 0; |
632 globals->blues.family_top.count = 0; | 632 globals->blues.family_top.count = 0; |
633 globals->blues.family_bottom.count = 0; | 633 globals->blues.family_bottom.count = 0; |
634 | 634 |
635 FT_FREE( globals ); | 635 FT_FREE( globals ); |
636 | 636 |
637 #ifdef DEBUG_HINTER | 637 #ifdef DEBUG_HINTER |
638 ps_debug_globals = 0; | 638 ps_debug_globals = NULL; |
639 #endif | 639 #endif |
640 } | 640 } |
641 } | 641 } |
642 | 642 |
643 | 643 |
644 static FT_Error | 644 static FT_Error |
645 psh_globals_new( FT_Memory memory, | 645 psh_globals_new( FT_Memory memory, |
646 T1_Private* priv, | 646 T1_Private* priv, |
647 PSH_Globals *aglobals ) | 647 PSH_Globals *aglobals ) |
648 { | 648 { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 FT_LOCAL_DEF( void ) | 786 FT_LOCAL_DEF( void ) |
787 psh_globals_funcs_init( PSH_Globals_FuncsRec* funcs ) | 787 psh_globals_funcs_init( PSH_Globals_FuncsRec* funcs ) |
788 { | 788 { |
789 funcs->create = psh_globals_new; | 789 funcs->create = psh_globals_new; |
790 funcs->set_scale = psh_globals_set_scale; | 790 funcs->set_scale = psh_globals_set_scale; |
791 funcs->destroy = psh_globals_destroy; | 791 funcs->destroy = psh_globals_destroy; |
792 } | 792 } |
793 | 793 |
794 | 794 |
795 /* END */ | 795 /* END */ |
OLD | NEW |