Add tilde correction as an entry to the adjustment database. Add comment block about glyph variants algorithm

This commit is contained in:
Craig White 2023-10-15 01:12:42 -04:00
parent 2e5620a46f
commit 23daa69048
3 changed files with 296 additions and 290 deletions

View File

@ -21,121 +21,123 @@
FT_LOCAL_ARRAY_DEF( AF_AdjustmentDatabaseEntry )
adjustment_database[] =
{
{0x21, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP}, /* ! */
{0x69, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP}, /* i */
{0x6A, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP}, /* j */
{0xA1, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP}, /*Inverted Exclamation Mark*/
{0xBF, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP}, /*Inverted Question Mark*/
{0xC0, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP}, /*A with grave*/
{0xC1, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP}, /*A with acute*/
{0xC2, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP}, /*A with circumflex*/
{0xC3, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP}, /*A with tilde*/
{0xC8, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP}, /*E with grave*/
{0xCC, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP}, /*I with grave*/
{0xCD, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xCE, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xD1, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xD2, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xD3, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xD4, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xD5, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xD9, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xD1, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xDB, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xDD, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xE0, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xE1, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xE2, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xE3, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xE8, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xE9, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xEA, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xEC, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xED, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xEE, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xF1, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xF2, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xF3, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xF4, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xF5, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xF9, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xFA, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xFB, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0xFD, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x100, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x101, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x102, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x103, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x106, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x108, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x109, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x10A, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x10B, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x10C, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x10D, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x10E, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x112, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x113, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x114, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x115, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x116, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x117, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x11B, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x11C, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x11D, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x11E, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x11F, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x120, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x121, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x123, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x124, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x125, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x128, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x129, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x12A, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x12B, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x12C, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x12D, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x12F, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x130, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x134, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x135, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x139, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x13A, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x143, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x144, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x147, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x14C, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x14D, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x14E, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x14F, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x154, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x155, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x158, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x159, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x15A, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x15B, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x15C, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x15D, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x160, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x161, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x164, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x168, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x169, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x16A, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x16B, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x16C, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x16D, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x174, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x175, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x176, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x177, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x179, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x17A, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x17B, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x17C, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x17D, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP},
{0x17E, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP}
{0x21, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0}, /* ! */
{0x69, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0}, /* i */
{0x6A, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0}, /* j */
{0xA1, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0}, /*Inverted Exclamation Mark*/
{0xBF, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0}, /* j */
{0xA1, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0}, /*Inverted Exclamation Mark*/
{0xBF, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0}, /*Inverted Question Mark*/
{0xC0, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0}, /*A with grave*/
{0xC1, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0}, /*A with acute*/
{0xC2, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0}, /*A with circumflex*/
{0xC3, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0}, /*A with tilde*/
{0xC8, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0}, /*E with grave*/
{0xCC, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0}, /*I with grave*/
{0xCD, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xCE, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xD1, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xD2, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xD3, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xD4, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xD5, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xD9, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xD1, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xDB, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xDD, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xE0, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xE1, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xE2, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xE3, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 1}, /*a with tilde*/
{0xE8, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xE9, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xEA, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xEC, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xED, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xEE, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xF1, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 1}, /*n with tilde*/
{0xF2, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xF3, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xF4, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xF5, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 1}, /*o with tilde*/
{0xF9, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xFA, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xFB, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0xFD, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x100, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x101, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x102, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x103, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x106, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x108, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x109, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x10A, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x10B, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x10C, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x10D, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x10E, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x112, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x113, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x114, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x115, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x116, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x117, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x11B, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x11C, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x11D, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x11E, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x11F, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x120, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x121, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x123, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x124, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x125, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x128, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x129, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 1}, /*i with tilde*/
{0x12A, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x12B, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x12C, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x12D, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x12F, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x130, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x134, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x135, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x139, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x13A, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x143, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x144, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x147, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x14C, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x14D, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x14E, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x14F, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x154, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x155, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x158, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x159, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x15A, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x15B, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x15C, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x15D, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x160, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x161, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x164, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x168, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x169, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 1}, /*u with tilde*/
{0x16A, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x16B, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x16C, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x16D, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x174, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x175, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x176, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x177, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x179, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x17A, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x17B, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x17C, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x17D, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0},
{0x17E, AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP, 0}
};
/*FT_LOCAL_DEF( FT_Bool )
@ -182,24 +184,17 @@ af_lookup_vertical_seperation_type( AF_ReverseCharacterMap map, FT_Int glyph_ind
return entry->vertical_separation_adjustment_type;
}
/*TODO: this is a testing placeholder
it only returns 1 for n with tilde*/
FT_LOCAL_DEF( FT_Int )
/*1 if tilde correction should be applied to the topmost contour
else 0*/
FT_LOCAL_DEF( FT_Bool )
af_lookup_tilde_correction_type( AF_ReverseCharacterMap map, FT_Int glyph_index ) {
FT_UInt32 codepoint = af_reverse_character_map_lookup( map, glyph_index );
/* bits are: apply stretch, apply segment removal */
if ( codepoint == 0xF1 ) { /*n tilde*/
return 0b01;
}
else if ( codepoint == 0xE3 ) /*a tilde*/
const AF_AdjustmentDatabaseEntry *entry = af_adjustment_database_lookup( codepoint );
if ( entry == NULL )
{
return 0b11;
return 0;
}
else if ( codepoint == 0xF5 ) /*o tilde*/
{
return 0b10;
}
return 0;
return entry->apply_tilde;
}
typedef struct AF_ReverseMapEntry_
@ -283,12 +278,47 @@ af_reverse_character_map_entry_compare( const void *a, const void *b ) {
}
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
/*Recursive algorithm to find all glyphs that a codepoint could turn into from the GSUB table.
/*
Recursive algorithm to find all glyphs that a codepoint could turn into from the GSUB table.
buffer: a buffer containing only the input codepoint
feature_tag_pool: the current list of features under consideration
current_features: the current list of features being applied
num_features: length of current_features
result: the set of glyphs in the answer
result: the set of glyphs that the input codepoint can map to.
The algorithm works by running the hb_ot_shape_glyphs_closure function on different lists of features
to see which features will map to glyph onto something different. This functions returns
the result of transforming a glyph using a list of features as well as all intermediate
forms if the glyph was transformed multiple times.
With no features enabled, hb_ot_shape_glyphs_closure will only return the glyph given by cmap.
This character will be the first to be placed into the results set.
Next, the algorithm will test the same lookup enabline one feature at a time
and see if any of those features change the result.
If any new glyph variants are found this way, they are added to the results set
and the algorithm will recurce, trying that feature in combination will every other feature
to look for further glyph variants.
example:
suppose we have the following features in the GSUB table:
f1:
a -> b
f2:
b -> c
f3:
d -> e
The algorithm will take the following steps to find all variants of "a":
- a is added to the results
- lookup with feature list {f1}, yielding {a, b}. b is added to the results list and the algorithm recurses
- - lookup with feature list {f1, f2}, yielding {a, b, c}. c is added to the results list and the algorithm recurses
- - - lookup with feature list {f1, f2, f3} yielding {a, b, c}. No new glyphs
- - lookup with feature list {f1, f3}, yielding {a, b}. No new glyphs
- lookup with feature list {f2}, yielding {a}. No new glyphs
- lookup with feature list {f3}, yielding {a}. No new glyphs
*/
FT_LOCAL_DEF( FT_Error )
af_all_glyph_variants_helper( hb_font_t *font,
@ -300,7 +330,7 @@ af_all_glyph_variants_helper( hb_font_t *font,
{
FT_Error error;
/*get the list of glyphs that are created by only transforming based on the
features in current features*/
features in current_features*/
hb_set_t *baseline_glyphs = NULL, *new_glyphs = NULL;
baseline_glyphs = hb_set_create();
if ( !hb_set_allocation_successful( baseline_glyphs ) )

View File

@ -27,12 +27,13 @@ typedef struct AF_AdjustmentDatabaseEntry_
{
FT_UInt32 codepoint;
AF_VerticalSeparationAdjustmentType vertical_separation_adjustment_type;
FT_Bool apply_tilde;
} AF_AdjustmentDatabaseEntry;
FT_LOCAL(AF_VerticalSeparationAdjustmentType)
af_lookup_vertical_seperation_type( AF_ReverseCharacterMap map, FT_Int glyph_index );
FT_LOCAL( FT_Int )
FT_LOCAL( FT_Bool )
af_lookup_tilde_correction_type( AF_ReverseCharacterMap map, FT_Int glyph_index );
FT_LOCAL( FT_UInt32 )

View File

@ -2855,158 +2855,154 @@ af_remove_segments_containing_point(AF_GlyphHints hints, AF_Point point)
}
}
/*remove all segments containing points on the tilde contour*/
static void
af_latin_stretch_tildes_step_2( AF_GlyphHints hints,
FT_Int glyph_index,
AF_ReverseCharacterMap reverse_charmap )
af_latin_remove_tilde_points_from_edges( AF_GlyphHints hints,
FT_Int 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];
FT_Int highest_contour = af_find_highest_contour(hints);
AF_Point first_point = hints->contours[highest_contour];
/* search for any curve tips that are on a y extrema, and delete any
segments that contain this point.*/
AF_Point p = first_point;
/* search for any curve tips that are on a y extrema, and delete any
segments that contain this point.*/
AF_Point p = first_point;
do
do
{
p = p->next;
if ( /*!(p->flags & AF_FLAG_CONTROL)
&& p->prev->y == p->y && p->next->y == p->y
&& p->prev->flags & AF_FLAG_CONTROL
&& p->next->flags & AF_FLAG_CONTROL*/ 1 )
{
p = p->next;
if ( /*!(p->flags & AF_FLAG_CONTROL)
&& p->prev->y == p->y && p->next->y == p->y
&& 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 );
}
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 ) & 2 ) {
FT_Int highest_contour = af_find_highest_contour( hints );
AF_Point p = hints->contours[highest_contour];
AF_Point first_point = p;
FT_Int glyph_index )
{
FT_Int highest_contour = af_find_highest_contour( hints );
AF_Point p = hints->contours[highest_contour];
AF_Point first_point = p;
FT_Pos min_y, max_y;
min_y = max_y = p->y;
FT_Pos min_y, max_y;
min_y = max_y = p->y;
FT_Short min_fy, max_fy;
min_fy = max_fy = p->fy;
FT_Short min_fy, max_fy;
min_fy = max_fy = p->fy;
do
do
{
p = p->next;
if ( p->y < min_y )
{
p = p->next;
if ( p->y < min_y )
{
min_y = p->y;
}
if ( p->y > max_y )
{
max_y = p->y;
}
if ( p->fy < min_fy )
{
min_fy = p->fy;
}
if ( p->fy > max_fy )
{
max_fy = p->fy;
}
min_y = p->y;
}
while ( p != first_point );
FT_Pos min_measurement = 32000;
FT_UInt measurements_taken = 0;
do
if ( p->y > max_y )
{
p = p->next;
if ( !(p->flags & AF_FLAG_CONTROL)
&& p->prev->y == p->y && p->next->y == p->y
&& p->y != min_y && p->y != max_y
&& p->prev->flags & AF_FLAG_CONTROL
&& p->next->flags & AF_FLAG_CONTROL )
{
/* This point could be a candidate. Find the next and previous on-curve */
/* points, and make sure they are both either above or below the point, */
/* Then make the measurement */
AF_Point prevOn = p->prev;
AF_Point nextOn = p->next;
while ( prevOn->flags & AF_FLAG_CONTROL )
{
prevOn = prevOn->prev;
}
while ( nextOn->flags & AF_FLAG_CONTROL )
{
nextOn = nextOn->next;
}
FT_Pos measurement;
if ( nextOn->y > p->y && prevOn->y > p->y )
{
measurement = p->y - min_y;
}
else if ( nextOn->y < p->y && prevOn->y < p->y )
{
measurement = max_y - p->y;
}
else
{
continue;
}
if (measurement < min_measurement)
{
min_measurement = measurement;
}
measurements_taken++;
}
max_y = p->y;
}
while ( p != first_point );
FT_Pos height = max_y - min_y;
FT_Pos target_height = min_measurement + 64;
if ( height >= target_height )
if ( p->fy < min_fy )
{
return;
min_fy = p->fy;
}
p = first_point;
do
if ( p->fy > max_fy )
{
p = p->next;
p->y = ((p->y - min_y) * target_height / height) + min_y;
p->fy = ((p->fy - min_fy) * target_height / height) + min_fy;
p->oy = p->y;
if ( !(p->flags & AF_FLAG_CONTROL) )
p->flags |= AF_FLAG_TOUCH_Y;
max_fy = p->fy;
}
while ( p != first_point );
FT_Pos new_min_y, new_max_y;
new_min_y = new_max_y = first_point->y;
p = first_point;
do {
p = p->next;
if ( p->y < new_min_y )
{
new_min_y = p->y;
}
if ( p->y > new_max_y )
{
new_max_y = p->y;
}
}
while ( p != first_point );
}
while ( p != first_point );
FT_Pos min_measurement = 32000;
FT_UInt measurements_taken = 0;
do
{
p = p->next;
if ( !(p->flags & AF_FLAG_CONTROL)
&& p->prev->y == p->y && p->next->y == p->y
&& p->y != min_y && p->y != max_y
&& p->prev->flags & AF_FLAG_CONTROL
&& p->next->flags & AF_FLAG_CONTROL )
{
/* This point could be a candidate. Find the next and previous on-curve */
/* points, and make sure they are both either above or below the point, */
/* Then make the measurement */
AF_Point prevOn = p->prev;
AF_Point nextOn = p->next;
while ( prevOn->flags & AF_FLAG_CONTROL )
{
prevOn = prevOn->prev;
}
while ( nextOn->flags & AF_FLAG_CONTROL )
{
nextOn = nextOn->next;
}
FT_Pos measurement;
if ( nextOn->y > p->y && prevOn->y > p->y )
{
measurement = p->y - min_y;
}
else if ( nextOn->y < p->y && prevOn->y < p->y )
{
measurement = max_y - p->y;
}
else
{
continue;
}
if (measurement < min_measurement)
{
min_measurement = measurement;
}
measurements_taken++;
}
}
while ( p != first_point );
FT_Pos height = max_y - min_y;
FT_Pos target_height = min_measurement + 64;
if ( height >= target_height )
{
return;
}
p = first_point;
do
{
p = p->next;
p->y = ((p->y - min_y) * target_height / height) + min_y;
p->fy = ((p->fy - min_fy) * target_height / height) + min_fy;
p->oy = p->y;
if ( !(p->flags & AF_FLAG_CONTROL) )
p->flags |= AF_FLAG_TOUCH_Y;
}
while ( p != first_point );
FT_Pos new_min_y, new_max_y;
new_min_y = new_max_y = first_point->y;
p = first_point;
do {
p = p->next;
if ( p->y < new_min_y )
{
new_min_y = p->y;
}
if ( p->y > new_max_y )
{
new_max_y = p->y;
}
}
while ( p != first_point );
}
/*True if the given contour overlaps horizontally with the bounding box
@ -4060,33 +4056,7 @@ af_glyph_hints_apply_vertical_separation_adjustments( AF_GlyphHints hints,
#endif
}
/*Print the height of the topmost contour for debugging purposes.
TODO: remove this once the tilde unflattening works.*/
static void traceheight(FT_UInt num, AF_GlyphHints hints) {
AF_Point p = hints->contours[af_find_highest_contour(hints)];
AF_Point first_point = p;
FT_Pos min_y, max_y;
min_y = max_y = p->y;
do {
p = p->next;
if ( !(p->flags & AF_FLAG_CONTROL) ) {
if ( p->y < min_y ) {
min_y = p->y;
}
if ( p->y > max_y ) {
max_y = p->y;
}
}
} while ( p != first_point );
FT_Pos height = max_y - min_y;
FT_TRACE4(( "height %d: %d\n", num, height ));
}
/* Apply the complete hinting algorithm to a latin glyph. */
static FT_Error
af_latin_hints_apply( FT_UInt glyph_index,
AF_GlyphHints hints,
@ -4119,13 +4089,18 @@ 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 );
FT_Bool is_tilde = af_lookup_tilde_correction_type( metrics->root.reverse_charmap, glyph_index );
if ( is_tilde ) {
af_latin_stretch_tildes( hints, glyph_index );
}
axis = &metrics->axis[AF_DIMENSION_VERT];
error = af_latin_hints_detect_features( hints,
axis->width_count,
axis->widths,
AF_DIMENSION_VERT );
af_latin_stretch_tildes_step_2( hints, glyph_index, metrics->root.reverse_charmap );
if ( is_tilde ) {
af_latin_remove_tilde_points_from_edges( hints, glyph_index );
}
if ( error )
goto Exit;