[fixup] Fix wiggle analysis.

As discussed in the tracker, this fixes the handling of the 'tilde' glyph in
`pala.ttf` version 5.00 (from Windows 7), where the vertical extrema differ
from the vertical round extrema by one font unit.
This commit is contained in:
Werner Lemberg 2025-04-07 06:26:19 +02:00
parent 9027157e6b
commit 09a628f912

View File

@ -2918,6 +2918,7 @@
FT_Bool measurement_taken = FALSE;
FT_Pos height;
FT_Pos extremum_threshold;
FT_Pos target_height;
@ -2942,6 +2943,9 @@
FT_TRACE4(( "af_latin_stretch_tilde: min y: %ld, max y: %ld\n",
min_y, max_y ));
height = max_y - min_y;
extremum_threshold = height / 10; /* Value 10 is heuristic. */
/* Find points that are local vertical round extrema, and which */
/* do not coincide with the vertical extreme values (i.e., we */
/* search for the 'other' wiggles in the tilde), then measure the */
@ -2982,6 +2986,10 @@
else
continue;
/* Ignore hits that are too near to a vertical extremum. */
if ( measurement < extremum_threshold )
continue;
if ( !measurement_taken || measurement < min_measurement )
{
measurement_taken = TRUE;
@ -2997,8 +3005,6 @@
FT_TRACE4(( "af_latin_stretch_tilde: min measurement %ld\n",
min_measurement ));
height = max_y - min_y;
/* To preserve the stretched shape we suppress any */
/* auto-hinting if the tilde height is less than 4 pixels. */
if ( height < 64 * 4 )