diff options
Diffstat (limited to 'src/truetype/ttpload.c')
-rw-r--r-- | src/truetype/ttpload.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/truetype/ttpload.c b/src/truetype/ttpload.c index fb338bd..9bf67f9 100644 --- a/src/truetype/ttpload.c +++ b/src/truetype/ttpload.c @@ -124,8 +124,9 @@ TT_Table entry = face->dir_tables; TT_Table limit = entry + face->num_tables; - FT_Long pos = (FT_Long)FT_STREAM_POS(); - FT_Long dist = 0x7FFFFFFFL; + FT_Long pos = (FT_Long)FT_STREAM_POS(); + FT_Long dist = 0x7FFFFFFFL; + FT_Bool found = 0; /* compute the distance to next table in font file */ @@ -135,10 +136,13 @@ if ( diff > 0 && diff < dist ) - dist = diff; + { + dist = diff; + found = 1; + } } - if ( entry == limit ) + if ( !found ) { /* `loca' is the last table */ dist = (FT_Long)stream->size - pos; @@ -152,6 +156,14 @@ FT_TRACE2(( "adjusting num_locations to %d\n", face->num_locations )); } + else + { + face->root.num_glyphs = face->num_locations + ? (FT_Long)face->num_locations - 1 : 0; + + FT_TRACE2(( "adjusting num_glyphs to %d\n", + face->root.num_glyphs )); + } } } @@ -214,7 +226,8 @@ if ( pos1 > face->glyf_len ) { FT_TRACE1(( "tt_face_get_location:" - " too large offset=0x%08lx found for gid=0x%04lx," + " too large offset=0x%08lx found for gid=0x%04lx,\n" + " " " exceeding the end of glyf table (0x%08lx)\n", pos1, gindex, face->glyf_len )); *asize = 0; @@ -224,7 +237,8 @@ if ( pos2 > face->glyf_len ) { FT_TRACE1(( "tt_face_get_location:" - " too large offset=0x%08lx found for gid=0x%04lx," + " too large offset=0x%08lx found for gid=0x%04lx,\n" + " " " truncate at the end of glyf table (0x%08lx)\n", pos2, gindex + 1, face->glyf_len )); pos2 = face->glyf_len; |