From 27a4f9c4ac45ff65f941964f7351b64b1e6a9f35 Mon Sep 17 00:00:00 2001 From: scuri Date: Tue, 20 Oct 2009 17:20:18 +0000 Subject: *** empty log message *** --- src/freetype2/raster/ftrend1.c | 46 +++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 14 deletions(-) (limited to 'src/freetype2/raster/ftrend1.c') diff --git a/src/freetype2/raster/ftrend1.c b/src/freetype2/raster/ftrend1.c index 3cc8d07..1ed8af6 100644 --- a/src/freetype2/raster/ftrend1.c +++ b/src/freetype2/raster/ftrend1.c @@ -21,6 +21,7 @@ #include FT_OUTLINE_H #include "ftrend1.h" #include "ftraster.h" +#include "rastpic.h" #include "rasterrs.h" @@ -118,6 +119,7 @@ } /* check rendering mode */ +#ifndef FT_CONFIG_OPTION_PIC if ( mode != FT_RENDER_MODE_MONO ) { /* raster1 is only capable of producing monochrome bitmaps */ @@ -130,6 +132,25 @@ if ( render->clazz == &ft_raster5_renderer_class ) return Raster_Err_Cannot_Render_Glyph; } +#else /* FT_CONFIG_OPTION_PIC */ + /* When PIC is enabled, we cannot get to the class object */ + /* so instead we check the final character in the class name */ + /* ("raster5" or "raster1"). Yes this is a hack. */ + /* The "correct" thing to do is have different render function */ + /* for each of the classes. */ + if ( mode != FT_RENDER_MODE_MONO ) + { + /* raster1 is only capable of producing monochrome bitmaps */ + if ( render->clazz->root.module_name[6] == '1' ) + return Raster_Err_Cannot_Render_Glyph; + } + else + { + /* raster5 is only capable of producing 5-gray-levels bitmaps */ + if ( render->clazz->root.module_name[6] == '5' ) + return Raster_Err_Cannot_Render_Glyph; + } +#endif /* FT_CONFIG_OPTION_PIC */ outline = &slot->outline; @@ -208,10 +229,8 @@ } - FT_CALLBACK_TABLE_DEF - const FT_Renderer_Class ft_raster1_renderer_class = - { - { + FT_DEFINE_RENDERER(ft_raster1_renderer_class, + FT_MODULE_RENDERER, sizeof( FT_RendererRec ), @@ -224,7 +243,7 @@ (FT_Module_Constructor)ft_raster1_init, (FT_Module_Destructor) 0, (FT_Module_Requester) 0 - }, + , FT_GLYPH_FORMAT_OUTLINE, @@ -233,18 +252,17 @@ (FT_Renderer_GetCBoxFunc) ft_raster1_get_cbox, (FT_Renderer_SetModeFunc) ft_raster1_set_mode, - (FT_Raster_Funcs*) &ft_standard_raster - }; + (FT_Raster_Funcs*) &FT_STANDARD_RASTER_GET + ) /* This renderer is _NOT_ part of the default modules; you will need */ /* to register it by hand in your application. It should only be */ /* used for backwards-compatibility with FT 1.x anyway. */ /* */ - FT_CALLBACK_TABLE_DEF - const FT_Renderer_Class ft_raster5_renderer_class = - { - { + FT_DEFINE_RENDERER(ft_raster5_renderer_class, + + FT_MODULE_RENDERER, sizeof( FT_RendererRec ), @@ -257,7 +275,7 @@ (FT_Module_Constructor)ft_raster1_init, (FT_Module_Destructor) 0, (FT_Module_Requester) 0 - }, + , FT_GLYPH_FORMAT_OUTLINE, @@ -266,8 +284,8 @@ (FT_Renderer_GetCBoxFunc) ft_raster1_get_cbox, (FT_Renderer_SetModeFunc) ft_raster1_set_mode, - (FT_Raster_Funcs*) &ft_standard_raster - }; + (FT_Raster_Funcs*) &FT_STANDARD_RASTER_GET + ) /* END */ -- cgit v1.2.3