diff options
Diffstat (limited to 'src/cff')
-rw-r--r-- | src/cff/cffdrivr.c | 70 | ||||
-rw-r--r-- | src/cff/cffgload.c | 4 | ||||
-rw-r--r-- | src/cff/cffload.c | 8 | ||||
-rw-r--r-- | src/cff/cffparse.c | 4 |
4 files changed, 75 insertions, 11 deletions
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 286c0b3..3dd86f2 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -370,7 +370,8 @@ cff->font_info = font_info; } - *afont_info = *cff->font_info; + if ( cff ) + *afont_info = *cff->font_info; Fail: return error; @@ -506,9 +507,74 @@ } + static FT_Error + cff_get_is_cid( CFF_Face face, + FT_Bool *is_cid ) + { + FT_Error error = CFF_Err_Ok; + CFF_Font cff = (CFF_Font)face->extra.data; + + + *is_cid = 0; + + if ( cff ) + { + CFF_FontRecDict dict = &cff->top_font.font_dict; + + + if ( dict->cid_registry != 0xFFFFU ) + *is_cid = 1; + } + + return error; + } + + + static FT_Error + cff_get_cid_from_glyph_index( CFF_Face face, + FT_UInt glyph_index, + FT_UInt *cid ) + { + FT_Error error = CFF_Err_Ok; + CFF_Font cff; + + + cff = (CFF_Font)face->extra.data; + + if ( cff ) + { + FT_UInt c; + CFF_FontRecDict dict = &cff->top_font.font_dict; + + + if ( dict->cid_registry == 0xFFFFU ) + { + error = CFF_Err_Invalid_Argument; + goto Fail; + } + + if ( glyph_index > cff->num_glyphs ) + { + error = CFF_Err_Invalid_Argument; + goto Fail; + } + + c = cff->charset.sids[glyph_index]; + + if ( cid ) + *cid = c; + } + + Fail: + return error; + } + + static const FT_Service_CIDRec cff_service_cid_info = { - (FT_CID_GetRegistryOrderingSupplementFunc)cff_get_ros + (FT_CID_GetRegistryOrderingSupplementFunc)cff_get_ros, + (FT_CID_GetIsInternallyCIDKeyedFunc) cff_get_is_cid, + (FT_CID_GetCIDFromGlyphIndexFunc) cff_get_cid_from_glyph_index }; diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index c64c6f4..2718a27 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -4,7 +4,7 @@ /* */ /* OpenType Glyph Loader (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -420,7 +420,7 @@ sub = cff->subfonts[fd_index]; - if ( builder->hints_funcs ) + if ( builder->hints_funcs && size ) { CFF_Internal internal = (CFF_Internal)size->root.internal; diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 0178c81..22163fb 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -4,7 +4,7 @@ /* */ /* OpenType and CFF data/program tables loader (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -319,7 +319,7 @@ static FT_Error cff_index_load_offsets( CFF_Index idx ) { - FT_Error error = 0; + FT_Error error = CFF_Err_Ok; FT_Stream stream = idx->stream; FT_Memory memory = stream->memory; @@ -402,6 +402,7 @@ old_offset = 1; for ( n = 0; n <= idx->count; n++ ) { + /* at this point, `idx->offsets' can't be NULL */ offset = idx->offsets[n]; if ( !offset ) offset = old_offset; @@ -1540,9 +1541,6 @@ if ( error ) goto Exit; } - else - /* CID-keyed fonts only need CIDs */ - FT_FREE( font->charset.sids ); } /* get the font name (/CIDFontName for CID-keyed fonts, */ diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index 524d80c..290595f 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -4,7 +4,7 @@ /* */ /* CFF token stream parser (body) */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2007, 2008 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2007, 2008, 2009 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -244,7 +244,7 @@ if ( !nib && !number ) exponent_add--; /* Only add digit if we don't overflow. */ - else if ( number < 0xCCCCCCCL ) + else if ( number < 0xCCCCCCCL && fraction_length < 9 ) { fraction_length++; number = number * 10 + nib; |