Index: third_party/freetype/src/cff/cf2ft.c |
diff --git a/third_party/freetype/src/cff/cf2ft.c b/third_party/freetype/src/cff/cf2ft.c |
index ebba4694ce8339e1d37af9f1023d42d59ad2ff37..d2544a234516e6355f339dc2ed7cb99efd2defa5 100644 |
--- a/third_party/freetype/src/cff/cf2ft.c |
+++ b/third_party/freetype/src/cff/cf2ft.c |
@@ -551,7 +551,7 @@ |
FT_ZERO( buf ); |
- idx += decoder->globals_bias; |
+ idx += (CF2_UInt)decoder->globals_bias; |
if ( idx >= decoder->num_globals ) |
return TRUE; /* error */ |
@@ -569,7 +569,7 @@ |
/* used for seac component */ |
FT_LOCAL_DEF( FT_Error ) |
cf2_getSeacComponent( CFF_Decoder* decoder, |
- CF2_UInt code, |
+ CF2_Int code, |
CF2_Buffer buf ) |
{ |
CF2_Int gid; |
@@ -582,12 +582,21 @@ |
FT_ZERO( buf ); |
- gid = cff_lookup_glyph_by_stdcharcode( decoder->cff, code ); |
- if ( gid < 0 ) |
- return FT_THROW( Invalid_Glyph_Format ); |
+#ifdef FT_CONFIG_OPTION_INCREMENTAL |
+ /* Incremental fonts don't necessarily have valid charsets. */ |
+ /* They use the character code, not the glyph index, in this case. */ |
+ if ( decoder->builder.face->root.internal->incremental_interface ) |
+ gid = code; |
+ else |
+#endif /* FT_CONFIG_OPTION_INCREMENTAL */ |
+ { |
+ gid = cff_lookup_glyph_by_stdcharcode( decoder->cff, code ); |
+ if ( gid < 0 ) |
+ return FT_THROW( Invalid_Glyph_Format ); |
+ } |
error = cff_get_glyph_data( decoder->builder.face, |
- gid, |
+ (CF2_UInt)gid, |
&charstring, |
&len ); |
/* TODO: for now, just pass the FreeType error through */ |
@@ -626,7 +635,7 @@ |
FT_ZERO( buf ); |
- idx += decoder->locals_bias; |
+ idx += (CF2_UInt)decoder->locals_bias; |
if ( idx >= decoder->num_locals ) |
return TRUE; /* error */ |