Extend functionality of `ft_module_get_service'.

It can now differentiate between local and global searches.

* src/base/ftobjs.c (ft_module_get_service): Add `global' argument.
(FT_Get_TrueType_Engine_Type): Updated.

* src/cff/cffdrivr.c (cff_get_ps_name, cff_get_cmap_info): Updated.

* include/freetype/internal/ftobjs.h: Updated.
* include/freetype/internal/ftserv.h (FT_FACE_FIND_GLOBAL_SERVICE):
Updated.
This commit is contained in:
Werner Lemberg 2016-12-14 18:54:21 +01:00
parent ab22b43bac
commit a7dc0c3554
5 changed files with 43 additions and 23 deletions

View File

@ -1,3 +1,18 @@
2016-12-14 Werner Lemberg <wl@gnu.org>
Extend functionality of `ft_module_get_service'.
It can now differentiate between local and global searches.
* src/base/ftobjs.c (ft_module_get_service): Add `global' argument.
(FT_Get_TrueType_Engine_Type): Updated.
* src/cff/cffdrivr.c (cff_get_ps_name, cff_get_cmap_info): Updated.
* include/freetype/internal/ftobjs.h: Updated.
* include/freetype/internal/ftserv.h (FT_FACE_FIND_GLOBAL_SERVICE):
Updated.
2016-12-14 Werner Lemberg <wl@gnu.org>
* src/truetype/ttgxvar.c (tt_get_var_blend): Fix compiler warning.

View File

@ -531,7 +531,8 @@ FT_BEGIN_HEADER
FT_BASE( FT_Pointer )
ft_module_get_service( FT_Module module,
const char* service_id );
const char* service_id,
FT_Bool global );
#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
FT_BASE( FT_Error )

View File

@ -109,27 +109,27 @@ FT_BEGIN_HEADER
*/
#ifdef __cplusplus
#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id ) \
FT_BEGIN_STMNT \
FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \
FT_Pointer _tmp_; \
FT_Pointer* _pptr_ = (FT_Pointer*)&(ptr); \
\
\
_tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \
*_pptr_ = _tmp_; \
#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id ) \
FT_BEGIN_STMNT \
FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \
FT_Pointer _tmp_; \
FT_Pointer* _pptr_ = (FT_Pointer*)&(ptr); \
\
\
_tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id, 1 ); \
*_pptr_ = _tmp_; \
FT_END_STMNT
#else /* !C++ */
#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id ) \
FT_BEGIN_STMNT \
FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \
FT_Pointer _tmp_; \
\
\
_tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \
ptr = _tmp_; \
#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id ) \
FT_BEGIN_STMNT \
FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \
FT_Pointer _tmp_; \
\
\
_tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id, 1 ); \
ptr = _tmp_; \
FT_END_STMNT
#endif /* !C++ */

View File

@ -4496,7 +4496,8 @@
FT_BASE_DEF( FT_Pointer )
ft_module_get_service( FT_Module module,
const char* service_id )
const char* service_id,
FT_Bool global )
{
FT_Pointer result = NULL;
@ -4509,7 +4510,7 @@
if ( module->clazz->get_interface )
result = module->clazz->get_interface( module, service_id );
if ( result == NULL )
if ( global && result == NULL )
{
/* we didn't find it, look in all other modules then */
FT_Library library = module->library;
@ -4977,7 +4978,8 @@
service = (FT_Service_TrueTypeEngine)
ft_module_get_service( module,
FT_SERVICE_ID_TRUETYPE_ENGINE );
FT_SERVICE_ID_TRUETYPE_ENGINE,
0 );
if ( service )
result = service->engine_type;
}

View File

@ -455,7 +455,8 @@
FT_Service_PsFontName service =
(FT_Service_PsFontName)ft_module_get_service(
sfnt_module,
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME );
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME,
0 );
if ( service && service->get_ps_font_name )
@ -500,7 +501,8 @@
FT_Module sfnt = FT_Get_Module( library, "sfnt" );
FT_Service_TTCMaps service =
(FT_Service_TTCMaps)ft_module_get_service( sfnt,
FT_SERVICE_ID_TT_CMAP );
FT_SERVICE_ID_TT_CMAP,
0 );
if ( service && service->get_cmap_info )