diff --git a/src/autofit/afadjust.c b/src/autofit/afadjust.c index d1fea63cc..e7970f7d0 100644 --- a/src/autofit/afadjust.c +++ b/src/autofit/afadjust.c @@ -187,8 +187,17 @@ af_lookup_vertical_seperation_type( AF_ReverseCharacterMap map, FT_Int glyph_ind FT_LOCAL_DEF( FT_Int ) af_lookup_tilde_correction_type( AF_ReverseCharacterMap map, FT_Int glyph_index ) { FT_UInt32 codepoint = af_reverse_character_map_lookup( map, glyph_index ); - if ( codepoint == 0xF1 ) { - return 1; + /* bits are: apply stretch, apply segment removal */ + if ( codepoint == 0xF1 ) { /*n tilde*/ + return 0b01; + } + else if ( codepoint == 0xE3 ) /*a tilde*/ + { + return 0b11; + } + else if ( codepoint == 0xF5 ) /*o tilde*/ + { + return 0b10; } return 0; } @@ -336,7 +345,8 @@ af_reverse_character_map_new( AF_ReverseCharacterMap *map, AF_FaceGlobals global af_reverse_character_map_entry_compare ); -#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ +#if 0 +/*#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ*/ hb_font_t *hb_font = globals->hb_font; hb_face_t *hb_face = hb_font_get_face( hb_font ); hb_set_t *feature_indicies = hb_set_create(); @@ -350,8 +360,6 @@ af_reverse_character_map_new( AF_ReverseCharacterMap *map, AF_FaceGlobals global feature_indicies ); hb_codepoint_t feature_index = HB_SET_VALUE_INVALID; - - FT_UInt added_entries = 0; while ( hb_set_next(feature_indicies, &feature_index) ) { hb_codepoint_t output_glyph_index; @@ -366,6 +374,20 @@ af_reverse_character_map_new( AF_ReverseCharacterMap *map, AF_FaceGlobals global glyphs_output); /*Don't consider anything involving context. Just do the simple cases*/ + FT_TRACE4(("num inputs: %d\n", hb_set_get_population( glyphs_input ))); + FT_TRACE4(("num outputs: %d\n", hb_set_get_population( glyphs_output ))); + FT_TRACE4(("num before: %d\n", hb_set_get_population( glyphs_before ))); + FT_TRACE4(("num after: %d\n", hb_set_get_population( glyphs_after ))); + hb_codepoint_t input = HB_SET_VALUE_INVALID; + while ( hb_set_next( glyphs_input, &input ) ) + { + FT_TRACE4(("input: %d\n", input)); + } + hb_codepoint_t output = HB_SET_VALUE_INVALID; + while ( hb_set_next( glyphs_output, &output ) ) + { + FT_TRACE4(("output: %d\n", output)); + } if ( hb_set_get_population( glyphs_before ) > 0 || hb_set_get_population( glyphs_after ) > 0 ) { @@ -378,18 +400,22 @@ af_reverse_character_map_new( AF_ReverseCharacterMap *map, AF_FaceGlobals global hb_codepoint_t input_glyph_index = HB_SET_VALUE_INVALID; const AF_AdjustmentDatabaseEntry* input_entry = NULL; - FT_UInt32 input_codepoint; + FT_UInt32 input_codepoint = 0; while ( hb_set_next( glyphs_input, &input_glyph_index ) ) { - input_codepoint = af_reverse_character_map_lookup_( *map, input_glyph_index, oldlength ); - if ( input_codepoint == 0 ) + FT_TRACE4(("input glyph: %d\n", input_glyph_index)); + FT_UInt32 inner_codepoint = af_reverse_character_map_lookup_( *map, input_glyph_index, oldlength ); + if ( inner_codepoint == 0 ) { continue; } - const AF_AdjustmentDatabaseEntry* entry = af_adjustment_database_lookup( input_codepoint ); + const AF_AdjustmentDatabaseEntry* entry = af_adjustment_database_lookup( inner_codepoint ); if ( entry == NULL ) { continue; } + if ( input_codepoint == 0 ) { + input_codepoint = inner_codepoint; + } if ( input_entry == NULL ) { @@ -404,6 +430,10 @@ af_reverse_character_map_new( AF_ReverseCharacterMap *map, AF_FaceGlobals global } } + if ( input_codepoint == 0 ) + { + continue; + } output_glyph_index = HB_SET_VALUE_INVALID; hb_set_next( glyphs_output, &output_glyph_index ); diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c index a88ec6cc0..dfad4a191 100644 --- a/src/autofit/aflatin.c +++ b/src/autofit/aflatin.c @@ -2809,13 +2809,18 @@ af_remove_segments_containing_point(AF_GlyphHints hints, AF_Point point) { AF_Segment seg = &segments[i]; FT_Bool remove = 0; - for ( AF_Point p = seg->first; p <= seg->last; p = p->next ) + AF_Point p = seg->first; + while ( 1 ) { if ( p == point ) { remove = 1; break; } + if (p == seg->last) { + break; + } + p = p->next; } if ( remove ) @@ -2856,7 +2861,7 @@ af_latin_stretch_tildes_step_2( AF_GlyphHints hints, FT_Int glyph_index, AF_ReverseCharacterMap reverse_charmap ) { - if (af_lookup_tilde_correction_type(reverse_charmap, glyph_index)) { + if (af_lookup_tilde_correction_type(reverse_charmap, glyph_index) & 1) { FT_Int highest_contour = af_find_highest_contour(hints); AF_Point first_point = hints->contours[highest_contour]; @@ -2872,18 +2877,17 @@ af_latin_stretch_tildes_step_2( AF_GlyphHints hints, && p->prev->flags & AF_FLAG_CONTROL && p->next->flags & AF_FLAG_CONTROL*/ 1 ) { + FT_TRACE4(("%p", p)); af_remove_segments_containing_point( hints, p ); } } while ( p != first_point ); } - } - void af_latin_stretch_tildes( AF_GlyphHints hints, FT_Int glyph_index, AF_ReverseCharacterMap reverse_charmap ) { - if ( af_lookup_tilde_correction_type( reverse_charmap, glyph_index ) ) { + if ( af_lookup_tilde_correction_type( reverse_charmap, glyph_index ) & 2 ) { FT_Int highest_contour = af_find_highest_contour( hints ); AF_Point p = hints->contours[highest_contour]; AF_Point first_point = p; @@ -4116,7 +4120,7 @@ static void traceheight(FT_UInt num, AF_GlyphHints hints) { if ( AF_HINTS_DO_VERTICAL( hints ) ) { - /*af_latin_stretch_tildes( hints, glyph_index, metrics->root.reverse_charmap );*/ + af_latin_stretch_tildes( hints, glyph_index, metrics->root.reverse_charmap ); axis = &metrics->axis[AF_DIMENSION_VERT]; error = af_latin_hints_detect_features( hints, axis->width_count,