< prev index next >

src/java.desktop/share/native/libfreetype/src/pshinter/pshglob.c

Print this page


   1 /***************************************************************************/
   2 /*                                                                         */
   3 /*  pshglob.c                                                              */
   4 /*                                                                         */
   5 /*    PostScript hinter global hinting management (body).                  */
   6 /*    Inspired by the new auto-hinter module.                              */
   7 /*                                                                         */
   8 /*  Copyright 2001-2018 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 <ft2build.h>
  21 #include FT_FREETYPE_H
  22 #include FT_INTERNAL_OBJECTS_H

  23 #include "pshglob.h"
  24 
  25 #ifdef DEBUG_HINTER
  26   PSH_Globals  ps_debug_globals = NULL;
  27 #endif
  28 
  29 
  30   /*************************************************************************/
  31   /*************************************************************************/
  32   /*****                                                               *****/
  33   /*****                       STANDARD WIDTHS                         *****/
  34   /*****                                                               *****/
  35   /*************************************************************************/
  36   /*************************************************************************/
  37 
  38 
  39   /* scale the widths/heights table */
  40   static void
  41   psh_globals_scale_widths( PSH_Globals  globals,
  42                             FT_UInt      direction )


 551                        PSH_Alignment  alignment )
 552   {
 553     PSH_Blue_Table  table;
 554     FT_UInt         count;
 555     FT_Pos          delta;
 556     PSH_Blue_Zone   zone;
 557     FT_Int          no_shoots;
 558 
 559 
 560     alignment->align = PSH_BLUE_ALIGN_NONE;
 561 
 562     no_shoots = blues->no_overshoots;
 563 
 564     /* look up stem top in top zones table */
 565     table = &blues->normal_top;
 566     count = table->count;
 567     zone  = table->zones;
 568 
 569     for ( ; count > 0; count--, zone++ )
 570     {
 571       delta = stem_top - zone->org_bottom;
 572       if ( delta < -blues->blue_fuzz )
 573         break;
 574 
 575       if ( stem_top <= zone->org_top + blues->blue_fuzz )
 576       {
 577         if ( no_shoots || delta <= blues->blue_threshold )
 578         {
 579           alignment->align    |= PSH_BLUE_ALIGN_TOP;
 580           alignment->align_top = zone->cur_ref;
 581         }
 582         break;
 583       }
 584     }
 585 
 586     /* look up stem bottom in bottom zones table */
 587     table = &blues->normal_bottom;
 588     count = table->count;
 589     zone  = table->zones + count-1;
 590 
 591     for ( ; count > 0; count--, zone-- )
 592     {
 593       delta = zone->org_top - stem_bot;
 594       if ( delta < -blues->blue_fuzz )
 595         break;
 596 
 597       if ( stem_bot >= zone->org_bottom - blues->blue_fuzz )
 598       {
 599         if ( no_shoots || delta < blues->blue_threshold )
 600         {
 601           alignment->align    |= PSH_BLUE_ALIGN_BOT;
 602           alignment->align_bot = zone->cur_ref;
 603         }
 604         break;
 605       }
 606     }
 607   }
 608 
 609 
 610   /*************************************************************************/
 611   /*************************************************************************/
 612   /*****                                                               *****/
 613   /*****                        GLOBAL HINTS                           *****/


   1 /****************************************************************************
   2  *
   3  * pshglob.c
   4  *
   5  *   PostScript hinter global hinting management (body).
   6  *   Inspired by the new auto-hinter module.
   7  *
   8  * Copyright (C) 2001-2019 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 <ft2build.h>
  21 #include FT_FREETYPE_H
  22 #include FT_INTERNAL_OBJECTS_H
  23 #include FT_INTERNAL_CALC_H
  24 #include "pshglob.h"
  25 
  26 #ifdef DEBUG_HINTER
  27   PSH_Globals  ps_debug_globals = NULL;
  28 #endif
  29 
  30 
  31   /*************************************************************************/
  32   /*************************************************************************/
  33   /*****                                                               *****/
  34   /*****                       STANDARD WIDTHS                         *****/
  35   /*****                                                               *****/
  36   /*************************************************************************/
  37   /*************************************************************************/
  38 
  39 
  40   /* scale the widths/heights table */
  41   static void
  42   psh_globals_scale_widths( PSH_Globals  globals,
  43                             FT_UInt      direction )


 552                        PSH_Alignment  alignment )
 553   {
 554     PSH_Blue_Table  table;
 555     FT_UInt         count;
 556     FT_Pos          delta;
 557     PSH_Blue_Zone   zone;
 558     FT_Int          no_shoots;
 559 
 560 
 561     alignment->align = PSH_BLUE_ALIGN_NONE;
 562 
 563     no_shoots = blues->no_overshoots;
 564 
 565     /* look up stem top in top zones table */
 566     table = &blues->normal_top;
 567     count = table->count;
 568     zone  = table->zones;
 569 
 570     for ( ; count > 0; count--, zone++ )
 571     {
 572       delta = SUB_LONG( stem_top, zone->org_bottom );
 573       if ( delta < -blues->blue_fuzz )
 574         break;
 575 
 576       if ( stem_top <= zone->org_top + blues->blue_fuzz )
 577       {
 578         if ( no_shoots || delta <= blues->blue_threshold )
 579         {
 580           alignment->align    |= PSH_BLUE_ALIGN_TOP;
 581           alignment->align_top = zone->cur_ref;
 582         }
 583         break;
 584       }
 585     }
 586 
 587     /* look up stem bottom in bottom zones table */
 588     table = &blues->normal_bottom;
 589     count = table->count;
 590     zone  = table->zones + count-1;
 591 
 592     for ( ; count > 0; count--, zone-- )
 593     {
 594       delta = SUB_LONG( zone->org_top, stem_bot );
 595       if ( delta < -blues->blue_fuzz )
 596         break;
 597 
 598       if ( stem_bot >= zone->org_bottom - blues->blue_fuzz )
 599       {
 600         if ( no_shoots || delta < blues->blue_threshold )
 601         {
 602           alignment->align    |= PSH_BLUE_ALIGN_BOT;
 603           alignment->align_bot = zone->cur_ref;
 604         }
 605         break;
 606       }
 607     }
 608   }
 609 
 610 
 611   /*************************************************************************/
 612   /*************************************************************************/
 613   /*****                                                               *****/
 614   /*****                        GLOBAL HINTS                           *****/


< prev index next >