[autofit] Ignore virtual glyph indices from GSUB lookups.
Reported as
https://issues.chromium.org/issues/420401651
* src/autofit/afadjust.c (af_reverse_character_map_new): Implement it.
diff --git a/src/autofit/afadjust.c b/src/autofit/afadjust.c
index 39add7f..0a95474 100644
--- a/src/autofit/afadjust.c
+++ b/src/autofit/afadjust.c
@@ -1463,7 +1463,11 @@
/* The auto-hinter could then perform a topological analysis */
/* to do the right thing. */
- if ( !( globals->glyph_styles[glyph] & AF_HAS_CMAP_ENTRY ) )
+ /* A glyph index in a lookup might be virtual (i.e., its */
+ /* value might be larger than the number of glyphs); we */
+ /* ignore such cases. */
+ if ( !( glyph < face->num_glyphs &&
+ ( globals->glyph_styles[glyph] & AF_HAS_CMAP_ENTRY ) ) )
{
error = ft_hash_num_insert( glyph, codepoint, *map, memory );
if ( error )