1 /***************************************************************************/
5 /* A new `perfect' anti-aliasing renderer (body). */
7 /* Copyright 2000-2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
10 /* This file is part of the FreeType project, and may only be used, */
11 /* modified, and distributed under the terms of the FreeType project */
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 /* this file you indicate that you have read the license and */
14 /* understand and accept it fully. */
16 /***************************************************************************/
18 /*************************************************************************/
20 /* This file can be compiled without the rest of the FreeType engine, by */
21 /* defining the _STANDALONE_ macro when compiling it. You also need to */
22 /* put the files `ftgrays.h' and `ftimage.h' into the current */
23 /* compilation directory. Typically, you could do something like */
25 /* - copy `src/smooth/ftgrays.c' (this file) to your current directory */
27 /* - copy `include/freetype/ftimage.h' and `src/smooth/ftgrays.h' to the */
30 /* - compile `ftgrays' with the _STANDALONE_ macro defined, as in */
32 /* cc -c -D_STANDALONE_ ftgrays.c */
34 /* The renderer can be initialized with a call to */
35 /* `ft_gray_raster.raster_new'; an anti-aliased bitmap can be generated */
36 /* with a call to `ft_gray_raster.raster_render'. */
38 /* See the comments and documentation in the file `ftimage.h' for more */
39 /* details on how the raster works. */
41 /*************************************************************************/
43 /*************************************************************************/
45 /* This is a new anti-aliasing scan-converter for FreeType 2. The */
46 /* algorithm used here is _very_ different from the one in the standard */
47 /* `ftraster' module. Actually, `ftgrays' computes the _exact_ */
48 /* coverage of the outline on each pixel cell. */
50 /* It is based on ideas that I initially found in Raph Levien's */
51 /* excellent LibArt graphics library (see http://www.levien.com/libart */
52 /* for more information, though the web pages do not tell anything */
53 /* about the renderer; you'll have to dive into the source code to */
54 /* understand how it works). */
56 /* Note, however, that this is a _very_ different implementation */
57 /* compared to Raph's. Coverage information is stored in a very */
58 /* different way, and I don't use sorted vector paths. Also, it doesn't */
59 /* use floating point values. */
61 /* This renderer has the following advantages: */
63 /* - It doesn't need an intermediate bitmap. Instead, one can supply a */
64 /* callback function that will be called by the renderer to draw gray */
65 /* spans on any target surface. You can thus do direct composition on */
66 /* any kind of bitmap, provided that you give the renderer the right */
69 /* - A perfect anti-aliaser, i.e., it computes the _exact_ coverage on */
70 /* each pixel cell. */
72 /* - It performs a single pass on the outline (the `standard' FT2 */
73 /* renderer makes two passes). */
75 /* - It can easily be modified to render to _any_ number of gray levels */
78 /* - For small (< 20) pixel sizes, it is faster than the standard */
81 /*************************************************************************/
84 /*************************************************************************/
86 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
87 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
88 /* messages during execution. */
91 #define FT_COMPONENT trace_smooth
97 /* define this to dump debugging information */
98 /* #define FT_DEBUG_LEVEL_TRACE */
101 #ifdef FT_DEBUG_LEVEL_TRACE
109 #define FT_UINT_MAX UINT_MAX
111 #define ft_memset memset
113 #define ft_setjmp setjmp
114 #define ft_longjmp longjmp
115 #define ft_jmp_buf jmp_buf
118 #define ErrRaster_Invalid_Mode -2
119 #define ErrRaster_Invalid_Outline -1
120 #define ErrRaster_Invalid_Argument -3
121 #define ErrRaster_Memory_Overflow -4
123 #define FT_BEGIN_HEADER
124 #define FT_END_HEADER
130 /* This macro is used to indicate that a function parameter is unused. */
131 /* Its purpose is simply to reduce compiler warnings. Note also that */
132 /* simply defining it as `(void)x' doesn't avoid warnings with certain */
133 /* ANSI compilers (e.g. LCC). */
134 #define FT_UNUSED( x ) (x) = (x)
137 /* we only use level 5 & 7 tracing messages; cf. ftdebug.h */
139 #ifdef FT_DEBUG_LEVEL_TRACE
142 FT_Message( const char* fmt
,
149 vfprintf( stderr
, fmt
, ap
);
153 /* we don't handle tracing levels in stand-alone mode; */
155 #define FT_TRACE5( varformat ) FT_Message varformat
158 #define FT_TRACE7( varformat ) FT_Message varformat
161 #define FT_ERROR( varformat ) FT_Message varformat
164 #else /* !FT_DEBUG_LEVEL_TRACE */
166 #define FT_TRACE5( x ) do { } while ( 0 ) /* nothing */
167 #define FT_TRACE7( x ) do { } while ( 0 ) /* nothing */
168 #define FT_ERROR( x ) do { } while ( 0 ) /* nothing */
170 #endif /* !FT_DEBUG_LEVEL_TRACE */
173 #define FT_DEFINE_OUTLINE_FUNCS( class_, \
174 move_to_, line_to_, \
175 conic_to_, cubic_to_, \
177 static const FT_Outline_Funcs class_ = \
187 #define FT_DEFINE_RASTER_FUNCS( class_, glyph_format_, \
188 raster_new_, raster_reset_, \
189 raster_set_mode_, raster_render_, \
191 const FT_Raster_Funcs class_ = \
201 #else /* !_STANDALONE_ */
204 #include <ft2build.h>
206 #include FT_INTERNAL_OBJECTS_H
207 #include FT_INTERNAL_DEBUG_H
208 #include FT_OUTLINE_H
210 #include "ftsmerrs.h"
214 #define ErrRaster_Invalid_Mode Smooth_Err_Cannot_Render_Glyph
215 #define ErrRaster_Invalid_Outline Smooth_Err_Invalid_Outline
216 #define ErrRaster_Memory_Overflow Smooth_Err_Out_Of_Memory
217 #define ErrRaster_Invalid_Argument Smooth_Err_Invalid_Argument
219 #endif /* !_STANDALONE_ */
222 #define FT_MEM_SET( d, s, c ) ft_memset( d, s, c )
226 #define FT_MEM_ZERO( dest, count ) FT_MEM_SET( dest, 0, count )
229 /* as usual, for the speed hungry :-) */
231 #ifndef FT_STATIC_RASTER
233 #define RAS_ARG PWorker worker
234 #define RAS_ARG_ PWorker worker,
236 #define RAS_VAR worker
237 #define RAS_VAR_ worker,
239 #else /* FT_STATIC_RASTER */
241 #define RAS_ARG /* empty */
242 #define RAS_ARG_ /* empty */
243 #define RAS_VAR /* empty */
244 #define RAS_VAR_ /* empty */
246 #endif /* FT_STATIC_RASTER */
249 /* must be at least 6 bits! */
252 #define ONE_PIXEL ( 1L << PIXEL_BITS )
253 #define PIXEL_MASK ( -1L << PIXEL_BITS )
254 #define TRUNC( x ) ( (TCoord)( (x) >> PIXEL_BITS ) )
255 #define SUBPIXELS( x ) ( (TPos)(x) << PIXEL_BITS )
256 #define FLOOR( x ) ( (x) & -ONE_PIXEL )
257 #define CEILING( x ) ( ( (x) + ONE_PIXEL - 1 ) & -ONE_PIXEL )
258 #define ROUND( x ) ( ( (x) + ONE_PIXEL / 2 ) & -ONE_PIXEL )
261 #define UPSCALE( x ) ( (x) << ( PIXEL_BITS - 6 ) )
262 #define DOWNSCALE( x ) ( (x) >> ( PIXEL_BITS - 6 ) )
264 #define UPSCALE( x ) ( (x) >> ( 6 - PIXEL_BITS ) )
265 #define DOWNSCALE( x ) ( (x) << ( 6 - PIXEL_BITS ) )
269 /*************************************************************************/
271 /* TYPE DEFINITIONS */
274 /* don't change the following types to FT_Int or FT_Pos, since we might */
275 /* need to define them to "float" or "double" when experimenting with */
278 typedef long TCoord
; /* integer scanline/pixel coordinate */
279 typedef long TPos
; /* sub-pixel coordinate */
281 /* determine the type used to store cell areas. This normally takes at */
282 /* least PIXEL_BITS*2 + 1 bits. On 16-bit systems, we need to use */
283 /* `long' instead of `int', otherwise bad things happen */
289 #else /* PIXEL_BITS >= 8 */
291 /* approximately determine the size of integers using an ANSI-C header */
292 #if FT_UINT_MAX == 0xFFFFU
298 #endif /* PIXEL_BITS >= 8 */
301 /* maximal number of gray spans in a call to the span callback */
302 #define FT_MAX_GRAY_SPANS 32
305 typedef struct TCell_
* PCell
;
307 typedef struct TCell_
309 TPos x
; /* same with TWorker.ex */
310 TCoord cover
; /* same with TWorker.cover */
317 typedef struct TWorker_
322 TPos count_ex
, count_ey
;
329 FT_PtrDist max_cells
;
330 FT_PtrDist num_cells
;
337 FT_Vector bez_stack
[32 * 3 + 1];
344 FT_Span gray_spans
[FT_MAX_GRAY_SPANS
];
347 FT_Raster_Span_Func render_span
;
348 void* render_span_data
;
356 ft_jmp_buf jump_buffer
;
367 #ifndef FT_STATIC_RASTER
368 #define ras (*worker)
374 typedef struct TRaster_
386 /*************************************************************************/
388 /* Initialize the cells table. */
391 gray_init_cells( RAS_ARG_
void* buffer
,
395 ras
.buffer_size
= byte_size
;
397 ras
.ycells
= (PCell
*) buffer
;
407 /*************************************************************************/
409 /* Compute the outline bounding box. */
412 gray_compute_cbox( RAS_ARG
)
414 FT_Outline
* outline
= &ras
.outline
;
415 FT_Vector
* vec
= outline
->points
;
416 FT_Vector
* limit
= vec
+ outline
->n_points
;
419 if ( outline
->n_points
<= 0 )
421 ras
.min_ex
= ras
.max_ex
= 0;
422 ras
.min_ey
= ras
.max_ey
= 0;
426 ras
.min_ex
= ras
.max_ex
= vec
->x
;
427 ras
.min_ey
= ras
.max_ey
= vec
->y
;
431 for ( ; vec
< limit
; vec
++ )
437 if ( x
< ras
.min_ex
) ras
.min_ex
= x
;
438 if ( x
> ras
.max_ex
) ras
.max_ex
= x
;
439 if ( y
< ras
.min_ey
) ras
.min_ey
= y
;
440 if ( y
> ras
.max_ey
) ras
.max_ey
= y
;
443 /* truncate the bounding box to integer pixels */
444 ras
.min_ex
= ras
.min_ex
>> 6;
445 ras
.min_ey
= ras
.min_ey
>> 6;
446 ras
.max_ex
= ( ras
.max_ex
+ 63 ) >> 6;
447 ras
.max_ey
= ( ras
.max_ey
+ 63 ) >> 6;
451 /*************************************************************************/
453 /* Record the current cell in the table. */
456 gray_find_cell( RAS_ARG
)
462 if ( x
> ras
.count_ex
)
465 pcell
= &ras
.ycells
[ras
.ey
];
469 if ( cell
== NULL
|| cell
->x
> x
)
478 if ( ras
.num_cells
>= ras
.max_cells
)
479 ft_longjmp( ras
.jump_buffer
, 1 );
481 cell
= ras
.cells
+ ras
.num_cells
++;
495 gray_record_cell( RAS_ARG
)
497 if ( !ras
.invalid
&& ( ras
.area
| ras
.cover
) )
499 PCell cell
= gray_find_cell( RAS_VAR
);
502 cell
->area
+= ras
.area
;
503 cell
->cover
+= ras
.cover
;
508 /*************************************************************************/
510 /* Set the current cell to a new position. */
513 gray_set_cell( RAS_ARG_ TCoord ex
,
516 /* Move the cell pointer to a new position. We set the `invalid' */
517 /* flag to indicate that the cell isn't part of those we're interested */
518 /* in during the render phase. This means that: */
520 /* . the new vertical position must be within min_ey..max_ey-1. */
521 /* . the new horizontal position must be strictly less than max_ex */
523 /* Note that if a cell is to the left of the clipping region, it is */
524 /* actually set to the (min_ex-1) horizontal position. */
526 /* All cells that are on the left of the clipping region go to the */
527 /* min_ex - 1 horizontal position. */
530 if ( ex
> ras
.max_ex
)
537 /* are we moving to a different cell ? */
538 if ( ex
!= ras
.ex
|| ey
!= ras
.ey
)
540 /* record the current one if it is valid */
542 gray_record_cell( RAS_VAR
);
550 ras
.invalid
= ( (unsigned)ey
>= (unsigned)ras
.count_ey
||
551 ex
>= ras
.count_ex
);
555 /*************************************************************************/
557 /* Start a new contour at a given cell. */
560 gray_start_cell( RAS_ARG_ TCoord ex
,
563 if ( ex
> ras
.max_ex
)
564 ex
= (TCoord
)( ras
.max_ex
);
566 if ( ex
< ras
.min_ex
)
567 ex
= (TCoord
)( ras
.min_ex
- 1 );
571 ras
.ex
= ex
- ras
.min_ex
;
572 ras
.ey
= ey
- ras
.min_ey
;
573 ras
.last_ey
= SUBPIXELS( ey
);
576 gray_set_cell( RAS_VAR_ ex
, ey
);
580 /*************************************************************************/
582 /* Render a scanline as one or more cells. */
585 gray_render_scanline( RAS_ARG_ TCoord ey
,
591 TCoord ex1
, ex2
, fx1
, fx2
, delta
, mod
, lift
, rem
;
600 fx1
= (TCoord
)( x1
- SUBPIXELS( ex1
) );
601 fx2
= (TCoord
)( x2
- SUBPIXELS( ex2
) );
603 /* trivial case. Happens often */
606 gray_set_cell( RAS_VAR_ ex2
, ey
);
610 /* everything is located in a single cell. That is easy! */
615 ras
.area
+= (TArea
)(( fx1
+ fx2
) * delta
);
620 /* ok, we'll have to render a run of adjacent cells on the same */
623 p
= ( ONE_PIXEL
- fx1
) * ( y2
- y1
);
629 p
= fx1
* ( y2
- y1
);
635 delta
= (TCoord
)( p
/ dx
);
636 mod
= (TCoord
)( p
% dx
);
643 ras
.area
+= (TArea
)(( fx1
+ first
) * delta
);
647 gray_set_cell( RAS_VAR_ ex1
, ey
);
652 p
= ONE_PIXEL
* ( y2
- y1
+ delta
);
653 lift
= (TCoord
)( p
/ dx
);
654 rem
= (TCoord
)( p
% dx
);
673 ras
.area
+= (TArea
)(ONE_PIXEL
* delta
);
677 gray_set_cell( RAS_VAR_ ex1
, ey
);
682 ras
.area
+= (TArea
)(( fx2
+ ONE_PIXEL
- first
) * delta
);
687 /*************************************************************************/
689 /* Render a given line as a series of scanlines. */
692 gray_render_line( RAS_ARG_ TPos to_x
,
695 TCoord ey1
, ey2
, fy1
, fy2
, mod
;
698 int delta
, rem
, lift
, incr
;
701 ey1
= TRUNC( ras
.last_ey
);
702 ey2
= TRUNC( to_y
); /* if (ey2 >= ras.max_ey) ey2 = ras.max_ey-1; */
703 fy1
= (TCoord
)( ras
.y
- ras
.last_ey
);
704 fy2
= (TCoord
)( to_y
- SUBPIXELS( ey2
) );
709 /* XXX: we should do something about the trivial case where dx == 0, */
710 /* as it happens very often! */
712 /* perform vertical clipping */
724 if ( min
>= ras
.max_ey
|| max
< ras
.min_ey
)
728 /* everything is on a single scanline */
731 gray_render_scanline( RAS_VAR_ ey1
, ras
.x
, fy1
, to_x
, fy2
);
735 /* vertical line - avoid calling gray_render_scanline */
740 TCoord ex
= TRUNC( ras
.x
);
741 TCoord two_fx
= (TCoord
)( ( ras
.x
- SUBPIXELS( ex
) ) << 1 );
752 delta
= (int)( first
- fy1
);
753 ras
.area
+= (TArea
)two_fx
* delta
;
757 gray_set_cell( RAS_VAR_ ex
, ey1
);
759 delta
= (int)( first
+ first
- ONE_PIXEL
);
760 area
= (TArea
)two_fx
* delta
;
767 gray_set_cell( RAS_VAR_ ex
, ey1
);
770 delta
= (int)( fy2
- ONE_PIXEL
+ first
);
771 ras
.area
+= (TArea
)two_fx
* delta
;
777 /* ok, we have to render several scanlines */
778 p
= ( ONE_PIXEL
- fy1
) * dx
;
790 delta
= (int)( p
/ dy
);
791 mod
= (int)( p
% dy
);
799 gray_render_scanline( RAS_VAR_ ey1
, ras
.x
, fy1
, x
, (TCoord
)first
);
802 gray_set_cell( RAS_VAR_
TRUNC( x
), ey1
);
807 lift
= (int)( p
/ dy
);
808 rem
= (int)( p
% dy
);
827 gray_render_scanline( RAS_VAR_ ey1
, x
,
828 (TCoord
)( ONE_PIXEL
- first
), x2
,
833 gray_set_cell( RAS_VAR_
TRUNC( x
), ey1
);
837 gray_render_scanline( RAS_VAR_ ey1
, x
,
838 (TCoord
)( ONE_PIXEL
- first
), to_x
,
844 ras
.last_ey
= SUBPIXELS( ey2
);
849 gray_split_conic( FT_Vector
* base
)
854 base
[4].x
= base
[2].x
;
856 a
= base
[3].x
= ( base
[2].x
+ b
) / 2;
857 b
= base
[1].x
= ( base
[0].x
+ b
) / 2;
858 base
[2].x
= ( a
+ b
) / 2;
860 base
[4].y
= base
[2].y
;
862 a
= base
[3].y
= ( base
[2].y
+ b
) / 2;
863 b
= base
[1].y
= ( base
[0].y
+ b
) / 2;
864 base
[2].y
= ( a
+ b
) / 2;
869 gray_render_conic( RAS_ARG_
const FT_Vector
* control
,
870 const FT_Vector
* to
)
878 dx
= DOWNSCALE( ras
.x
) + to
->x
- ( control
->x
<< 1 );
881 dy
= DOWNSCALE( ras
.y
) + to
->y
- ( control
->y
<< 1 );
888 dx
= dx
/ ras
.conic_level
;
895 /* a shortcut to speed things up */
898 /* we compute the mid-point directly in order to avoid */
899 /* calling gray_split_conic() */
900 TPos to_x
, to_y
, mid_x
, mid_y
;
903 to_x
= UPSCALE( to
->x
);
904 to_y
= UPSCALE( to
->y
);
905 mid_x
= ( ras
.x
+ to_x
+ 2 * UPSCALE( control
->x
) ) / 4;
906 mid_y
= ( ras
.y
+ to_y
+ 2 * UPSCALE( control
->y
) ) / 4;
908 gray_render_line( RAS_VAR_ mid_x
, mid_y
);
909 gray_render_line( RAS_VAR_ to_x
, to_y
);
915 levels
= ras
.lev_stack
;
919 arc
[0].x
= UPSCALE( to
->x
);
920 arc
[0].y
= UPSCALE( to
->y
);
921 arc
[1].x
= UPSCALE( control
->x
);
922 arc
[1].y
= UPSCALE( control
->y
);
931 /* check that the arc crosses the current band */
935 min
= max
= arc
[0].y
;
938 if ( y
< min
) min
= y
;
939 if ( y
> max
) max
= y
;
942 if ( y
< min
) min
= y
;
943 if ( y
> max
) max
= y
;
945 if ( TRUNC( min
) >= ras
.max_ey
|| TRUNC( max
) < ras
.min_ey
)
948 gray_split_conic( arc
);
951 levels
[top
] = levels
[top
- 1] = level
- 1;
957 TPos to_x
, to_y
, mid_x
, mid_y
;
962 mid_x
= ( ras
.x
+ to_x
+ 2 * arc
[1].x
) / 4;
963 mid_y
= ( ras
.y
+ to_y
+ 2 * arc
[1].y
) / 4;
965 gray_render_line( RAS_VAR_ mid_x
, mid_y
);
966 gray_render_line( RAS_VAR_ to_x
, to_y
);
978 gray_split_cubic( FT_Vector
* base
)
983 base
[6].x
= base
[3].x
;
986 base
[1].x
= a
= ( base
[0].x
+ c
) / 2;
987 base
[5].x
= b
= ( base
[3].x
+ d
) / 2;
989 base
[2].x
= a
= ( a
+ c
) / 2;
990 base
[4].x
= b
= ( b
+ c
) / 2;
991 base
[3].x
= ( a
+ b
) / 2;
993 base
[6].y
= base
[3].y
;
996 base
[1].y
= a
= ( base
[0].y
+ c
) / 2;
997 base
[5].y
= b
= ( base
[3].y
+ d
) / 2;
999 base
[2].y
= a
= ( a
+ c
) / 2;
1000 base
[4].y
= b
= ( b
+ c
) / 2;
1001 base
[3].y
= ( a
+ b
) / 2;
1006 gray_render_cubic( RAS_ARG_
const FT_Vector
* control1
,
1007 const FT_Vector
* control2
,
1008 const FT_Vector
* to
)
1010 TPos dx
, dy
, da
, db
;
1016 dx
= DOWNSCALE( ras
.x
) + to
->x
- ( control1
->x
<< 1 );
1019 dy
= DOWNSCALE( ras
.y
) + to
->y
- ( control1
->y
<< 1 );
1026 dx
= DOWNSCALE( ras
.x
) + to
->x
- 3 * ( control1
->x
+ control2
->x
);
1029 dy
= DOWNSCALE( ras
.y
) + to
->y
- 3 * ( control1
->x
+ control2
->y
);
1037 da
= da
/ ras
.cubic_level
;
1038 db
= db
/ ras
.conic_level
;
1039 while ( da
> 0 || db
> 0 )
1048 TPos to_x
, to_y
, mid_x
, mid_y
;
1051 to_x
= UPSCALE( to
->x
);
1052 to_y
= UPSCALE( to
->y
);
1053 mid_x
= ( ras
.x
+ to_x
+
1054 3 * UPSCALE( control1
->x
+ control2
->x
) ) / 8;
1055 mid_y
= ( ras
.y
+ to_y
+
1056 3 * UPSCALE( control1
->y
+ control2
->y
) ) / 8;
1058 gray_render_line( RAS_VAR_ mid_x
, mid_y
);
1059 gray_render_line( RAS_VAR_ to_x
, to_y
);
1063 arc
= ras
.bez_stack
;
1064 arc
[0].x
= UPSCALE( to
->x
);
1065 arc
[0].y
= UPSCALE( to
->y
);
1066 arc
[1].x
= UPSCALE( control2
->x
);
1067 arc
[1].y
= UPSCALE( control2
->y
);
1068 arc
[2].x
= UPSCALE( control1
->x
);
1069 arc
[2].y
= UPSCALE( control1
->y
);
1073 levels
= ras
.lev_stack
;
1079 level
= levels
[top
];
1082 /* check that the arc crosses the current band */
1086 min
= max
= arc
[0].y
;
1088 if ( y
< min
) min
= y
;
1089 if ( y
> max
) max
= y
;
1091 if ( y
< min
) min
= y
;
1092 if ( y
> max
) max
= y
;
1094 if ( y
< min
) min
= y
;
1095 if ( y
> max
) max
= y
;
1096 if ( TRUNC( min
) >= ras
.max_ey
|| TRUNC( max
) < 0 )
1098 gray_split_cubic( arc
);
1101 levels
[top
] = levels
[top
- 1] = level
- 1;
1107 TPos to_x
, to_y
, mid_x
, mid_y
;
1112 mid_x
= ( ras
.x
+ to_x
+ 3 * ( arc
[1].x
+ arc
[2].x
) ) / 8;
1113 mid_y
= ( ras
.y
+ to_y
+ 3 * ( arc
[1].y
+ arc
[2].y
) ) / 8;
1115 gray_render_line( RAS_VAR_ mid_x
, mid_y
);
1116 gray_render_line( RAS_VAR_ to_x
, to_y
);
1128 gray_move_to( const FT_Vector
* to
,
1134 /* record current cell, if any */
1135 gray_record_cell( RAS_VAR
);
1137 /* start to a new position */
1138 x
= UPSCALE( to
->x
);
1139 y
= UPSCALE( to
->y
);
1141 gray_start_cell( RAS_VAR_
TRUNC( x
), TRUNC( y
) );
1150 gray_line_to( const FT_Vector
* to
,
1153 gray_render_line( RAS_VAR_
UPSCALE( to
->x
), UPSCALE( to
->y
) );
1159 gray_conic_to( const FT_Vector
* control
,
1160 const FT_Vector
* to
,
1163 gray_render_conic( RAS_VAR_ control
, to
);
1169 gray_cubic_to( const FT_Vector
* control1
,
1170 const FT_Vector
* control2
,
1171 const FT_Vector
* to
,
1174 gray_render_cubic( RAS_VAR_ control1
, control2
, to
);
1180 gray_render_span( int y
,
1182 const FT_Span
* spans
,
1186 FT_Bitmap
* map
= &worker
->target
;
1189 /* first of all, compute the scanline offset */
1190 p
= (unsigned char*)map
->buffer
- y
* map
->pitch
;
1191 if ( map
->pitch
>= 0 )
1192 p
+= ( map
->rows
- 1 ) * map
->pitch
;
1194 for ( ; count
> 0; count
--, spans
++ )
1196 unsigned char coverage
= spans
->coverage
;
1201 /* For small-spans it is faster to do it by ourselves than
1202 * calling `memset'. This is mainly due to the cost of the
1205 if ( spans
->len
>= 8 )
1206 FT_MEM_SET( p
+ spans
->x
, (unsigned char)coverage
, spans
->len
);
1209 unsigned char* q
= p
+ spans
->x
;
1212 switch ( spans
->len
)
1214 case 7: *q
++ = (unsigned char)coverage
;
1215 case 6: *q
++ = (unsigned char)coverage
;
1216 case 5: *q
++ = (unsigned char)coverage
;
1217 case 4: *q
++ = (unsigned char)coverage
;
1218 case 3: *q
++ = (unsigned char)coverage
;
1219 case 2: *q
++ = (unsigned char)coverage
;
1220 case 1: *q
= (unsigned char)coverage
;
1231 gray_hline( RAS_ARG_ TCoord x
,
1241 /* compute the coverage line's coverage, depending on the */
1242 /* outline fill rule */
1244 /* the coverage percentage is area/(PIXEL_BITS*PIXEL_BITS*2) */
1246 coverage
= (int)( area
>> ( PIXEL_BITS
* 2 + 1 - 8 ) );
1247 /* use range 0..256 */
1249 coverage
= -coverage
;
1251 if ( ras
.outline
.flags
& FT_OUTLINE_EVEN_ODD_FILL
)
1255 if ( coverage
> 256 )
1256 coverage
= 512 - coverage
;
1257 else if ( coverage
== 256 )
1262 /* normal non-zero winding rule */
1263 if ( coverage
>= 256 )
1267 y
+= (TCoord
)ras
.min_ey
;
1268 x
+= (TCoord
)ras
.min_ex
;
1270 /* FT_Span.x is a 16-bit short, so limit our coordinates appropriately */
1274 /* FT_Span.y is an integer, so limit our coordinates appropriately */
1275 if ( y
>= FT_INT_MAX
)
1280 /* see whether we can add this span to the current list */
1281 count
= ras
.num_gray_spans
;
1282 span
= ras
.gray_spans
+ count
- 1;
1285 (int)span
->x
+ span
->len
== (int)x
&&
1286 span
->coverage
== coverage
)
1288 span
->len
= (unsigned short)( span
->len
+ acount
);
1292 if ( ras
.span_y
!= y
|| count
>= FT_MAX_GRAY_SPANS
)
1294 if ( ras
.render_span
&& count
> 0 )
1295 ras
.render_span( ras
.span_y
, count
, ras
.gray_spans
,
1296 ras
.render_span_data
);
1298 #ifdef FT_DEBUG_LEVEL_TRACE
1305 FT_TRACE7(( "y = %3d ", ras
.span_y
));
1306 span
= ras
.gray_spans
;
1307 for ( n
= 0; n
< count
; n
++, span
++ )
1308 FT_TRACE7(( "[%d..%d]:%02x ",
1309 span
->x
, span
->x
+ span
->len
- 1, span
->coverage
));
1310 FT_TRACE7(( "\n" ));
1313 #endif /* FT_DEBUG_LEVEL_TRACE */
1315 ras
.num_gray_spans
= 0;
1316 ras
.span_y
= (int)y
;
1319 span
= ras
.gray_spans
;
1324 /* add a gray span to the current list */
1326 span
->len
= (unsigned short)acount
;
1327 span
->coverage
= (unsigned char)coverage
;
1329 ras
.num_gray_spans
++;
1334 #ifdef FT_DEBUG_LEVEL_TRACE
1336 /* to be called while in the debugger -- */
1337 /* this function causes a compiler warning since it is unused otherwise */
1339 gray_dump_cells( RAS_ARG
)
1344 for ( yindex
= 0; yindex
< ras
.ycount
; yindex
++ )
1349 printf( "%3d:", yindex
);
1351 for ( cell
= ras
.ycells
[yindex
]; cell
!= NULL
; cell
= cell
->next
)
1352 printf( " (%3ld, c:%4ld, a:%6d)", cell
->x
, cell
->cover
, cell
->area
);
1357 #endif /* FT_DEBUG_LEVEL_TRACE */
1361 gray_sweep( RAS_ARG_
const FT_Bitmap
* target
)
1365 FT_UNUSED( target
);
1368 if ( ras
.num_cells
== 0 )
1371 ras
.num_gray_spans
= 0;
1373 FT_TRACE7(( "gray_sweep: start\n" ));
1375 for ( yindex
= 0; yindex
< ras
.ycount
; yindex
++ )
1377 PCell cell
= ras
.ycells
[yindex
];
1382 for ( ; cell
!= NULL
; cell
= cell
->next
)
1387 if ( cell
->x
> x
&& cover
!= 0 )
1388 gray_hline( RAS_VAR_ x
, yindex
, cover
* ( ONE_PIXEL
* 2 ),
1391 cover
+= cell
->cover
;
1392 area
= cover
* ( ONE_PIXEL
* 2 ) - cell
->area
;
1394 if ( area
!= 0 && cell
->x
>= 0 )
1395 gray_hline( RAS_VAR_ cell
->x
, yindex
, area
, 1 );
1401 gray_hline( RAS_VAR_ x
, yindex
, cover
* ( ONE_PIXEL
* 2 ),
1405 if ( ras
.render_span
&& ras
.num_gray_spans
> 0 )
1406 ras
.render_span( ras
.span_y
, ras
.num_gray_spans
,
1407 ras
.gray_spans
, ras
.render_span_data
);
1409 FT_TRACE7(( "gray_sweep: end\n" ));
1415 /*************************************************************************/
1417 /* The following function should only compile in stand-alone mode, */
1418 /* i.e., when building this component without the rest of FreeType. */
1420 /*************************************************************************/
1422 /*************************************************************************/
1425 /* FT_Outline_Decompose */
1428 /* Walk over an outline's structure to decompose it into individual */
1429 /* segments and Bézier arcs. This function is also able to emit */
1430 /* `move to' and `close to' operations to indicate the start and end */
1431 /* of new contours in the outline. */
1434 /* outline :: A pointer to the source target. */
1436 /* func_interface :: A table of `emitters', i.e., function pointers */
1437 /* called during decomposition to indicate path */
1441 /* user :: A typeless pointer which is passed to each */
1442 /* emitter during the decomposition. It can be */
1443 /* used to store the state during the */
1444 /* decomposition. */
1447 /* Error code. 0 means success. */
1450 FT_Outline_Decompose( const FT_Outline
* outline
,
1451 const FT_Outline_Funcs
* func_interface
,
1455 #define SCALED( x ) ( ( (x) << shift ) - delta )
1458 FT_Vector v_control
;
1467 int n
; /* index of contour in outline */
1468 int first
; /* index of first point in contour */
1469 char tag
; /* current point's state */
1475 if ( !outline
|| !func_interface
)
1476 return ErrRaster_Invalid_Argument
;
1478 shift
= func_interface
->shift
;
1479 delta
= func_interface
->delta
;
1482 for ( n
= 0; n
< outline
->n_contours
; n
++ )
1484 int last
; /* index of last point in contour */
1487 FT_TRACE5(( "FT_Outline_Decompose: Outline %d\n", n
));
1489 last
= outline
->contours
[n
];
1491 goto Invalid_Outline
;
1492 limit
= outline
->points
+ last
;
1494 v_start
= outline
->points
[first
];
1495 v_start
.x
= SCALED( v_start
.x
);
1496 v_start
.y
= SCALED( v_start
.y
);
1498 v_last
= outline
->points
[last
];
1499 v_last
.x
= SCALED( v_last
.x
);
1500 v_last
.y
= SCALED( v_last
.y
);
1502 v_control
= v_start
;
1504 point
= outline
->points
+ first
;
1505 tags
= outline
->tags
+ first
;
1506 tag
= FT_CURVE_TAG( tags
[0] );
1508 /* A contour cannot start with a cubic control point! */
1509 if ( tag
== FT_CURVE_TAG_CUBIC
)
1510 goto Invalid_Outline
;
1512 /* check first point to determine origin */
1513 if ( tag
== FT_CURVE_TAG_CONIC
)
1515 /* first point is conic control. Yes, this happens. */
1516 if ( FT_CURVE_TAG( outline
->tags
[last
] ) == FT_CURVE_TAG_ON
)
1518 /* start at last point if it is on the curve */
1524 /* if both first and last points are conic, */
1525 /* start at their middle and record its position */
1527 v_start
.x
= ( v_start
.x
+ v_last
.x
) / 2;
1528 v_start
.y
= ( v_start
.y
+ v_last
.y
) / 2;
1536 FT_TRACE5(( " move to (%.2f, %.2f)\n",
1537 v_start
.x
/ 64.0, v_start
.y
/ 64.0 ));
1538 error
= func_interface
->move_to( &v_start
, user
);
1542 while ( point
< limit
)
1547 tag
= FT_CURVE_TAG( tags
[0] );
1550 case FT_CURVE_TAG_ON
: /* emit a single line_to */
1555 vec
.x
= SCALED( point
->x
);
1556 vec
.y
= SCALED( point
->y
);
1558 FT_TRACE5(( " line to (%.2f, %.2f)\n",
1559 vec
.x
/ 64.0, vec
.y
/ 64.0 ));
1560 error
= func_interface
->line_to( &vec
, user
);
1566 case FT_CURVE_TAG_CONIC
: /* consume conic arcs */
1567 v_control
.x
= SCALED( point
->x
);
1568 v_control
.y
= SCALED( point
->y
);
1571 if ( point
< limit
)
1579 tag
= FT_CURVE_TAG( tags
[0] );
1581 vec
.x
= SCALED( point
->x
);
1582 vec
.y
= SCALED( point
->y
);
1584 if ( tag
== FT_CURVE_TAG_ON
)
1586 FT_TRACE5(( " conic to (%.2f, %.2f)"
1587 " with control (%.2f, %.2f)\n",
1588 vec
.x
/ 64.0, vec
.y
/ 64.0,
1589 v_control
.x
/ 64.0, v_control
.y
/ 64.0 ));
1590 error
= func_interface
->conic_to( &v_control
, &vec
, user
);
1596 if ( tag
!= FT_CURVE_TAG_CONIC
)
1597 goto Invalid_Outline
;
1599 v_middle
.x
= ( v_control
.x
+ vec
.x
) / 2;
1600 v_middle
.y
= ( v_control
.y
+ vec
.y
) / 2;
1602 FT_TRACE5(( " conic to (%.2f, %.2f)"
1603 " with control (%.2f, %.2f)\n",
1604 v_middle
.x
/ 64.0, v_middle
.y
/ 64.0,
1605 v_control
.x
/ 64.0, v_control
.y
/ 64.0 ));
1606 error
= func_interface
->conic_to( &v_control
, &v_middle
, user
);
1614 FT_TRACE5(( " conic to (%.2f, %.2f)"
1615 " with control (%.2f, %.2f)\n",
1616 v_start
.x
/ 64.0, v_start
.y
/ 64.0,
1617 v_control
.x
/ 64.0, v_control
.y
/ 64.0 ));
1618 error
= func_interface
->conic_to( &v_control
, &v_start
, user
);
1621 default: /* FT_CURVE_TAG_CUBIC */
1623 FT_Vector vec1
, vec2
;
1626 if ( point
+ 1 > limit
||
1627 FT_CURVE_TAG( tags
[1] ) != FT_CURVE_TAG_CUBIC
)
1628 goto Invalid_Outline
;
1633 vec1
.x
= SCALED( point
[-2].x
);
1634 vec1
.y
= SCALED( point
[-2].y
);
1636 vec2
.x
= SCALED( point
[-1].x
);
1637 vec2
.y
= SCALED( point
[-1].y
);
1639 if ( point
<= limit
)
1644 vec
.x
= SCALED( point
->x
);
1645 vec
.y
= SCALED( point
->y
);
1647 FT_TRACE5(( " cubic to (%.2f, %.2f)"
1648 " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
1649 vec
.x
/ 64.0, vec
.y
/ 64.0,
1650 vec1
.x
/ 64.0, vec1
.y
/ 64.0,
1651 vec2
.x
/ 64.0, vec2
.y
/ 64.0 ));
1652 error
= func_interface
->cubic_to( &vec1
, &vec2
, &vec
, user
);
1658 FT_TRACE5(( " cubic to (%.2f, %.2f)"
1659 " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
1660 v_start
.x
/ 64.0, v_start
.y
/ 64.0,
1661 vec1
.x
/ 64.0, vec1
.y
/ 64.0,
1662 vec2
.x
/ 64.0, vec2
.y
/ 64.0 ));
1663 error
= func_interface
->cubic_to( &vec1
, &vec2
, &v_start
, user
);
1669 /* close the contour with a line segment */
1670 FT_TRACE5(( " line to (%.2f, %.2f)\n",
1671 v_start
.x
/ 64.0, v_start
.y
/ 64.0 ));
1672 error
= func_interface
->line_to( &v_start
, user
);
1681 FT_TRACE5(( "FT_Outline_Decompose: Done\n", n
));
1685 FT_TRACE5(( "FT_Outline_Decompose: Error %d\n", error
));
1689 return ErrRaster_Invalid_Outline
;
1692 #endif /* _STANDALONE_ */
1695 typedef struct TBand_
1701 FT_DEFINE_OUTLINE_FUNCS(func_interface
,
1702 (FT_Outline_MoveTo_Func
) gray_move_to
,
1703 (FT_Outline_LineTo_Func
) gray_line_to
,
1704 (FT_Outline_ConicTo_Func
)gray_conic_to
,
1705 (FT_Outline_CubicTo_Func
)gray_cubic_to
,
1711 gray_convert_glyph_inner( RAS_ARG
)
1714 volatile int error
= 0;
1716 #ifdef FT_CONFIG_OPTION_PIC
1717 FT_Outline_Funcs func_interface
;
1718 Init_Class_func_interface(&func_interface
);
1721 if ( ft_setjmp( ras
.jump_buffer
) == 0 )
1723 error
= FT_Outline_Decompose( &ras
.outline
, &func_interface
, &ras
);
1724 gray_record_cell( RAS_VAR
);
1727 error
= ErrRaster_Memory_Overflow
;
1734 gray_convert_glyph( RAS_ARG
)
1737 TBand
* volatile band
;
1738 int volatile n
, num_bands
;
1739 TPos
volatile min
, max
, max_y
;
1743 /* Set up state in the raster object */
1744 gray_compute_cbox( RAS_VAR
);
1746 /* clip to target bitmap, exit if nothing to do */
1747 clip
= &ras
.clip_box
;
1749 if ( ras
.max_ex
<= clip
->xMin
|| ras
.min_ex
>= clip
->xMax
||
1750 ras
.max_ey
<= clip
->yMin
|| ras
.min_ey
>= clip
->yMax
)
1753 if ( ras
.min_ex
< clip
->xMin
) ras
.min_ex
= clip
->xMin
;
1754 if ( ras
.min_ey
< clip
->yMin
) ras
.min_ey
= clip
->yMin
;
1756 if ( ras
.max_ex
> clip
->xMax
) ras
.max_ex
= clip
->xMax
;
1757 if ( ras
.max_ey
> clip
->yMax
) ras
.max_ey
= clip
->yMax
;
1759 ras
.count_ex
= ras
.max_ex
- ras
.min_ex
;
1760 ras
.count_ey
= ras
.max_ey
- ras
.min_ey
;
1762 /* simple heuristic used to speed up the bezier decomposition -- see */
1763 /* the code in gray_render_conic() and gray_render_cubic() for more */
1765 ras
.conic_level
= 32;
1766 ras
.cubic_level
= 16;
1772 if ( ras
.count_ex
> 24 || ras
.count_ey
> 24 )
1774 if ( ras
.count_ex
> 120 || ras
.count_ey
> 120 )
1777 ras
.conic_level
<<= level
;
1778 ras
.cubic_level
<<= level
;
1781 /* set up vertical bands */
1782 num_bands
= (int)( ( ras
.max_ey
- ras
.min_ey
) / ras
.band_size
);
1783 if ( num_bands
== 0 )
1785 if ( num_bands
>= 39 )
1793 for ( n
= 0; n
< num_bands
; n
++, min
= max
)
1795 max
= min
+ ras
.band_size
;
1796 if ( n
== num_bands
- 1 || max
> max_y
)
1803 while ( band
>= bands
)
1805 TPos bottom
, top
, middle
;
1811 long cell_start
, cell_end
, cell_mod
;
1814 ras
.ycells
= (PCell
*)ras
.buffer
;
1815 ras
.ycount
= band
->max
- band
->min
;
1817 cell_start
= sizeof ( PCell
) * ras
.ycount
;
1818 cell_mod
= cell_start
% sizeof ( TCell
);
1820 cell_start
+= sizeof ( TCell
) - cell_mod
;
1822 cell_end
= ras
.buffer_size
;
1823 cell_end
-= cell_end
% sizeof( TCell
);
1825 cells_max
= (PCell
)( (char*)ras
.buffer
+ cell_end
);
1826 ras
.cells
= (PCell
)( (char*)ras
.buffer
+ cell_start
);
1827 if ( ras
.cells
>= cells_max
)
1830 ras
.max_cells
= cells_max
- ras
.cells
;
1831 if ( ras
.max_cells
< 2 )
1834 for ( yindex
= 0; yindex
< ras
.ycount
; yindex
++ )
1835 ras
.ycells
[yindex
] = NULL
;
1840 ras
.min_ey
= band
->min
;
1841 ras
.max_ey
= band
->max
;
1842 ras
.count_ey
= band
->max
- band
->min
;
1844 error
= gray_convert_glyph_inner( RAS_VAR
);
1848 gray_sweep( RAS_VAR_
&ras
.target
);
1852 else if ( error
!= ErrRaster_Memory_Overflow
)
1856 /* render pool overflow; we will reduce the render band by half */
1859 middle
= bottom
+ ( ( top
- bottom
) >> 1 );
1861 /* This is too complex for a single scanline; there must */
1862 /* be some problems. */
1863 if ( middle
== bottom
)
1865 #ifdef FT_DEBUG_LEVEL_TRACE
1866 FT_TRACE7(( "gray_convert_glyph: rotten glyph\n" ));
1871 if ( bottom
-top
>= ras
.band_size
)
1874 band
[1].min
= bottom
;
1875 band
[1].max
= middle
;
1876 band
[0].min
= middle
;
1882 if ( ras
.band_shoot
> 8 && ras
.band_size
> 16 )
1883 ras
.band_size
= ras
.band_size
/ 2;
1890 gray_raster_render( PRaster raster
,
1891 const FT_Raster_Params
* params
)
1893 const FT_Outline
* outline
= (const FT_Outline
*)params
->source
;
1894 const FT_Bitmap
* target_map
= params
->target
;
1898 if ( !raster
|| !raster
->buffer
|| !raster
->buffer_size
)
1899 return ErrRaster_Invalid_Argument
;
1902 return ErrRaster_Invalid_Outline
;
1904 /* return immediately if the outline is empty */
1905 if ( outline
->n_points
== 0 || outline
->n_contours
<= 0 )
1908 if ( !outline
->contours
|| !outline
->points
)
1909 return ErrRaster_Invalid_Outline
;
1911 if ( outline
->n_points
!=
1912 outline
->contours
[outline
->n_contours
- 1] + 1 )
1913 return ErrRaster_Invalid_Outline
;
1915 worker
= raster
->worker
;
1917 /* if direct mode is not set, we must have a target bitmap */
1918 if ( !( params
->flags
& FT_RASTER_FLAG_DIRECT
) )
1921 return ErrRaster_Invalid_Argument
;
1924 if ( !target_map
->width
|| !target_map
->rows
)
1927 if ( !target_map
->buffer
)
1928 return ErrRaster_Invalid_Argument
;
1931 /* this version does not support monochrome rendering */
1932 if ( !( params
->flags
& FT_RASTER_FLAG_AA
) )
1933 return ErrRaster_Invalid_Mode
;
1935 /* compute clipping box */
1936 if ( !( params
->flags
& FT_RASTER_FLAG_DIRECT
) )
1938 /* compute clip box from target pixmap */
1939 ras
.clip_box
.xMin
= 0;
1940 ras
.clip_box
.yMin
= 0;
1941 ras
.clip_box
.xMax
= target_map
->width
;
1942 ras
.clip_box
.yMax
= target_map
->rows
;
1944 else if ( params
->flags
& FT_RASTER_FLAG_CLIP
)
1945 ras
.clip_box
= params
->clip_box
;
1948 ras
.clip_box
.xMin
= -32768L;
1949 ras
.clip_box
.yMin
= -32768L;
1950 ras
.clip_box
.xMax
= 32767L;
1951 ras
.clip_box
.yMax
= 32767L;
1954 gray_init_cells( RAS_VAR_ raster
->buffer
, raster
->buffer_size
);
1956 ras
.outline
= *outline
;
1959 ras
.band_size
= raster
->band_size
;
1960 ras
.num_gray_spans
= 0;
1962 if ( params
->flags
& FT_RASTER_FLAG_DIRECT
)
1964 ras
.render_span
= (FT_Raster_Span_Func
)params
->gray_spans
;
1965 ras
.render_span_data
= params
->user
;
1969 ras
.target
= *target_map
;
1970 ras
.render_span
= (FT_Raster_Span_Func
)gray_render_span
;
1971 ras
.render_span_data
= &ras
;
1974 return gray_convert_glyph( RAS_VAR
);
1978 /**** RASTER OBJECT CREATION: In stand-alone mode, we simply use *****/
1979 /**** a static object. *****/
1984 gray_raster_new( void* memory
,
1985 FT_Raster
* araster
)
1987 static TRaster the_raster
;
1989 FT_UNUSED( memory
);
1992 *araster
= (FT_Raster
)&the_raster
;
1993 FT_MEM_ZERO( &the_raster
, sizeof ( the_raster
) );
2000 gray_raster_done( FT_Raster raster
)
2003 FT_UNUSED( raster
);
2006 #else /* _STANDALONE_ */
2009 gray_raster_new( FT_Memory memory
,
2010 FT_Raster
* araster
)
2017 if ( !FT_ALLOC( raster
, sizeof ( TRaster
) ) )
2019 raster
->memory
= memory
;
2020 *araster
= (FT_Raster
)raster
;
2028 gray_raster_done( FT_Raster raster
)
2030 FT_Memory memory
= (FT_Memory
)((PRaster
)raster
)->memory
;
2036 #endif /* _STANDALONE_ */
2040 gray_raster_reset( FT_Raster raster
,
2044 PRaster rast
= (PRaster
)raster
;
2049 if ( pool_base
&& pool_size
>= (long)sizeof ( TWorker
) + 2048 )
2051 PWorker worker
= (PWorker
)pool_base
;
2054 rast
->worker
= worker
;
2055 rast
->buffer
= pool_base
+
2056 ( ( sizeof ( TWorker
) + sizeof ( TCell
) - 1 ) &
2057 ~( sizeof ( TCell
) - 1 ) );
2058 rast
->buffer_size
= (long)( ( pool_base
+ pool_size
) -
2059 (char*)rast
->buffer
) &
2060 ~( sizeof ( TCell
) - 1 );
2061 rast
->band_size
= (int)( rast
->buffer_size
/
2062 ( sizeof ( TCell
) * 8 ) );
2066 rast
->buffer
= NULL
;
2067 rast
->buffer_size
= 0;
2068 rast
->worker
= NULL
;
2074 FT_DEFINE_RASTER_FUNCS(ft_grays_raster
,
2075 FT_GLYPH_FORMAT_OUTLINE
,
2077 (FT_Raster_New_Func
) gray_raster_new
,
2078 (FT_Raster_Reset_Func
) gray_raster_reset
,
2079 (FT_Raster_Set_Mode_Func
)0,
2080 (FT_Raster_Render_Func
) gray_raster_render
,
2081 (FT_Raster_Done_Func
) gray_raster_done
2088 /* Local Variables: */