summaryrefslogtreecommitdiffstats
path: root/src/raster/ftrend1.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/raster/ftrend1.c')
-rw-r--r--src/raster/ftrend1.c46
1 files changed, 32 insertions, 14 deletions
diff --git a/src/raster/ftrend1.c b/src/raster/ftrend1.c
index 3cc8d07..1ed8af6 100644
--- a/src/raster/ftrend1.c
+++ b/src/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 */