* src/cache/ftccmap.c (FTC_CMapCache_Lookup): Avoid `FT_Set_Charmap`. Set charmap aggressively without all validations of `FT_Set_Charmap` because we take it from the available array and only temporarily. Even CMap Format 14 will gracefully return 0.
diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c
index 8e97a7b..2533059 100644
--- a/src/cache/ftccmap.c
+++ b/src/cache/ftccmap.c
@@ -297,19 +297,17 @@
if ( cmap_index < face->num_charmaps )
{
- FT_CharMap old, cmap = NULL;
+ FT_CharMap old = face->charmap;
+ FT_CharMap cmap = face->charmaps[cmap_index];
- old = face->charmap;
- cmap = face->charmaps[cmap_index];
-
- if ( old != cmap && !no_cmap_change )
- FT_Set_Charmap( face, cmap );
+ if ( !no_cmap_change )
+ face->charmap = cmap;
gindex = FT_Get_Char_Index( face, char_code );
- if ( old != cmap && !no_cmap_change )
- FT_Set_Charmap( face, old );
+ if ( !no_cmap_change )
+ face->charmap = old;
}
FTC_CMAP_NODE( node )->indices[char_code -