Craig White pushed to branch gsoc-craig-2023 at FreeType / FreeType
Commits:
-
ed574779
by Craig White at 2023-09-16T19:05:10-04:00
2 changed files:
Changes:
... | ... | @@ -187,8 +187,17 @@ af_lookup_vertical_seperation_type( AF_ReverseCharacterMap map, FT_Int glyph_ind |
187 | 187 | FT_LOCAL_DEF( FT_Int )
|
188 | 188 | af_lookup_tilde_correction_type( AF_ReverseCharacterMap map, FT_Int glyph_index ) {
|
189 | 189 | FT_UInt32 codepoint = af_reverse_character_map_lookup( map, glyph_index );
|
190 | - if ( codepoint == 0xF1 ) {
|
|
191 | - return 1;
|
|
190 | + /* bits are: apply stretch, apply segment removal */
|
|
191 | + if ( codepoint == 0xF1 ) { /*n tilde*/
|
|
192 | + return 0b01;
|
|
193 | + }
|
|
194 | + else if ( codepoint == 0xE3 ) /*a tilde*/
|
|
195 | + {
|
|
196 | + return 0b11;
|
|
197 | + }
|
|
198 | + else if ( codepoint == 0xF5 ) /*o tilde*/
|
|
199 | + {
|
|
200 | + return 0b10;
|
|
192 | 201 | }
|
193 | 202 | return 0;
|
194 | 203 | }
|
... | ... | @@ -336,7 +345,8 @@ af_reverse_character_map_new( AF_ReverseCharacterMap *map, AF_FaceGlobals global |
336 | 345 | af_reverse_character_map_entry_compare
|
337 | 346 | );
|
338 | 347 | |
339 | -#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
|
|
348 | +#if 0
|
|
349 | +/*#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ*/
|
|
340 | 350 | hb_font_t *hb_font = globals->hb_font;
|
341 | 351 | hb_face_t *hb_face = hb_font_get_face( hb_font );
|
342 | 352 | hb_set_t *feature_indicies = hb_set_create();
|
... | ... | @@ -350,8 +360,6 @@ af_reverse_character_map_new( AF_ReverseCharacterMap *map, AF_FaceGlobals global |
350 | 360 | feature_indicies
|
351 | 361 | );
|
352 | 362 | hb_codepoint_t feature_index = HB_SET_VALUE_INVALID;
|
353 | - |
|
354 | - FT_UInt added_entries = 0;
|
|
355 | 363 | while ( hb_set_next(feature_indicies, &feature_index) )
|
356 | 364 | {
|
357 | 365 | hb_codepoint_t output_glyph_index;
|
... | ... | @@ -366,6 +374,20 @@ af_reverse_character_map_new( AF_ReverseCharacterMap *map, AF_FaceGlobals global |
366 | 374 | glyphs_output);
|
367 | 375 | /*Don't consider anything involving context. Just do the
|
368 | 376 | simple cases*/
|
377 | + FT_TRACE4(("num inputs: %d\n", hb_set_get_population( glyphs_input )));
|
|
378 | + FT_TRACE4(("num outputs: %d\n", hb_set_get_population( glyphs_output )));
|
|
379 | + FT_TRACE4(("num before: %d\n", hb_set_get_population( glyphs_before )));
|
|
380 | + FT_TRACE4(("num after: %d\n", hb_set_get_population( glyphs_after )));
|
|
381 | + hb_codepoint_t input = HB_SET_VALUE_INVALID;
|
|
382 | + while ( hb_set_next( glyphs_input, &input ) )
|
|
383 | + {
|
|
384 | + FT_TRACE4(("input: %d\n", input));
|
|
385 | + }
|
|
386 | + hb_codepoint_t output = HB_SET_VALUE_INVALID;
|
|
387 | + while ( hb_set_next( glyphs_output, &output ) )
|
|
388 | + {
|
|
389 | + FT_TRACE4(("output: %d\n", output));
|
|
390 | + }
|
|
369 | 391 | if ( hb_set_get_population( glyphs_before ) > 0 ||
|
370 | 392 | hb_set_get_population( glyphs_after ) > 0 )
|
371 | 393 | {
|
... | ... | @@ -378,18 +400,22 @@ af_reverse_character_map_new( AF_ReverseCharacterMap *map, AF_FaceGlobals global |
378 | 400 | |
379 | 401 | hb_codepoint_t input_glyph_index = HB_SET_VALUE_INVALID;
|
380 | 402 | const AF_AdjustmentDatabaseEntry* input_entry = NULL;
|
381 | - FT_UInt32 input_codepoint;
|
|
403 | + FT_UInt32 input_codepoint = 0;
|
|
382 | 404 | while ( hb_set_next( glyphs_input, &input_glyph_index ) ) {
|
383 | - input_codepoint = af_reverse_character_map_lookup_( *map, input_glyph_index, oldlength );
|
|
384 | - if ( input_codepoint == 0 )
|
|
405 | + FT_TRACE4(("input glyph: %d\n", input_glyph_index));
|
|
406 | + FT_UInt32 inner_codepoint = af_reverse_character_map_lookup_( *map, input_glyph_index, oldlength );
|
|
407 | + if ( inner_codepoint == 0 )
|
|
385 | 408 | {
|
386 | 409 | continue;
|
387 | 410 | }
|
388 | - const AF_AdjustmentDatabaseEntry* entry = af_adjustment_database_lookup( input_codepoint );
|
|
411 | + const AF_AdjustmentDatabaseEntry* entry = af_adjustment_database_lookup( inner_codepoint );
|
|
389 | 412 | if ( entry == NULL )
|
390 | 413 | {
|
391 | 414 | continue;
|
392 | 415 | }
|
416 | + if ( input_codepoint == 0 ) {
|
|
417 | + input_codepoint = inner_codepoint;
|
|
418 | + }
|
|
393 | 419 | |
394 | 420 | if ( input_entry == NULL )
|
395 | 421 | {
|
... | ... | @@ -404,6 +430,10 @@ af_reverse_character_map_new( AF_ReverseCharacterMap *map, AF_FaceGlobals global |
404 | 430 | }
|
405 | 431 | }
|
406 | 432 | |
433 | + if ( input_codepoint == 0 )
|
|
434 | + {
|
|
435 | + continue;
|
|
436 | + }
|
|
407 | 437 | |
408 | 438 | output_glyph_index = HB_SET_VALUE_INVALID;
|
409 | 439 | hb_set_next( glyphs_output, &output_glyph_index );
|
... | ... | @@ -2809,13 +2809,18 @@ af_remove_segments_containing_point(AF_GlyphHints hints, AF_Point point) |
2809 | 2809 | {
|
2810 | 2810 | AF_Segment seg = &segments[i];
|
2811 | 2811 | FT_Bool remove = 0;
|
2812 | - for ( AF_Point p = seg->first; p <= seg->last; p = p->next )
|
|
2812 | + AF_Point p = seg->first;
|
|
2813 | + while ( 1 )
|
|
2813 | 2814 | {
|
2814 | 2815 | if ( p == point )
|
2815 | 2816 | {
|
2816 | 2817 | remove = 1;
|
2817 | 2818 | break;
|
2818 | 2819 | }
|
2820 | + if (p == seg->last) {
|
|
2821 | + break;
|
|
2822 | + }
|
|
2823 | + p = p->next;
|
|
2819 | 2824 | }
|
2820 | 2825 | |
2821 | 2826 | if ( remove )
|
... | ... | @@ -2856,7 +2861,7 @@ af_latin_stretch_tildes_step_2( AF_GlyphHints hints, |
2856 | 2861 | FT_Int glyph_index,
|
2857 | 2862 | AF_ReverseCharacterMap reverse_charmap )
|
2858 | 2863 | {
|
2859 | - if (af_lookup_tilde_correction_type(reverse_charmap, glyph_index)) {
|
|
2864 | + if (af_lookup_tilde_correction_type(reverse_charmap, glyph_index) & 1) {
|
|
2860 | 2865 | FT_Int highest_contour = af_find_highest_contour(hints);
|
2861 | 2866 | AF_Point first_point = hints->contours[highest_contour];
|
2862 | 2867 | |
... | ... | @@ -2872,18 +2877,17 @@ af_latin_stretch_tildes_step_2( AF_GlyphHints hints, |
2872 | 2877 | && p->prev->flags & AF_FLAG_CONTROL
|
2873 | 2878 | && p->next->flags & AF_FLAG_CONTROL*/ 1 )
|
2874 | 2879 | {
|
2880 | + FT_TRACE4(("%p", p));
|
|
2875 | 2881 | af_remove_segments_containing_point( hints, p );
|
2876 | 2882 | }
|
2877 | 2883 | } while ( p != first_point );
|
2878 | 2884 | }
|
2879 | - |
|
2880 | 2885 | }
|
2881 | - |
|
2882 | 2886 | void
|
2883 | 2887 | af_latin_stretch_tildes( AF_GlyphHints hints,
|
2884 | 2888 | FT_Int glyph_index,
|
2885 | 2889 | AF_ReverseCharacterMap reverse_charmap ) {
|
2886 | - if ( af_lookup_tilde_correction_type( reverse_charmap, glyph_index ) ) {
|
|
2890 | + if ( af_lookup_tilde_correction_type( reverse_charmap, glyph_index ) & 2 ) {
|
|
2887 | 2891 | FT_Int highest_contour = af_find_highest_contour( hints );
|
2888 | 2892 | AF_Point p = hints->contours[highest_contour];
|
2889 | 2893 | AF_Point first_point = p;
|
... | ... | @@ -4116,7 +4120,7 @@ static void traceheight(FT_UInt num, AF_GlyphHints hints) { |
4116 | 4120 | |
4117 | 4121 | if ( AF_HINTS_DO_VERTICAL( hints ) )
|
4118 | 4122 | {
|
4119 | - /*af_latin_stretch_tildes( hints, glyph_index, metrics->root.reverse_charmap );*/
|
|
4123 | + af_latin_stretch_tildes( hints, glyph_index, metrics->root.reverse_charmap );
|
|
4120 | 4124 | axis = &metrics->axis[AF_DIMENSION_VERT];
|
4121 | 4125 | error = af_latin_hints_detect_features( hints,
|
4122 | 4126 | axis->width_count,
|