freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Git][freetype/freetype][gsoc-craig-2023-final] Attempted for for tilde


From: Craig White (@gerzytet)
Subject: [Git][freetype/freetype][gsoc-craig-2023-final] Attempted for for tilde flattening
Date: Fri, 08 Mar 2024 00:50:59 +0000

Craig White pushed to branch gsoc-craig-2023-final at FreeType / FreeType

Commits:

  • 984ff891
    by Craig White at 2024-03-07T19:44:42-05:00
    Attempted for for tilde flattening
    

2 changed files:

Changes:

  • include/freetype/config/ftoption.h
    ... ... @@ -430,9 +430,8 @@ FT_BEGIN_HEADER
    430 430
        *   Do not `#undef` these macros here since the build system might define
    
    431 431
        *   them for certain configurations only.
    
    432 432
        */
    
    433
    -/* #define FT_DEBUG_LEVEL_ERROR */
    
    434
    -/* #define FT_DEBUG_LEVEL_TRACE */
    
    435
    -
    
    433
    +#define FT_DEBUG_LEVEL_ERROR
    
    434
    +#define FT_DEBUG_LEVEL_TRACE
    
    436 435
     
    
    437 436
       /**************************************************************************
    
    438 437
        *
    

  • src/autofit/aflatin.c
    ... ... @@ -2976,8 +2976,18 @@ af_latin_stretch_tildes( AF_GlyphHints hints,
    2976 2976
       }
    
    2977 2977
       while ( p != first_point );
    
    2978 2978
     
    
    2979
    -  FT_Pos height = max_y - min_y;
    
    2979
    +  //touch all points
    
    2980
    +  p = first_point;
    
    2981
    +  do
    
    2982
    +  {
    
    2983
    +    p = p->next;
    
    2984
    +    if ( !(p->flags & AF_FLAG_CONTROL) )
    
    2985
    +      p->flags |= AF_FLAG_TOUCH_Y;
    
    2986
    +  }
    
    2987
    +  while ( p != first_point );
    
    2988
    +
    
    2980 2989
     
    
    2990
    +  FT_Pos height = max_y - min_y;
    
    2981 2991
       FT_Pos target_height = min_measurement + 64;
    
    2982 2992
       if ( height >= target_height )
    
    2983 2993
       {
    
    ... ... @@ -2991,8 +3001,6 @@ af_latin_stretch_tildes( AF_GlyphHints hints,
    2991 3001
         p->y = ((p->y - min_y) * target_height / height) + min_y;
    
    2992 3002
         p->fy = ((p->fy - min_fy) * target_height / height) + min_fy;
    
    2993 3003
         p->oy = p->y;
    
    2994
    -    if ( !(p->flags & AF_FLAG_CONTROL) )
    
    2995
    -      p->flags |= AF_FLAG_TOUCH_Y;
    
    2996 3004
       }
    
    2997 3005
       while ( p != first_point );
    
    2998 3006
     
    
    ... ... @@ -3160,6 +3168,8 @@ af_glyph_hints_apply_vertical_separation_adjustments( AF_GlyphHints hints,
    3160 3168
           }
    
    3161 3169
         }
    
    3162 3170
     
    
    3171
    +    FT_TRACE4(( "    Calculated adjustment amount %d\n", adjustment_amount ));
    
    3172
    +
    
    3163 3173
         if ( adjustment_amount > 64 )
    
    3164 3174
         {
    
    3165 3175
           FT_TRACE4(( "    Calculated adjustment amount %d was more than threshold of 64.  Not adjusting\n", adjustment_amount ));
    
    ... ... @@ -4066,6 +4076,33 @@ af_glyph_hints_apply_vertical_separation_adjustments( AF_GlyphHints hints,
    4066 4076
     #endif
    
    4067 4077
       }
    
    4068 4078
     
    
    4079
    +  /*Print the height of the topmost contour for debugging purposes.
    
    4080
    +  TODO: remove this once the tilde unflattening works.*/
    
    4081
    +  static void traceheight(FT_UInt num, AF_GlyphHints hints) {
    
    4082
    +    AF_Point p = hints->contours[af_find_highest_contour(hints)];
    
    4083
    +    AF_Point first_point = p;
    
    4084
    +
    
    4085
    +    FT_Pos min_y, max_y;
    
    4086
    +    min_y = max_y = p->y;
    
    4087
    +
    
    4088
    +    do {
    
    4089
    +      p = p->next;
    
    4090
    +      if ( !(p->flags & AF_FLAG_CONTROL) ) {
    
    4091
    +        if ( p->y < min_y ) {
    
    4092
    +          min_y = p->y;
    
    4093
    +        }
    
    4094
    +        if ( p->y > max_y ) {
    
    4095
    +          max_y = p->y;
    
    4096
    +        }
    
    4097
    +      }
    
    4098
    +    } while ( p != first_point );
    
    4099
    +
    
    4100
    +    FT_Pos height = max_y - min_y;
    
    4101
    +    FT_TRACE4(( "height %d: %d\n", num, height ));
    
    4102
    +  }
    
    4103
    +
    
    4104
    +
    
    4105
    +
    
    4069 4106
     
    
    4070 4107
       /* Apply the complete hinting algorithm to a latin glyph. */
    
    4071 4108
     
    
    ... ... @@ -4103,7 +4140,9 @@ af_glyph_hints_apply_vertical_separation_adjustments( AF_GlyphHints hints,
    4103 4140
         {
    
    4104 4141
           FT_Bool is_tilde = af_lookup_tilde_correction_type( metrics->root.reverse_charmap, glyph_index );
    
    4105 4142
           if ( is_tilde ) {
    
    4143
    +        traceheight(0, hints);
    
    4106 4144
             af_latin_stretch_tildes( hints, glyph_index );
    
    4145
    +        traceheight(1, hints);
    
    4107 4146
           }
    
    4108 4147
           axis  = &metrics->axis[AF_DIMENSION_VERT];
    
    4109 4148
           error = af_latin_hints_detect_features( hints,
    
    ... ... @@ -4128,10 +4167,15 @@ af_glyph_hints_apply_vertical_separation_adjustments( AF_GlyphHints hints,
    4128 4167
                ( dim == AF_DIMENSION_VERT && AF_HINTS_DO_VERTICAL( hints ) )   )
    
    4129 4168
           {
    
    4130 4169
             af_latin_hint_edges( hints, (AF_Dimension)dim );
    
    4170
    +        traceheight(2, hints);
    
    4131 4171
             af_glyph_hints_align_edge_points( hints, (AF_Dimension)dim );
    
    4172
    +        traceheight(3, hints);
    
    4132 4173
             af_glyph_hints_align_strong_points( hints, (AF_Dimension)dim );
    
    4174
    +        traceheight(4, hints);
    
    4133 4175
             af_glyph_hints_align_weak_points( hints, (AF_Dimension)dim );
    
    4176
    +        traceheight(5, hints);
    
    4134 4177
             af_glyph_hints_apply_vertical_separation_adjustments(hints, (AF_Dimension) dim, glyph_index, metrics->root.reverse_charmap);
    
    4178
    +        traceheight(6, hints);
    
    4135 4179
           }
    
    4136 4180
         }
    
    4137 4181
     
    


  • reply via email to

    [Prev in Thread] Current Thread [Next in Thread]