diff options
Diffstat (limited to 'freetype/src/cff/cffdrivr.c')
-rw-r--r-- | freetype/src/cff/cffdrivr.c | 59 |
1 files changed, 38 insertions, 21 deletions
diff --git a/freetype/src/cff/cffdrivr.c b/freetype/src/cff/cffdrivr.c index bf2d016c0..eb4c14ee5 100644 --- a/freetype/src/cff/cffdrivr.c +++ b/freetype/src/cff/cffdrivr.c @@ -4,7 +4,7 @@ /* */ /* OpenType font driver implementation (body). */ /* */ -/* Copyright 1996-2011 by */ +/* Copyright 1996-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -125,7 +125,7 @@ /*************************************************************************/ /* */ /* <Function> */ - /* Load_Glyph */ + /* cff_glyph_load */ /* */ /* <Description> */ /* A driver method used to load a glyph within a given glyph slot. */ @@ -149,10 +149,10 @@ /* FreeType error code. 0 means success. */ /* */ FT_CALLBACK_DEF( FT_Error ) - Load_Glyph( FT_GlyphSlot cffslot, /* CFF_GlyphSlot */ - FT_Size cffsize, /* CFF_Size */ - FT_UInt glyph_index, - FT_Int32 load_flags ) + cff_glyph_load( FT_GlyphSlot cffslot, /* CFF_GlyphSlot */ + FT_Size cffsize, /* CFF_Size */ + FT_UInt glyph_index, + FT_Int32 load_flags ) { FT_Error error; CFF_GlyphSlot slot = (CFF_GlyphSlot)cffslot; @@ -203,7 +203,7 @@ for ( nn = 0; nn < count; nn++ ) { - error = Load_Glyph( slot, face->size, start + nn, flags ); + error = cff_glyph_load( slot, face->size, start + nn, flags ); if ( error ) break; @@ -239,7 +239,7 @@ " cannot get glyph name from CFF & CEF fonts\n" " " " without the `PSNames' module\n" )); - error = CFF_Err_Unknown_File_Format; + error = CFF_Err_Missing_Module; goto Exit; } @@ -466,7 +466,7 @@ dict->cid_registry ); *registry = cff->registry; } - + if ( ordering ) { if ( cff->ordering == NULL ) @@ -489,7 +489,7 @@ *supplement = (FT_Int)dict->cid_supplement; } } - + Fail: return error; } @@ -599,19 +599,35 @@ cff_get_interface( FT_Module driver, /* CFF_Driver */ const char* module_interface ) { + FT_Library library; FT_Module sfnt; FT_Module_Interface result; + /* FT_CFF_SERVICES_GET derefers `library' in PIC mode */ +#ifdef FT_CONFIG_OPTION_PIC + if ( !driver ) + return NULL; + library = driver->library; + if ( !library ) + return NULL; +#endif + result = ft_service_list_lookup( FT_CFF_SERVICES_GET, module_interface ); if ( result != NULL ) - return result; + return result; + /* `driver' is not yet evaluated in non-PIC mode */ +#ifndef FT_CONFIG_OPTION_PIC if ( !driver ) return NULL; + library = driver->library; + if ( !library ) + return NULL; +#endif /* we pass our request to the `sfnt' module */ - sfnt = FT_Get_Module( driver->library, "sfnt" ); + sfnt = FT_Get_Module( library, "sfnt" ); return sfnt ? sfnt->clazz->get_interface( sfnt, module_interface ) : 0; } @@ -625,12 +641,13 @@ #define CFF_SIZE_SELECT 0 #endif - FT_DEFINE_DRIVER(cff_driver_class, + FT_DEFINE_DRIVER( cff_driver_class, + FT_MODULE_FONT_DRIVER | FT_MODULE_DRIVER_SCALABLE | FT_MODULE_DRIVER_HAS_HINTER, - sizeof( CFF_DriverRec ), + sizeof ( CFF_DriverRec ), "cff", 0x10000L, 0x20000L, @@ -642,9 +659,9 @@ cff_get_interface, /* now the specific driver fields */ - sizeof( TT_FaceRec ), - sizeof( CFF_SizeRec ), - sizeof( CFF_GlyphSlotRec ), + sizeof ( TT_FaceRec ), + sizeof ( CFF_SizeRec ), + sizeof ( CFF_GlyphSlotRec ), cff_face_init, cff_face_done, @@ -653,14 +670,14 @@ cff_slot_init, cff_slot_done, - ft_stub_set_char_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */ + ft_stub_set_char_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */ ft_stub_set_pixel_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */ - Load_Glyph, + cff_glyph_load, cff_get_kerning, - 0, /* FT_Face_AttachFunc */ - cff_get_advances, /* FT_Face_GetAdvancesFunc */ + 0, /* FT_Face_AttachFunc */ + cff_get_advances, cff_size_request, |