1 /***************************************************************************/
5 /* A new `perfect' anti-aliasing renderer (body). */
7 /* Copyright 2000-2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010 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
110 #define FT_UINT_MAX UINT_MAX
111 #define FT_INT_MAX INT_MAX
113 #define ft_memset memset
115 #define ft_setjmp setjmp
116 #define ft_longjmp longjmp
117 #define ft_jmp_buf jmp_buf
119 typedef ptrdiff_t FT_PtrDist
;
122 #define ErrRaster_Invalid_Mode -2
123 #define ErrRaster_Invalid_Outline -1
124 #define ErrRaster_Invalid_Argument -3
125 #define ErrRaster_Memory_Overflow -4
127 #define FT_BEGIN_HEADER
128 #define FT_END_HEADER
134 /* This macro is used to indicate that a function parameter is unused. */
135 /* Its purpose is simply to reduce compiler warnings. Note also that */
136 /* simply defining it as `(void)x' doesn't avoid warnings with certain */
137 /* ANSI compilers (e.g. LCC). */
138 #define FT_UNUSED( x ) (x) = (x)
141 /* we only use level 5 & 7 tracing messages; cf. ftdebug.h */
143 #ifdef FT_DEBUG_LEVEL_TRACE
146 FT_Message( const char* fmt
,
153 vfprintf( stderr
, fmt
, ap
);
157 /* we don't handle tracing levels in stand-alone mode; */
159 #define FT_TRACE5( varformat ) FT_Message varformat
162 #define FT_TRACE7( varformat ) FT_Message varformat
165 #define FT_ERROR( varformat ) FT_Message varformat
168 #else /* !FT_DEBUG_LEVEL_TRACE */
170 #define FT_TRACE5( x ) do { } while ( 0 ) /* nothing */
171 #define FT_TRACE7( x ) do { } while ( 0 ) /* nothing */
172 #define FT_ERROR( x ) do { } while ( 0 ) /* nothing */
174 #endif /* !FT_DEBUG_LEVEL_TRACE */
177 #define FT_DEFINE_OUTLINE_FUNCS( class_, \
178 move_to_, line_to_, \
179 conic_to_, cubic_to_, \
181 static const FT_Outline_Funcs class_ = \
191 #define FT_DEFINE_RASTER_FUNCS( class_, glyph_format_, \
192 raster_new_, raster_reset_, \
193 raster_set_mode_, raster_render_, \
195 const FT_Raster_Funcs class_ = \
205 #else /* !_STANDALONE_ */
208 #include <ft2build.h>
210 #include FT_INTERNAL_OBJECTS_H
211 #include FT_INTERNAL_DEBUG_H
212 #include FT_OUTLINE_H
214 #include "ftsmerrs.h"
218 #define ErrRaster_Invalid_Mode Smooth_Err_Cannot_Render_Glyph
219 #define ErrRaster_Invalid_Outline Smooth_Err_Invalid_Outline
220 #define ErrRaster_Memory_Overflow Smooth_Err_Out_Of_Memory
221 #define ErrRaster_Invalid_Argument Smooth_Err_Invalid_Argument
223 #endif /* !_STANDALONE_ */
226 #define FT_MEM_SET( d, s, c ) ft_memset( d, s, c )
230 #define FT_MEM_ZERO( dest, count ) FT_MEM_SET( dest, 0, count )
233 /* as usual, for the speed hungry :-) */
235 #ifndef FT_STATIC_RASTER
237 #define RAS_ARG PWorker worker
238 #define RAS_ARG_ PWorker worker,
240 #define RAS_VAR worker
241 #define RAS_VAR_ worker,
243 #else /* FT_STATIC_RASTER */
245 #define RAS_ARG /* empty */
246 #define RAS_ARG_ /* empty */
247 #define RAS_VAR /* empty */
248 #define RAS_VAR_ /* empty */
250 #endif /* FT_STATIC_RASTER */
253 /* must be at least 6 bits! */
256 #define ONE_PIXEL ( 1L << PIXEL_BITS )
257 #define PIXEL_MASK ( -1L << PIXEL_BITS )
258 #define TRUNC( x ) ( (TCoord)( (x) >> PIXEL_BITS ) )
259 #define SUBPIXELS( x ) ( (TPos)(x) << PIXEL_BITS )
260 #define FLOOR( x ) ( (x) & -ONE_PIXEL )
261 #define CEILING( x ) ( ( (x) + ONE_PIXEL - 1 ) & -ONE_PIXEL )
262 #define ROUND( x ) ( ( (x) + ONE_PIXEL / 2 ) & -ONE_PIXEL )
265 #define UPSCALE( x ) ( (x) << ( PIXEL_BITS - 6 ) )
266 #define DOWNSCALE( x ) ( (x) >> ( PIXEL_BITS - 6 ) )
268 #define UPSCALE( x ) ( (x) >> ( 6 - PIXEL_BITS ) )
269 #define DOWNSCALE( x ) ( (x) << ( 6 - PIXEL_BITS ) )
273 /*************************************************************************/
275 /* TYPE DEFINITIONS */
278 /* don't change the following types to FT_Int or FT_Pos, since we might */
279 /* need to define them to "float" or "double" when experimenting with */
282 typedef long TCoord
; /* integer scanline/pixel coordinate */
283 typedef long TPos
; /* sub-pixel coordinate */
285 /* determine the type used to store cell areas. This normally takes at */
286 /* least PIXEL_BITS*2 + 1 bits. On 16-bit systems, we need to use */
287 /* `long' instead of `int', otherwise bad things happen */
293 #else /* PIXEL_BITS >= 8 */
295 /* approximately determine the size of integers using an ANSI-C header */
296 #if FT_UINT_MAX == 0xFFFFU
302 #endif /* PIXEL_BITS >= 8 */
305 /* maximal number of gray spans in a call to the span callback */
306 #define FT_MAX_GRAY_SPANS 32
309 typedef struct TCell_
* PCell
;
311 typedef struct TCell_
313 TPos x
; /* same with TWorker.ex */
314 TCoord cover
; /* same with TWorker.cover */
321 typedef struct TWorker_
326 TPos count_ex
, count_ey
;
333 FT_PtrDist max_cells
;
334 FT_PtrDist num_cells
;
341 FT_Vector bez_stack
[32 * 3 + 1];
348 FT_Span gray_spans
[FT_MAX_GRAY_SPANS
];
351 FT_Raster_Span_Func render_span
;
352 void* render_span_data
;
358 ft_jmp_buf jump_buffer
;
369 #ifndef FT_STATIC_RASTER
370 #define ras (*worker)
376 typedef struct TRaster_
388 /*************************************************************************/
390 /* Initialize the cells table. */
393 gray_init_cells( RAS_ARG_
void* buffer
,
397 ras
.buffer_size
= byte_size
;
399 ras
.ycells
= (PCell
*) buffer
;
409 /*************************************************************************/
411 /* Compute the outline bounding box. */
414 gray_compute_cbox( RAS_ARG
)
416 FT_Outline
* outline
= &ras
.outline
;
417 FT_Vector
* vec
= outline
->points
;
418 FT_Vector
* limit
= vec
+ outline
->n_points
;
421 if ( outline
->n_points
<= 0 )
423 ras
.min_ex
= ras
.max_ex
= 0;
424 ras
.min_ey
= ras
.max_ey
= 0;
428 ras
.min_ex
= ras
.max_ex
= vec
->x
;
429 ras
.min_ey
= ras
.max_ey
= vec
->y
;
433 for ( ; vec
< limit
; vec
++ )
439 if ( x
< ras
.min_ex
) ras
.min_ex
= x
;
440 if ( x
> ras
.max_ex
) ras
.max_ex
= x
;
441 if ( y
< ras
.min_ey
) ras
.min_ey
= y
;
442 if ( y
> ras
.max_ey
) ras
.max_ey
= y
;
445 /* truncate the bounding box to integer pixels */
446 ras
.min_ex
= ras
.min_ex
>> 6;
447 ras
.min_ey
= ras
.min_ey
>> 6;
448 ras
.max_ex
= ( ras
.max_ex
+ 63 ) >> 6;
449 ras
.max_ey
= ( ras
.max_ey
+ 63 ) >> 6;
453 /*************************************************************************/
455 /* Record the current cell in the table. */
458 gray_find_cell( RAS_ARG
)
464 if ( x
> ras
.count_ex
)
467 pcell
= &ras
.ycells
[ras
.ey
];
471 if ( cell
== NULL
|| cell
->x
> x
)
480 if ( ras
.num_cells
>= ras
.max_cells
)
481 ft_longjmp( ras
.jump_buffer
, 1 );
483 cell
= ras
.cells
+ ras
.num_cells
++;
497 gray_record_cell( RAS_ARG
)
499 if ( !ras
.invalid
&& ( ras
.area
| ras
.cover
) )
501 PCell cell
= gray_find_cell( RAS_VAR
);
504 cell
->area
+= ras
.area
;
505 cell
->cover
+= ras
.cover
;
510 /*************************************************************************/
512 /* Set the current cell to a new position. */
515 gray_set_cell( RAS_ARG_ TCoord ex
,
518 /* Move the cell pointer to a new position. We set the `invalid' */
519 /* flag to indicate that the cell isn't part of those we're interested */
520 /* in during the render phase. This means that: */
522 /* . the new vertical position must be within min_ey..max_ey-1. */
523 /* . the new horizontal position must be strictly less than max_ex */
525 /* Note that if a cell is to the left of the clipping region, it is */
526 /* actually set to the (min_ex-1) horizontal position. */
528 /* All cells that are on the left of the clipping region go to the */
529 /* min_ex - 1 horizontal position. */
532 if ( ex
> ras
.max_ex
)
539 /* are we moving to a different cell ? */
540 if ( ex
!= ras
.ex
|| ey
!= ras
.ey
)
542 /* record the current one if it is valid */
544 gray_record_cell( RAS_VAR
);
552 ras
.invalid
= ( (unsigned)ey
>= (unsigned)ras
.count_ey
||
553 ex
>= ras
.count_ex
);
557 /*************************************************************************/
559 /* Start a new contour at a given cell. */
562 gray_start_cell( RAS_ARG_ TCoord ex
,
565 if ( ex
> ras
.max_ex
)
566 ex
= (TCoord
)( ras
.max_ex
);
568 if ( ex
< ras
.min_ex
)
569 ex
= (TCoord
)( ras
.min_ex
- 1 );
573 ras
.ex
= ex
- ras
.min_ex
;
574 ras
.ey
= ey
- ras
.min_ey
;
575 ras
.last_ey
= SUBPIXELS( ey
);
578 gray_set_cell( RAS_VAR_ ex
, ey
);
582 /*************************************************************************/
584 /* Render a scanline as one or more cells. */
587 gray_render_scanline( RAS_ARG_ TCoord ey
,
593 TCoord ex1
, ex2
, fx1
, fx2
, delta
, mod
, lift
, rem
;
602 fx1
= (TCoord
)( x1
- SUBPIXELS( ex1
) );
603 fx2
= (TCoord
)( x2
- SUBPIXELS( ex2
) );
605 /* trivial case. Happens often */
608 gray_set_cell( RAS_VAR_ ex2
, ey
);
612 /* everything is located in a single cell. That is easy! */
617 ras
.area
+= (TArea
)(( fx1
+ fx2
) * delta
);
622 /* ok, we'll have to render a run of adjacent cells on the same */
625 p
= ( ONE_PIXEL
- fx1
) * ( y2
- y1
);
631 p
= fx1
* ( y2
- y1
);
637 delta
= (TCoord
)( p
/ dx
);
638 mod
= (TCoord
)( p
% dx
);
645 ras
.area
+= (TArea
)(( fx1
+ first
) * delta
);
649 gray_set_cell( RAS_VAR_ ex1
, ey
);
654 p
= ONE_PIXEL
* ( y2
- y1
+ delta
);
655 lift
= (TCoord
)( p
/ dx
);
656 rem
= (TCoord
)( p
% dx
);
675 ras
.area
+= (TArea
)(ONE_PIXEL
* delta
);
679 gray_set_cell( RAS_VAR_ ex1
, ey
);
684 ras
.area
+= (TArea
)(( fx2
+ ONE_PIXEL
- first
) * delta
);
689 /*************************************************************************/
691 /* Render a given line as a series of scanlines. */
694 gray_render_line( RAS_ARG_ TPos to_x
,
697 TCoord ey1
, ey2
, fy1
, fy2
, mod
;
700 int delta
, rem
, lift
, incr
;
703 ey1
= TRUNC( ras
.last_ey
);
704 ey2
= TRUNC( to_y
); /* if (ey2 >= ras.max_ey) ey2 = ras.max_ey-1; */
705 fy1
= (TCoord
)( ras
.y
- ras
.last_ey
);
706 fy2
= (TCoord
)( to_y
- SUBPIXELS( ey2
) );
711 /* XXX: we should do something about the trivial case where dx == 0, */
712 /* as it happens very often! */
714 /* perform vertical clipping */
726 if ( min
>= ras
.max_ey
|| max
< ras
.min_ey
)
730 /* everything is on a single scanline */
733 gray_render_scanline( RAS_VAR_ ey1
, ras
.x
, fy1
, to_x
, fy2
);
737 /* vertical line - avoid calling gray_render_scanline */
742 TCoord ex
= TRUNC( ras
.x
);
743 TCoord two_fx
= (TCoord
)( ( ras
.x
- SUBPIXELS( ex
) ) << 1 );
754 delta
= (int)( first
- fy1
);
755 ras
.area
+= (TArea
)two_fx
* delta
;
759 gray_set_cell( RAS_VAR_ ex
, ey1
);
761 delta
= (int)( first
+ first
- ONE_PIXEL
);
762 area
= (TArea
)two_fx
* delta
;
769 gray_set_cell( RAS_VAR_ ex
, ey1
);
772 delta
= (int)( fy2
- ONE_PIXEL
+ first
);
773 ras
.area
+= (TArea
)two_fx
* delta
;
779 /* ok, we have to render several scanlines */
780 p
= ( ONE_PIXEL
- fy1
) * dx
;
792 delta
= (int)( p
/ dy
);
793 mod
= (int)( p
% dy
);
801 gray_render_scanline( RAS_VAR_ ey1
, ras
.x
, fy1
, x
, (TCoord
)first
);
804 gray_set_cell( RAS_VAR_
TRUNC( x
), ey1
);
809 lift
= (int)( p
/ dy
);
810 rem
= (int)( p
% dy
);
829 gray_render_scanline( RAS_VAR_ ey1
, x
,
830 (TCoord
)( ONE_PIXEL
- first
), x2
,
835 gray_set_cell( RAS_VAR_
TRUNC( x
), ey1
);
839 gray_render_scanline( RAS_VAR_ ey1
, x
,
840 (TCoord
)( ONE_PIXEL
- first
), to_x
,
846 ras
.last_ey
= SUBPIXELS( ey2
);
851 gray_split_conic( FT_Vector
* base
)
856 base
[4].x
= base
[2].x
;
858 a
= base
[3].x
= ( base
[2].x
+ b
) / 2;
859 b
= base
[1].x
= ( base
[0].x
+ b
) / 2;
860 base
[2].x
= ( a
+ b
) / 2;
862 base
[4].y
= base
[2].y
;
864 a
= base
[3].y
= ( base
[2].y
+ b
) / 2;
865 b
= base
[1].y
= ( base
[0].y
+ b
) / 2;
866 base
[2].y
= ( a
+ b
) / 2;
871 gray_render_conic( RAS_ARG_
const FT_Vector
* control
,
872 const FT_Vector
* to
)
881 arc
[0].x
= UPSCALE( to
->x
);
882 arc
[0].y
= UPSCALE( to
->y
);
883 arc
[1].x
= UPSCALE( control
->x
);
884 arc
[1].y
= UPSCALE( control
->y
);
888 dx
= FT_ABS( arc
[2].x
+ arc
[0].x
- 2 * arc
[1].x
);
889 dy
= FT_ABS( arc
[2].y
+ arc
[0].y
- 2 * arc
[1].y
);
893 if ( dx
<= ONE_PIXEL
/ 4 )
895 gray_render_line( RAS_VAR_ arc
[0].x
, arc
[0].y
);
900 while ( dx
> ONE_PIXEL
/ 4 )
906 levels
= ras
.lev_stack
;
915 /* check that the arc crosses the current band */
919 min
= max
= arc
[0].y
;
922 if ( y
< min
) min
= y
;
923 if ( y
> max
) max
= y
;
926 if ( y
< min
) min
= y
;
927 if ( y
> max
) max
= y
;
929 if ( TRUNC( min
) >= ras
.max_ey
|| TRUNC( max
) < ras
.min_ey
)
932 gray_split_conic( arc
);
935 levels
[top
] = levels
[top
- 1] = level
- 1;
940 gray_render_line( RAS_VAR_ arc
[0].x
, arc
[0].y
);
950 gray_split_cubic( FT_Vector
* base
)
955 base
[6].x
= base
[3].x
;
958 base
[1].x
= a
= ( base
[0].x
+ c
) / 2;
959 base
[5].x
= b
= ( base
[3].x
+ d
) / 2;
961 base
[2].x
= a
= ( a
+ c
) / 2;
962 base
[4].x
= b
= ( b
+ c
) / 2;
963 base
[3].x
= ( a
+ b
) / 2;
965 base
[6].y
= base
[3].y
;
968 base
[1].y
= a
= ( base
[0].y
+ c
) / 2;
969 base
[5].y
= b
= ( base
[3].y
+ d
) / 2;
971 base
[2].y
= a
= ( a
+ c
) / 2;
972 base
[4].y
= b
= ( b
+ c
) / 2;
973 base
[3].y
= ( a
+ b
) / 2;
978 gray_render_cubic( RAS_ARG_
const FT_Vector
* control1
,
979 const FT_Vector
* control2
,
980 const FT_Vector
* to
)
986 arc
[0].x
= UPSCALE( to
->x
);
987 arc
[0].y
= UPSCALE( to
->y
);
988 arc
[1].x
= UPSCALE( control2
->x
);
989 arc
[1].y
= UPSCALE( control2
->y
);
990 arc
[2].x
= UPSCALE( control1
->x
);
991 arc
[2].y
= UPSCALE( control1
->y
);
997 /* Check that the arc crosses the current band. */
1001 min
= max
= arc
[0].y
;
1021 if ( TRUNC( min
) >= ras
.max_ey
|| TRUNC( max
) < ras
.min_ey
)
1024 /* Decide whether to split or draw. See `Rapid Termination */
1025 /* Evaluation for Recursive Subdivision of Bezier Curves' by Thomas */
1027 /* http://www.cis.southalabama.edu/~hain/general/Publications/Bezier/Camera-ready%20CISST02%202.pdf */
1030 TPos dx
, dy
, dx_
, dy_
;
1031 TPos dx1
, dy1
, dx2
, dy2
;
1035 /* dx and dy are x and y components of the P0-P3 chord vector. */
1036 dx
= arc
[3].x
- arc
[0].x
;
1037 dy
= arc
[3].y
- arc
[0].y
;
1039 /* L is an (under)estimate of the Euclidean distance P0-P3. */
1041 /* If dx >= dy, then r = sqrt(dx^2 + dy^2) can be overestimated */
1042 /* with least maximum error by */
1044 /* r_upperbound = dx + (sqrt(2) - 1) * dy , */
1046 /* where sqrt(2) - 1 can be (over)estimated by 107/256, giving an */
1047 /* error of no more than 8.4%. */
1049 /* Similarly, some elementary calculus shows that r can be */
1050 /* underestimated with least maximum error by */
1052 /* r_lowerbound = sqrt(2 + sqrt(2)) / 2 * dx */
1053 /* + sqrt(2 - sqrt(2)) / 2 * dy . */
1055 /* 236/256 and 97/256 are (under)estimates of the two algebraic */
1056 /* numbers, giving an error of no more than 8.1%. */
1061 /* This is the same as */
1063 /* L = ( 236 * FT_MAX( dx_, dy_ ) */
1064 /* + 97 * FT_MIN( dx_, dy_ ) ) >> 8; */
1065 L
= ( dx_
> dy_
? 236 * dx_
+ 97 * dy_
1066 : 97 * dx_
+ 236 * dy_
) >> 8;
1068 /* Avoid possible arithmetic overflow below by splitting. */
1072 /* Max deviation may be as much as (s/L) * 3/4 (if Hain's v = 1). */
1073 s_limit
= L
* (TPos
)( ONE_PIXEL
/ 6 );
1075 /* s is L * the perpendicular distance from P1 to the line P0-P3. */
1076 dx1
= arc
[1].x
- arc
[0].x
;
1077 dy1
= arc
[1].y
- arc
[0].y
;
1078 s
= FT_ABS( dy
* dx1
- dx
* dy1
);
1083 /* s is L * the perpendicular distance from P2 to the line P0-P3. */
1084 dx2
= arc
[2].x
- arc
[0].x
;
1085 dy2
= arc
[2].y
- arc
[0].y
;
1086 s
= FT_ABS( dy
* dx2
- dx
* dy2
);
1091 /* If P1 or P2 is outside P0-P3, split the curve. */
1092 if ( dy
* dy1
+ dx
* dx1
< 0 ||
1093 dy
* dy2
+ dx
* dx2
< 0 ||
1094 dy
* (arc
[3].y
- arc
[1].y
) + dx
* (arc
[3].x
- arc
[1].x
) < 0 ||
1095 dy
* (arc
[3].y
- arc
[2].y
) + dx
* (arc
[3].x
- arc
[2].x
) < 0 )
1098 /* No reason to split. */
1103 gray_split_cubic( arc
);
1108 gray_render_line( RAS_VAR_ arc
[0].x
, arc
[0].y
);
1110 if ( arc
== ras
.bez_stack
)
1119 gray_move_to( const FT_Vector
* to
,
1125 /* record current cell, if any */
1126 gray_record_cell( RAS_VAR
);
1128 /* start to a new position */
1129 x
= UPSCALE( to
->x
);
1130 y
= UPSCALE( to
->y
);
1132 gray_start_cell( RAS_VAR_
TRUNC( x
), TRUNC( y
) );
1141 gray_line_to( const FT_Vector
* to
,
1144 gray_render_line( RAS_VAR_
UPSCALE( to
->x
), UPSCALE( to
->y
) );
1150 gray_conic_to( const FT_Vector
* control
,
1151 const FT_Vector
* to
,
1154 gray_render_conic( RAS_VAR_ control
, to
);
1160 gray_cubic_to( const FT_Vector
* control1
,
1161 const FT_Vector
* control2
,
1162 const FT_Vector
* to
,
1165 gray_render_cubic( RAS_VAR_ control1
, control2
, to
);
1171 gray_render_span( int y
,
1173 const FT_Span
* spans
,
1177 FT_Bitmap
* map
= &worker
->target
;
1180 /* first of all, compute the scanline offset */
1181 p
= (unsigned char*)map
->buffer
- y
* map
->pitch
;
1182 if ( map
->pitch
>= 0 )
1183 p
+= (unsigned)( ( map
->rows
- 1 ) * map
->pitch
);
1185 for ( ; count
> 0; count
--, spans
++ )
1187 unsigned char coverage
= spans
->coverage
;
1192 /* For small-spans it is faster to do it by ourselves than
1193 * calling `memset'. This is mainly due to the cost of the
1196 if ( spans
->len
>= 8 )
1197 FT_MEM_SET( p
+ spans
->x
, (unsigned char)coverage
, spans
->len
);
1200 unsigned char* q
= p
+ spans
->x
;
1203 switch ( spans
->len
)
1205 case 7: *q
++ = (unsigned char)coverage
;
1206 case 6: *q
++ = (unsigned char)coverage
;
1207 case 5: *q
++ = (unsigned char)coverage
;
1208 case 4: *q
++ = (unsigned char)coverage
;
1209 case 3: *q
++ = (unsigned char)coverage
;
1210 case 2: *q
++ = (unsigned char)coverage
;
1211 case 1: *q
= (unsigned char)coverage
;
1222 gray_hline( RAS_ARG_ TCoord x
,
1232 /* compute the coverage line's coverage, depending on the */
1233 /* outline fill rule */
1235 /* the coverage percentage is area/(PIXEL_BITS*PIXEL_BITS*2) */
1237 coverage
= (int)( area
>> ( PIXEL_BITS
* 2 + 1 - 8 ) );
1238 /* use range 0..256 */
1240 coverage
= -coverage
;
1242 if ( ras
.outline
.flags
& FT_OUTLINE_EVEN_ODD_FILL
)
1246 if ( coverage
> 256 )
1247 coverage
= 512 - coverage
;
1248 else if ( coverage
== 256 )
1253 /* normal non-zero winding rule */
1254 if ( coverage
>= 256 )
1258 y
+= (TCoord
)ras
.min_ey
;
1259 x
+= (TCoord
)ras
.min_ex
;
1261 /* FT_Span.x is a 16-bit short, so limit our coordinates appropriately */
1265 /* FT_Span.y is an integer, so limit our coordinates appropriately */
1266 if ( y
>= FT_INT_MAX
)
1271 /* see whether we can add this span to the current list */
1272 count
= ras
.num_gray_spans
;
1273 span
= ras
.gray_spans
+ count
- 1;
1276 (int)span
->x
+ span
->len
== (int)x
&&
1277 span
->coverage
== coverage
)
1279 span
->len
= (unsigned short)( span
->len
+ acount
);
1283 if ( ras
.span_y
!= y
|| count
>= FT_MAX_GRAY_SPANS
)
1285 if ( ras
.render_span
&& count
> 0 )
1286 ras
.render_span( ras
.span_y
, count
, ras
.gray_spans
,
1287 ras
.render_span_data
);
1289 #ifdef FT_DEBUG_LEVEL_TRACE
1296 FT_TRACE7(( "y = %3d ", ras
.span_y
));
1297 span
= ras
.gray_spans
;
1298 for ( n
= 0; n
< count
; n
++, span
++ )
1299 FT_TRACE7(( "[%d..%d]:%02x ",
1300 span
->x
, span
->x
+ span
->len
- 1, span
->coverage
));
1301 FT_TRACE7(( "\n" ));
1304 #endif /* FT_DEBUG_LEVEL_TRACE */
1306 ras
.num_gray_spans
= 0;
1307 ras
.span_y
= (int)y
;
1310 span
= ras
.gray_spans
;
1315 /* add a gray span to the current list */
1317 span
->len
= (unsigned short)acount
;
1318 span
->coverage
= (unsigned char)coverage
;
1320 ras
.num_gray_spans
++;
1325 #ifdef FT_DEBUG_LEVEL_TRACE
1327 /* to be called while in the debugger -- */
1328 /* this function causes a compiler warning since it is unused otherwise */
1330 gray_dump_cells( RAS_ARG
)
1335 for ( yindex
= 0; yindex
< ras
.ycount
; yindex
++ )
1340 printf( "%3d:", yindex
);
1342 for ( cell
= ras
.ycells
[yindex
]; cell
!= NULL
; cell
= cell
->next
)
1343 printf( " (%3ld, c:%4ld, a:%6d)", cell
->x
, cell
->cover
, cell
->area
);
1348 #endif /* FT_DEBUG_LEVEL_TRACE */
1352 gray_sweep( RAS_ARG_
const FT_Bitmap
* target
)
1356 FT_UNUSED( target
);
1359 if ( ras
.num_cells
== 0 )
1362 ras
.num_gray_spans
= 0;
1364 FT_TRACE7(( "gray_sweep: start\n" ));
1366 for ( yindex
= 0; yindex
< ras
.ycount
; yindex
++ )
1368 PCell cell
= ras
.ycells
[yindex
];
1373 for ( ; cell
!= NULL
; cell
= cell
->next
)
1378 if ( cell
->x
> x
&& cover
!= 0 )
1379 gray_hline( RAS_VAR_ x
, yindex
, cover
* ( ONE_PIXEL
* 2 ),
1382 cover
+= cell
->cover
;
1383 area
= cover
* ( ONE_PIXEL
* 2 ) - cell
->area
;
1385 if ( area
!= 0 && cell
->x
>= 0 )
1386 gray_hline( RAS_VAR_ cell
->x
, yindex
, area
, 1 );
1392 gray_hline( RAS_VAR_ x
, yindex
, cover
* ( ONE_PIXEL
* 2 ),
1396 if ( ras
.render_span
&& ras
.num_gray_spans
> 0 )
1397 ras
.render_span( ras
.span_y
, ras
.num_gray_spans
,
1398 ras
.gray_spans
, ras
.render_span_data
);
1400 FT_TRACE7(( "gray_sweep: end\n" ));
1406 /*************************************************************************/
1408 /* The following function should only compile in stand-alone mode, */
1409 /* i.e., when building this component without the rest of FreeType. */
1411 /*************************************************************************/
1413 /*************************************************************************/
1416 /* FT_Outline_Decompose */
1419 /* Walk over an outline's structure to decompose it into individual */
1420 /* segments and Bézier arcs. This function is also able to emit */
1421 /* `move to' and `close to' operations to indicate the start and end */
1422 /* of new contours in the outline. */
1425 /* outline :: A pointer to the source target. */
1427 /* func_interface :: A table of `emitters', i.e., function pointers */
1428 /* called during decomposition to indicate path */
1432 /* user :: A typeless pointer which is passed to each */
1433 /* emitter during the decomposition. It can be */
1434 /* used to store the state during the */
1435 /* decomposition. */
1438 /* Error code. 0 means success. */
1441 FT_Outline_Decompose( const FT_Outline
* outline
,
1442 const FT_Outline_Funcs
* func_interface
,
1446 #define SCALED( x ) ( ( (x) << shift ) - delta )
1449 FT_Vector v_control
;
1458 int n
; /* index of contour in outline */
1459 int first
; /* index of first point in contour */
1460 char tag
; /* current point's state */
1466 if ( !outline
|| !func_interface
)
1467 return ErrRaster_Invalid_Argument
;
1469 shift
= func_interface
->shift
;
1470 delta
= func_interface
->delta
;
1473 for ( n
= 0; n
< outline
->n_contours
; n
++ )
1475 int last
; /* index of last point in contour */
1478 FT_TRACE5(( "FT_Outline_Decompose: Outline %d\n", n
));
1480 last
= outline
->contours
[n
];
1482 goto Invalid_Outline
;
1483 limit
= outline
->points
+ last
;
1485 v_start
= outline
->points
[first
];
1486 v_start
.x
= SCALED( v_start
.x
);
1487 v_start
.y
= SCALED( v_start
.y
);
1489 v_last
= outline
->points
[last
];
1490 v_last
.x
= SCALED( v_last
.x
);
1491 v_last
.y
= SCALED( v_last
.y
);
1493 v_control
= v_start
;
1495 point
= outline
->points
+ first
;
1496 tags
= outline
->tags
+ first
;
1497 tag
= FT_CURVE_TAG( tags
[0] );
1499 /* A contour cannot start with a cubic control point! */
1500 if ( tag
== FT_CURVE_TAG_CUBIC
)
1501 goto Invalid_Outline
;
1503 /* check first point to determine origin */
1504 if ( tag
== FT_CURVE_TAG_CONIC
)
1506 /* first point is conic control. Yes, this happens. */
1507 if ( FT_CURVE_TAG( outline
->tags
[last
] ) == FT_CURVE_TAG_ON
)
1509 /* start at last point if it is on the curve */
1515 /* if both first and last points are conic, */
1516 /* start at their middle and record its position */
1518 v_start
.x
= ( v_start
.x
+ v_last
.x
) / 2;
1519 v_start
.y
= ( v_start
.y
+ v_last
.y
) / 2;
1527 FT_TRACE5(( " move to (%.2f, %.2f)\n",
1528 v_start
.x
/ 64.0, v_start
.y
/ 64.0 ));
1529 error
= func_interface
->move_to( &v_start
, user
);
1533 while ( point
< limit
)
1538 tag
= FT_CURVE_TAG( tags
[0] );
1541 case FT_CURVE_TAG_ON
: /* emit a single line_to */
1546 vec
.x
= SCALED( point
->x
);
1547 vec
.y
= SCALED( point
->y
);
1549 FT_TRACE5(( " line to (%.2f, %.2f)\n",
1550 vec
.x
/ 64.0, vec
.y
/ 64.0 ));
1551 error
= func_interface
->line_to( &vec
, user
);
1557 case FT_CURVE_TAG_CONIC
: /* consume conic arcs */
1558 v_control
.x
= SCALED( point
->x
);
1559 v_control
.y
= SCALED( point
->y
);
1562 if ( point
< limit
)
1570 tag
= FT_CURVE_TAG( tags
[0] );
1572 vec
.x
= SCALED( point
->x
);
1573 vec
.y
= SCALED( point
->y
);
1575 if ( tag
== FT_CURVE_TAG_ON
)
1577 FT_TRACE5(( " conic to (%.2f, %.2f)"
1578 " with control (%.2f, %.2f)\n",
1579 vec
.x
/ 64.0, vec
.y
/ 64.0,
1580 v_control
.x
/ 64.0, v_control
.y
/ 64.0 ));
1581 error
= func_interface
->conic_to( &v_control
, &vec
, user
);
1587 if ( tag
!= FT_CURVE_TAG_CONIC
)
1588 goto Invalid_Outline
;
1590 v_middle
.x
= ( v_control
.x
+ vec
.x
) / 2;
1591 v_middle
.y
= ( v_control
.y
+ vec
.y
) / 2;
1593 FT_TRACE5(( " conic to (%.2f, %.2f)"
1594 " with control (%.2f, %.2f)\n",
1595 v_middle
.x
/ 64.0, v_middle
.y
/ 64.0,
1596 v_control
.x
/ 64.0, v_control
.y
/ 64.0 ));
1597 error
= func_interface
->conic_to( &v_control
, &v_middle
, user
);
1605 FT_TRACE5(( " conic to (%.2f, %.2f)"
1606 " with control (%.2f, %.2f)\n",
1607 v_start
.x
/ 64.0, v_start
.y
/ 64.0,
1608 v_control
.x
/ 64.0, v_control
.y
/ 64.0 ));
1609 error
= func_interface
->conic_to( &v_control
, &v_start
, user
);
1612 default: /* FT_CURVE_TAG_CUBIC */
1614 FT_Vector vec1
, vec2
;
1617 if ( point
+ 1 > limit
||
1618 FT_CURVE_TAG( tags
[1] ) != FT_CURVE_TAG_CUBIC
)
1619 goto Invalid_Outline
;
1624 vec1
.x
= SCALED( point
[-2].x
);
1625 vec1
.y
= SCALED( point
[-2].y
);
1627 vec2
.x
= SCALED( point
[-1].x
);
1628 vec2
.y
= SCALED( point
[-1].y
);
1630 if ( point
<= limit
)
1635 vec
.x
= SCALED( point
->x
);
1636 vec
.y
= SCALED( point
->y
);
1638 FT_TRACE5(( " cubic to (%.2f, %.2f)"
1639 " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
1640 vec
.x
/ 64.0, vec
.y
/ 64.0,
1641 vec1
.x
/ 64.0, vec1
.y
/ 64.0,
1642 vec2
.x
/ 64.0, vec2
.y
/ 64.0 ));
1643 error
= func_interface
->cubic_to( &vec1
, &vec2
, &vec
, user
);
1649 FT_TRACE5(( " cubic to (%.2f, %.2f)"
1650 " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
1651 v_start
.x
/ 64.0, v_start
.y
/ 64.0,
1652 vec1
.x
/ 64.0, vec1
.y
/ 64.0,
1653 vec2
.x
/ 64.0, vec2
.y
/ 64.0 ));
1654 error
= func_interface
->cubic_to( &vec1
, &vec2
, &v_start
, user
);
1660 /* close the contour with a line segment */
1661 FT_TRACE5(( " line to (%.2f, %.2f)\n",
1662 v_start
.x
/ 64.0, v_start
.y
/ 64.0 ));
1663 error
= func_interface
->line_to( &v_start
, user
);
1672 FT_TRACE5(( "FT_Outline_Decompose: Done\n", n
));
1676 FT_TRACE5(( "FT_Outline_Decompose: Error %d\n", error
));
1680 return ErrRaster_Invalid_Outline
;
1683 #endif /* _STANDALONE_ */
1686 typedef struct TBand_
1692 FT_DEFINE_OUTLINE_FUNCS(func_interface
,
1693 (FT_Outline_MoveTo_Func
) gray_move_to
,
1694 (FT_Outline_LineTo_Func
) gray_line_to
,
1695 (FT_Outline_ConicTo_Func
)gray_conic_to
,
1696 (FT_Outline_CubicTo_Func
)gray_cubic_to
,
1702 gray_convert_glyph_inner( RAS_ARG
)
1705 volatile int error
= 0;
1707 #ifdef FT_CONFIG_OPTION_PIC
1708 FT_Outline_Funcs func_interface
;
1709 Init_Class_func_interface(&func_interface
);
1712 if ( ft_setjmp( ras
.jump_buffer
) == 0 )
1714 error
= FT_Outline_Decompose( &ras
.outline
, &func_interface
, &ras
);
1715 gray_record_cell( RAS_VAR
);
1718 error
= ErrRaster_Memory_Overflow
;
1725 gray_convert_glyph( RAS_ARG
)
1728 TBand
* volatile band
;
1729 int volatile n
, num_bands
;
1730 TPos
volatile min
, max
, max_y
;
1734 /* Set up state in the raster object */
1735 gray_compute_cbox( RAS_VAR
);
1737 /* clip to target bitmap, exit if nothing to do */
1738 clip
= &ras
.clip_box
;
1740 if ( ras
.max_ex
<= clip
->xMin
|| ras
.min_ex
>= clip
->xMax
||
1741 ras
.max_ey
<= clip
->yMin
|| ras
.min_ey
>= clip
->yMax
)
1744 if ( ras
.min_ex
< clip
->xMin
) ras
.min_ex
= clip
->xMin
;
1745 if ( ras
.min_ey
< clip
->yMin
) ras
.min_ey
= clip
->yMin
;
1747 if ( ras
.max_ex
> clip
->xMax
) ras
.max_ex
= clip
->xMax
;
1748 if ( ras
.max_ey
> clip
->yMax
) ras
.max_ey
= clip
->yMax
;
1750 ras
.count_ex
= ras
.max_ex
- ras
.min_ex
;
1751 ras
.count_ey
= ras
.max_ey
- ras
.min_ey
;
1753 /* set up vertical bands */
1754 num_bands
= (int)( ( ras
.max_ey
- ras
.min_ey
) / ras
.band_size
);
1755 if ( num_bands
== 0 )
1757 if ( num_bands
>= 39 )
1765 for ( n
= 0; n
< num_bands
; n
++, min
= max
)
1767 max
= min
+ ras
.band_size
;
1768 if ( n
== num_bands
- 1 || max
> max_y
)
1775 while ( band
>= bands
)
1777 TPos bottom
, top
, middle
;
1783 long cell_start
, cell_end
, cell_mod
;
1786 ras
.ycells
= (PCell
*)ras
.buffer
;
1787 ras
.ycount
= band
->max
- band
->min
;
1789 cell_start
= sizeof ( PCell
) * ras
.ycount
;
1790 cell_mod
= cell_start
% sizeof ( TCell
);
1792 cell_start
+= sizeof ( TCell
) - cell_mod
;
1794 cell_end
= ras
.buffer_size
;
1795 cell_end
-= cell_end
% sizeof( TCell
);
1797 cells_max
= (PCell
)( (char*)ras
.buffer
+ cell_end
);
1798 ras
.cells
= (PCell
)( (char*)ras
.buffer
+ cell_start
);
1799 if ( ras
.cells
>= cells_max
)
1802 ras
.max_cells
= cells_max
- ras
.cells
;
1803 if ( ras
.max_cells
< 2 )
1806 for ( yindex
= 0; yindex
< ras
.ycount
; yindex
++ )
1807 ras
.ycells
[yindex
] = NULL
;
1812 ras
.min_ey
= band
->min
;
1813 ras
.max_ey
= band
->max
;
1814 ras
.count_ey
= band
->max
- band
->min
;
1816 error
= gray_convert_glyph_inner( RAS_VAR
);
1820 gray_sweep( RAS_VAR_
&ras
.target
);
1824 else if ( error
!= ErrRaster_Memory_Overflow
)
1828 /* render pool overflow; we will reduce the render band by half */
1831 middle
= bottom
+ ( ( top
- bottom
) >> 1 );
1833 /* This is too complex for a single scanline; there must */
1834 /* be some problems. */
1835 if ( middle
== bottom
)
1837 #ifdef FT_DEBUG_LEVEL_TRACE
1838 FT_TRACE7(( "gray_convert_glyph: rotten glyph\n" ));
1843 if ( bottom
-top
>= ras
.band_size
)
1846 band
[1].min
= bottom
;
1847 band
[1].max
= middle
;
1848 band
[0].min
= middle
;
1854 if ( ras
.band_shoot
> 8 && ras
.band_size
> 16 )
1855 ras
.band_size
= ras
.band_size
/ 2;
1862 gray_raster_render( PRaster raster
,
1863 const FT_Raster_Params
* params
)
1865 const FT_Outline
* outline
= (const FT_Outline
*)params
->source
;
1866 const FT_Bitmap
* target_map
= params
->target
;
1870 if ( !raster
|| !raster
->buffer
|| !raster
->buffer_size
)
1871 return ErrRaster_Invalid_Argument
;
1874 return ErrRaster_Invalid_Outline
;
1876 /* return immediately if the outline is empty */
1877 if ( outline
->n_points
== 0 || outline
->n_contours
<= 0 )
1880 if ( !outline
->contours
|| !outline
->points
)
1881 return ErrRaster_Invalid_Outline
;
1883 if ( outline
->n_points
!=
1884 outline
->contours
[outline
->n_contours
- 1] + 1 )
1885 return ErrRaster_Invalid_Outline
;
1887 worker
= raster
->worker
;
1889 /* if direct mode is not set, we must have a target bitmap */
1890 if ( !( params
->flags
& FT_RASTER_FLAG_DIRECT
) )
1893 return ErrRaster_Invalid_Argument
;
1896 if ( !target_map
->width
|| !target_map
->rows
)
1899 if ( !target_map
->buffer
)
1900 return ErrRaster_Invalid_Argument
;
1903 /* this version does not support monochrome rendering */
1904 if ( !( params
->flags
& FT_RASTER_FLAG_AA
) )
1905 return ErrRaster_Invalid_Mode
;
1907 /* compute clipping box */
1908 if ( !( params
->flags
& FT_RASTER_FLAG_DIRECT
) )
1910 /* compute clip box from target pixmap */
1911 ras
.clip_box
.xMin
= 0;
1912 ras
.clip_box
.yMin
= 0;
1913 ras
.clip_box
.xMax
= target_map
->width
;
1914 ras
.clip_box
.yMax
= target_map
->rows
;
1916 else if ( params
->flags
& FT_RASTER_FLAG_CLIP
)
1917 ras
.clip_box
= params
->clip_box
;
1920 ras
.clip_box
.xMin
= -32768L;
1921 ras
.clip_box
.yMin
= -32768L;
1922 ras
.clip_box
.xMax
= 32767L;
1923 ras
.clip_box
.yMax
= 32767L;
1926 gray_init_cells( RAS_VAR_ raster
->buffer
, raster
->buffer_size
);
1928 ras
.outline
= *outline
;
1931 ras
.band_size
= raster
->band_size
;
1932 ras
.num_gray_spans
= 0;
1934 if ( params
->flags
& FT_RASTER_FLAG_DIRECT
)
1936 ras
.render_span
= (FT_Raster_Span_Func
)params
->gray_spans
;
1937 ras
.render_span_data
= params
->user
;
1941 ras
.target
= *target_map
;
1942 ras
.render_span
= (FT_Raster_Span_Func
)gray_render_span
;
1943 ras
.render_span_data
= &ras
;
1946 return gray_convert_glyph( RAS_VAR
);
1950 /**** RASTER OBJECT CREATION: In stand-alone mode, we simply use *****/
1951 /**** a static object. *****/
1956 gray_raster_new( void* memory
,
1957 FT_Raster
* araster
)
1959 static TRaster the_raster
;
1961 FT_UNUSED( memory
);
1964 *araster
= (FT_Raster
)&the_raster
;
1965 FT_MEM_ZERO( &the_raster
, sizeof ( the_raster
) );
1972 gray_raster_done( FT_Raster raster
)
1975 FT_UNUSED( raster
);
1978 #else /* !_STANDALONE_ */
1981 gray_raster_new( FT_Memory memory
,
1982 FT_Raster
* araster
)
1985 PRaster raster
= NULL
;
1989 if ( !FT_ALLOC( raster
, sizeof ( TRaster
) ) )
1991 raster
->memory
= memory
;
1992 *araster
= (FT_Raster
)raster
;
2000 gray_raster_done( FT_Raster raster
)
2002 FT_Memory memory
= (FT_Memory
)((PRaster
)raster
)->memory
;
2008 #endif /* !_STANDALONE_ */
2012 gray_raster_reset( FT_Raster raster
,
2016 PRaster rast
= (PRaster
)raster
;
2021 if ( pool_base
&& pool_size
>= (long)sizeof ( TWorker
) + 2048 )
2023 PWorker worker
= (PWorker
)pool_base
;
2026 rast
->worker
= worker
;
2027 rast
->buffer
= pool_base
+
2028 ( ( sizeof ( TWorker
) + sizeof ( TCell
) - 1 ) &
2029 ~( sizeof ( TCell
) - 1 ) );
2030 rast
->buffer_size
= (long)( ( pool_base
+ pool_size
) -
2031 (char*)rast
->buffer
) &
2032 ~( sizeof ( TCell
) - 1 );
2033 rast
->band_size
= (int)( rast
->buffer_size
/
2034 ( sizeof ( TCell
) * 8 ) );
2038 rast
->buffer
= NULL
;
2039 rast
->buffer_size
= 0;
2040 rast
->worker
= NULL
;
2046 FT_DEFINE_RASTER_FUNCS(ft_grays_raster
,
2047 FT_GLYPH_FORMAT_OUTLINE
,
2049 (FT_Raster_New_Func
) gray_raster_new
,
2050 (FT_Raster_Reset_Func
) gray_raster_reset
,
2051 (FT_Raster_Set_Mode_Func
)0,
2052 (FT_Raster_Render_Func
) gray_raster_render
,
2053 (FT_Raster_Done_Func
) gray_raster_done
2060 /* Local Variables: */