ReactOS 0.4.15-dev-8422-g6219a1a
ftoutln.h File Reference
#include <ft2build.h>
Include dependency graph for ftoutln.h:

Go to the source code of this file.

Typedefs

typedef enum FT_Orientation_ FT_Orientation
 

Enumerations

enum  FT_Orientation_ {
  FT_ORIENTATION_TRUETYPE = 0 , FT_ORIENTATION_POSTSCRIPT = 1 , FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE , FT_ORIENTATION_FILL_LEFT = FT_ORIENTATION_POSTSCRIPT ,
  FT_ORIENTATION_NONE
}
 

Functions

FT_BEGIN_HEADER FT_Outline_Decompose (FT_Outline *outline, const FT_Outline_Funcs *func_interface, void *user)
 
 FT_Outline_New (FT_Library library, FT_UInt numPoints, FT_Int numContours, FT_Outline *anoutline)
 
 FT_Outline_New_Internal (FT_Memory memory, FT_UInt numPoints, FT_Int numContours, FT_Outline *anoutline)
 
 FT_Outline_Done (FT_Library library, FT_Outline *outline)
 
 FT_Outline_Done_Internal (FT_Memory memory, FT_Outline *outline)
 
 FT_Outline_Check (FT_Outline *outline)
 
 FT_Outline_Get_CBox (const FT_Outline *outline, FT_BBox *acbox)
 
 FT_Outline_Translate (const FT_Outline *outline, FT_Pos xOffset, FT_Pos yOffset)
 
 FT_Outline_Copy (const FT_Outline *source, FT_Outline *target)
 
 FT_Outline_Transform (const FT_Outline *outline, const FT_Matrix *matrix)
 
 FT_Outline_Embolden (FT_Outline *outline, FT_Pos strength)
 
 FT_Outline_EmboldenXY (FT_Outline *outline, FT_Pos xstrength, FT_Pos ystrength)
 
 FT_Outline_Reverse (FT_Outline *outline)
 
 FT_Outline_Get_Bitmap (FT_Library library, FT_Outline *outline, const FT_Bitmap *abitmap)
 
 FT_Outline_Render (FT_Library library, FT_Outline *outline, FT_Raster_Params *params)
 
 FT_Outline_Get_Orientation (FT_Outline *outline)
 

Typedef Documentation

◆ FT_Orientation

Enumeration Type Documentation

◆ FT_Orientation_

Enumerator
FT_ORIENTATION_TRUETYPE 
FT_ORIENTATION_POSTSCRIPT 
FT_ORIENTATION_FILL_RIGHT 
FT_ORIENTATION_FILL_LEFT 
FT_ORIENTATION_NONE 

Definition at line 531 of file ftoutln.h.

532 {
538
@ FT_ORIENTATION_FILL_RIGHT
Definition: ftoutln.h:535
@ FT_ORIENTATION_NONE
Definition: ftoutln.h:537
@ FT_ORIENTATION_POSTSCRIPT
Definition: ftoutln.h:534
@ FT_ORIENTATION_FILL_LEFT
Definition: ftoutln.h:536
@ FT_ORIENTATION_TRUETYPE
Definition: ftoutln.h:533
enum FT_Orientation_ FT_Orientation

Function Documentation

◆ FT_Outline_Check()

FT_Outline_Check ( FT_Outline outline)

Definition at line 357 of file ftoutln.c.

358 {
359 if ( outline )
360 {
361 FT_Int n_points = outline->n_points;
362 FT_Int n_contours = outline->n_contours;
363 FT_Int end0, end;
364 FT_Int n;
365
366
367 /* empty glyph? */
368 if ( n_points == 0 && n_contours == 0 )
369 return FT_Err_Ok;
370
371 /* check point and contour counts */
372 if ( n_points <= 0 || n_contours <= 0 )
373 goto Bad;
374
375 end0 = end = -1;
376 for ( n = 0; n < n_contours; n++ )
377 {
378 end = outline->contours[n];
379
380 /* note that we don't accept empty contours */
381 if ( end <= end0 || end >= n_points )
382 goto Bad;
383
384 end0 = end;
385 }
386
387 if ( end != n_points - 1 )
388 goto Bad;
389
390 /* XXX: check the tags array */
391 return FT_Err_Ok;
392 }
393
394 Bad:
395 return FT_THROW( Invalid_Argument );
396 }
return FT_Err_Ok
Definition: ftbbox.c:511
#define FT_THROW(e)
Definition: ftdebug.h:213
signed int FT_Int
Definition: fttypes.h:220
GLuint GLuint end
Definition: gl.h:1545
GLdouble n
Definition: glext.h:7729
Definition: mesh.c:5330

Referenced by FT_Load_Glyph(), and ft_stroke_border_export().

◆ FT_Outline_Copy()

FT_Outline_Copy ( const FT_Outline source,
FT_Outline target 
)

Definition at line 402 of file ftoutln.c.

404 {
405 FT_Int is_owner;
406
407
408 if ( !source || !target )
409 return FT_THROW( Invalid_Outline );
410
411 if ( source->n_points != target->n_points ||
412 source->n_contours != target->n_contours )
413 return FT_THROW( Invalid_Argument );
414
415 if ( source == target )
416 return FT_Err_Ok;
417
418 if ( source->n_points )
419 {
420 FT_ARRAY_COPY( target->points, source->points, source->n_points );
421 FT_ARRAY_COPY( target->tags, source->tags, source->n_points );
422 }
423
424 if ( source->n_contours )
425 FT_ARRAY_COPY( target->contours, source->contours, source->n_contours );
426
427 /* copy all flags, except the `FT_OUTLINE_OWNER' one */
428 is_owner = target->flags & FT_OUTLINE_OWNER;
429 target->flags = source->flags;
430
431 target->flags &= ~FT_OUTLINE_OWNER;
432 target->flags |= is_owner;
433
434 return FT_Err_Ok;
435 }
#define FT_OUTLINE_OWNER
Definition: ftimage.h:428
#define FT_ARRAY_COPY(dest, source, count)
Definition: ftmemory.h:244
GLenum target
Definition: glext.h:7315

Referenced by FT_DEFINE_GLYPH(), and ft_outline_glyph_copy().

◆ FT_Outline_Decompose()

FT_BEGIN_HEADER FT_Outline_Decompose ( FT_Outline outline,
const FT_Outline_Funcs func_interface,
void user 
)

Definition at line 51 of file ftoutln.c.

54 {
55#undef SCALED
56#define SCALED( x ) ( ( (x) < 0 ? -( -(x) << shift ) \
57 : ( (x) << shift ) ) - delta )
58
59 FT_Vector v_last;
60 FT_Vector v_control;
61 FT_Vector v_start;
62
65 char* tags;
66
68
69 FT_Int n; /* index of contour in outline */
70 FT_UInt first; /* index of first point in contour */
71 FT_Int tag; /* current point's state */
72
74 FT_Pos delta;
75
76
77 if ( !outline )
78 return FT_THROW( Invalid_Outline );
79
80 if ( !func_interface )
81 return FT_THROW( Invalid_Argument );
82
83 shift = func_interface->shift;
84 delta = func_interface->delta;
85 first = 0;
86
87 for ( n = 0; n < outline->n_contours; n++ )
88 {
89 FT_Int last; /* index of last point in contour */
90
91
92 FT_TRACE5(( "FT_Outline_Decompose: Outline %d\n", n ));
93
94 last = outline->contours[n];
95 if ( last < 0 )
96 goto Invalid_Outline;
97 limit = outline->points + last;
98
99 v_start = outline->points[first];
100 v_start.x = SCALED( v_start.x );
101 v_start.y = SCALED( v_start.y );
102
103 v_last = outline->points[last];
104 v_last.x = SCALED( v_last.x );
105 v_last.y = SCALED( v_last.y );
106
107 v_control = v_start;
108
109 point = outline->points + first;
110 tags = outline->tags + first;
111 tag = FT_CURVE_TAG( tags[0] );
112
113 /* A contour cannot start with a cubic control point! */
114 if ( tag == FT_CURVE_TAG_CUBIC )
115 goto Invalid_Outline;
116
117 /* check first point to determine origin */
118 if ( tag == FT_CURVE_TAG_CONIC )
119 {
120 /* first point is conic control. Yes, this happens. */
121 if ( FT_CURVE_TAG( outline->tags[last] ) == FT_CURVE_TAG_ON )
122 {
123 /* start at last point if it is on the curve */
124 v_start = v_last;
125 limit--;
126 }
127 else
128 {
129 /* if both first and last points are conic, */
130 /* start at their middle and record its position */
131 /* for closure */
132 v_start.x = ( v_start.x + v_last.x ) / 2;
133 v_start.y = ( v_start.y + v_last.y ) / 2;
134
135 /* v_last = v_start; */
136 }
137 point--;
138 tags--;
139 }
140
141 FT_TRACE5(( " move to (%.2f, %.2f)\n",
142 v_start.x / 64.0, v_start.y / 64.0 ));
143 error = func_interface->move_to( &v_start, user );
144 if ( error )
145 goto Exit;
146
147 while ( point < limit )
148 {
149 point++;
150 tags++;
151
152 tag = FT_CURVE_TAG( tags[0] );
153 switch ( tag )
154 {
155 case FT_CURVE_TAG_ON: /* emit a single line_to */
156 {
158
159
160 vec.x = SCALED( point->x );
161 vec.y = SCALED( point->y );
162
163 FT_TRACE5(( " line to (%.2f, %.2f)\n",
164 vec.x / 64.0, vec.y / 64.0 ));
165 error = func_interface->line_to( &vec, user );
166 if ( error )
167 goto Exit;
168 continue;
169 }
170
171 case FT_CURVE_TAG_CONIC: /* consume conic arcs */
172 v_control.x = SCALED( point->x );
173 v_control.y = SCALED( point->y );
174
175 Do_Conic:
176 if ( point < limit )
177 {
179 FT_Vector v_middle;
180
181
182 point++;
183 tags++;
184 tag = FT_CURVE_TAG( tags[0] );
185
186 vec.x = SCALED( point->x );
187 vec.y = SCALED( point->y );
188
189 if ( tag == FT_CURVE_TAG_ON )
190 {
191 FT_TRACE5(( " conic to (%.2f, %.2f)"
192 " with control (%.2f, %.2f)\n",
193 vec.x / 64.0, vec.y / 64.0,
194 v_control.x / 64.0, v_control.y / 64.0 ));
195 error = func_interface->conic_to( &v_control, &vec, user );
196 if ( error )
197 goto Exit;
198 continue;
199 }
200
201 if ( tag != FT_CURVE_TAG_CONIC )
202 goto Invalid_Outline;
203
204 v_middle.x = ( v_control.x + vec.x ) / 2;
205 v_middle.y = ( v_control.y + vec.y ) / 2;
206
207 FT_TRACE5(( " conic to (%.2f, %.2f)"
208 " with control (%.2f, %.2f)\n",
209 v_middle.x / 64.0, v_middle.y / 64.0,
210 v_control.x / 64.0, v_control.y / 64.0 ));
211 error = func_interface->conic_to( &v_control, &v_middle, user );
212 if ( error )
213 goto Exit;
214
215 v_control = vec;
216 goto Do_Conic;
217 }
218
219 FT_TRACE5(( " conic to (%.2f, %.2f)"
220 " with control (%.2f, %.2f)\n",
221 v_start.x / 64.0, v_start.y / 64.0,
222 v_control.x / 64.0, v_control.y / 64.0 ));
223 error = func_interface->conic_to( &v_control, &v_start, user );
224 goto Close;
225
226 default: /* FT_CURVE_TAG_CUBIC */
227 {
228 FT_Vector vec1, vec2;
229
230
231 if ( point + 1 > limit ||
233 goto Invalid_Outline;
234
235 point += 2;
236 tags += 2;
237
238 vec1.x = SCALED( point[-2].x );
239 vec1.y = SCALED( point[-2].y );
240
241 vec2.x = SCALED( point[-1].x );
242 vec2.y = SCALED( point[-1].y );
243
244 if ( point <= limit )
245 {
247
248
249 vec.x = SCALED( point->x );
250 vec.y = SCALED( point->y );
251
252 FT_TRACE5(( " cubic to (%.2f, %.2f)"
253 " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
254 vec.x / 64.0, vec.y / 64.0,
255 vec1.x / 64.0, vec1.y / 64.0,
256 vec2.x / 64.0, vec2.y / 64.0 ));
257 error = func_interface->cubic_to( &vec1, &vec2, &vec, user );
258 if ( error )
259 goto Exit;
260 continue;
261 }
262
263 FT_TRACE5(( " cubic to (%.2f, %.2f)"
264 " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
265 v_start.x / 64.0, v_start.y / 64.0,
266 vec1.x / 64.0, vec1.y / 64.0,
267 vec2.x / 64.0, vec2.y / 64.0 ));
268 error = func_interface->cubic_to( &vec1, &vec2, &v_start, user );
269 goto Close;
270 }
271 }
272 }
273
274 /* close the contour with a line segment */
275 FT_TRACE5(( " line to (%.2f, %.2f)\n",
276 v_start.x / 64.0, v_start.y / 64.0 ));
277 error = func_interface->line_to( &v_start, user );
278
279 Close:
280 if ( error )
281 goto Exit;
282
283 first = (FT_UInt)last + 1;
284 }
285
286 FT_TRACE5(( "FT_Outline_Decompose: Done\n", n ));
287 return FT_Err_Ok;
288
289 Exit:
290 FT_TRACE5(( "FT_Outline_Decompose: Error 0x%x\n", error ));
291 return error;
292
293 Invalid_Outline:
294 return FT_THROW( Invalid_Outline );
295 }
void user(int argc, const char *argv[])
Definition: cmds.c:1350
POINTL point
Definition: edittest.c:50
FT_Vector * vec
Definition: ftbbox.c:448
#define FT_TRACE5(varformat)
Definition: ftdebug.h:162
#define FT_CURVE_TAG_CUBIC
Definition: ftimage.h:455
#define FT_CURVE_TAG_CONIC
Definition: ftimage.h:454
#define FT_CURVE_TAG(flag)
Definition: ftimage.h:451
#define FT_CURVE_TAG_ON
Definition: ftimage.h:453
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:58
#define SCALED(x)
int FT_Error
Definition: fttypes.h:300
unsigned int FT_UInt
Definition: fttypes.h:231
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint limit
Definition: glext.h:10326
const GLint * first
Definition: glext.h:5794
#define error(str)
Definition: mkdosfs.c:1605
const char * tags[7 *8]
Definition: apphelp.c:216
static UINT UINT last
Definition: font.c:45
#define shift
Definition: input.c:1755
@ Close
Definition: sacdrv.h:268
static void Exit(void)
Definition: sock.c:1330
FT_Outline_ConicToFunc conic_to
Definition: ftimage.h:632
FT_Outline_LineToFunc line_to
Definition: ftimage.h:631
FT_Outline_CubicToFunc cubic_to
Definition: ftimage.h:633
FT_Outline_MoveToFunc move_to
Definition: ftimage.h:630
FT_Pos x
Definition: ftimage.h:76
FT_Pos y
Definition: ftimage.h:77
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
Definition: ecma_167.h:138

Referenced by FT_DEFINE_OUTLINE_FUNCS(), if(), and TestFace().

◆ FT_Outline_Done()

FT_Outline_Done ( FT_Library  library,
FT_Outline outline 
)

Definition at line 463 of file ftoutln.c.

465 {
466 /* check for valid `outline' in FT_Outline_Done_Internal() */
467
468 if ( !library )
469 return FT_THROW( Invalid_Library_Handle );
470
472 }
FT_Library library
Definition: cffdrivr.c:654
FT_Outline_Done_Internal(FT_Memory memory, FT_Outline *outline)
Definition: ftoutln.c:439
FT_Memory memory
Definition: ftobjs.h:918

Referenced by FT_Glyph_Stroke(), FT_Glyph_StrokeBorder(), and ft_outline_glyph_done().

◆ FT_Outline_Done_Internal()

FT_Outline_Done_Internal ( FT_Memory  memory,
FT_Outline outline 
)

Definition at line 439 of file ftoutln.c.

441 {
442 if ( !outline )
443 return FT_THROW( Invalid_Outline );
444
445 if ( !memory )
446 return FT_THROW( Invalid_Argument );
447
448 if ( outline->flags & FT_OUTLINE_OWNER )
449 {
450 FT_FREE( outline->points );
451 FT_FREE( outline->tags );
452 FT_FREE( outline->contours );
453 }
455
456 return FT_Err_Ok;
457 }
#define FT_FREE(ptr)
Definition: ftmemory.h:329
static const FT_Outline null_outline
Definition: ftoutln.c:45
static char memory[1024 *256]
Definition: process.c:116

Referenced by FT_Outline_Done(), and FT_Outline_New_Internal().

◆ FT_Outline_Embolden()

FT_Outline_Embolden ( FT_Outline outline,
FT_Pos  strength 
)

Definition at line 899 of file ftoutln.c.

901 {
902 return FT_Outline_EmboldenXY( outline, strength, strength );
903 }
FT_Outline_EmboldenXY(FT_Outline *outline, FT_Pos xstrength, FT_Pos ystrength)
Definition: ftoutln.c:909

◆ FT_Outline_EmboldenXY()

FT_Outline_EmboldenXY ( FT_Outline outline,
FT_Pos  xstrength,
FT_Pos  ystrength 
)

Definition at line 909 of file ftoutln.c.

912 {
914 FT_Int c, first, last;
915 FT_Int orientation;
916
917
918 if ( !outline )
919 return FT_THROW( Invalid_Outline );
920
921 xstrength /= 2;
922 ystrength /= 2;
923 if ( xstrength == 0 && ystrength == 0 )
924 return FT_Err_Ok;
925
926 orientation = FT_Outline_Get_Orientation( outline );
927 if ( orientation == FT_ORIENTATION_NONE )
928 {
929 if ( outline->n_contours )
930 return FT_THROW( Invalid_Argument );
931 else
932 return FT_Err_Ok;
933 }
934
935 points = outline->points;
936
937 first = 0;
938 for ( c = 0; c < outline->n_contours; c++ )
939 {
940 FT_Vector in, out, anchor, shift;
941 FT_Fixed l_in, l_out, l_anchor = 0, l, q, d;
942 FT_Int i, j, k;
943
944
945 l_in = 0;
946 last = outline->contours[c];
947
948 /* pacify compiler */
949 in.x = in.y = anchor.x = anchor.y = 0;
950
951 /* Counter j cycles though the points; counter i advances only */
952 /* when points are moved; anchor k marks the first moved point. */
953 for ( i = last, j = first, k = -1;
954 j != i && i != k;
955 j = j < last ? j + 1 : first )
956 {
957 if ( j != k )
958 {
959 out.x = points[j].x - points[i].x;
960 out.y = points[j].y - points[i].y;
961 l_out = (FT_Fixed)FT_Vector_NormLen( &out );
962
963 if ( l_out == 0 )
964 continue;
965 }
966 else
967 {
968 out = anchor;
969 l_out = l_anchor;
970 }
971
972 if ( l_in != 0 )
973 {
974 if ( k < 0 )
975 {
976 k = i;
977 anchor = in;
978 l_anchor = l_in;
979 }
980
981 d = FT_MulFix( in.x, out.x ) + FT_MulFix( in.y, out.y );
982
983 /* shift only if turn is less than ~160 degrees */
984 if ( d > -0xF000L )
985 {
986 d = d + 0x10000L;
987
988 /* shift components along lateral bisector in proper orientation */
989 shift.x = in.y + out.y;
990 shift.y = in.x + out.x;
991
992 if ( orientation == FT_ORIENTATION_TRUETYPE )
993 shift.x = -shift.x;
994 else
995 shift.y = -shift.y;
996
997 /* restrict shift magnitude to better handle collapsing segments */
998 q = FT_MulFix( out.x, in.y ) - FT_MulFix( out.y, in.x );
999 if ( orientation == FT_ORIENTATION_TRUETYPE )
1000 q = -q;
1001
1002 l = FT_MIN( l_in, l_out );
1003
1004 /* non-strict inequalities avoid divide-by-zero when q == l == 0 */
1005 if ( FT_MulFix( xstrength, q ) <= FT_MulFix( l, d ) )
1006 shift.x = FT_MulDiv( shift.x, xstrength, d );
1007 else
1008 shift.x = FT_MulDiv( shift.x, l, q );
1009
1010
1011 if ( FT_MulFix( ystrength, q ) <= FT_MulFix( l, d ) )
1012 shift.y = FT_MulDiv( shift.y, ystrength, d );
1013 else
1014 shift.y = FT_MulDiv( shift.y, l, q );
1015 }
1016 else
1017 shift.x = shift.y = 0;
1018
1019 for ( ;
1020 i != j;
1021 i = i < last ? i + 1 : first )
1022 {
1023 points[i].x += xstrength + shift.x;
1024 points[i].y += ystrength + shift.y;
1025 }
1026 }
1027 else
1028 i = j;
1029
1030 in = out;
1031 l_in = l_out;
1032 }
1033
1034 first = last + 1;
1035 }
1036
1037 return FT_Err_Ok;
1038 }
r l[0]
Definition: byte_order.h:168
FT_MulDiv(FT_Long a, FT_Long b, FT_Long c)
Definition: ftcalc.c:416
FT_MulFix(FT_Long a, FT_Long b)
Definition: ftcalc.c:509
FT_Vector_NormLen(FT_Vector *vector)
Definition: ftcalc.c:776
#define FT_MIN(a, b)
Definition: ftobjs.h:71
FT_Outline_Get_Orientation(FT_Outline *outline)
Definition: ftoutln.c:1044
signed long FT_Fixed
Definition: fttypes.h:288
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
const GLubyte * c
Definition: glext.h:8905
GLuint in
Definition: glext.h:9616
GLsizei const GLfloat * points
Definition: glext.h:8112
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define d
Definition: ke_i.h:81
#define c
Definition: ke_i.h:80
int k
Definition: mpi.c:3369
static FILE * out
Definition: regtests2xml.c:44

Referenced by af_loader_embolden_glyph_in_slot(), FT_GlyphSlot_Embolden(), FT_Outline_Embolden(), TT_Hint_Glyph(), and TT_Process_Simple_Glyph().

◆ FT_Outline_Get_Bitmap()

FT_Outline_Get_Bitmap ( FT_Library  library,
FT_Outline outline,
const FT_Bitmap abitmap 
)

Definition at line 661 of file ftoutln.c.

664 {
666
667
668 if ( !abitmap )
669 return FT_THROW( Invalid_Argument );
670
671 /* other checks are delayed to `FT_Outline_Render' */
672
673 params.target = abitmap;
674 params.flags = 0;
675
676 if ( abitmap->pixel_mode == FT_PIXEL_MODE_GRAY ||
677 abitmap->pixel_mode == FT_PIXEL_MODE_LCD ||
678 abitmap->pixel_mode == FT_PIXEL_MODE_LCD_V )
679 params.flags |= FT_RASTER_FLAG_AA;
680
682 }
#define FT_RASTER_FLAG_AA
Definition: ftimage.h:941
@ FT_PIXEL_MODE_LCD_V
Definition: ftimage.h:188
@ FT_PIXEL_MODE_GRAY
Definition: ftimage.h:184
@ FT_PIXEL_MODE_LCD
Definition: ftimage.h:187
FT_Outline_Render(FT_Library library, FT_Outline *outline, FT_Raster_Params *params)
Definition: ftoutln.c:614
GLenum const GLfloat * params
Definition: glext.h:5645
unsigned char pixel_mode
Definition: ftimage.h:268

Referenced by ftGdiGetGlyphOutline().

◆ FT_Outline_Get_CBox()

FT_Outline_Get_CBox ( const FT_Outline outline,
FT_BBox acbox 
)

Definition at line 478 of file ftoutln.c.

480 {
481 FT_Pos xMin, yMin, xMax, yMax;
482
483
484 if ( outline && acbox )
485 {
486 if ( outline->n_points == 0 )
487 {
488 xMin = 0;
489 yMin = 0;
490 xMax = 0;
491 yMax = 0;
492 }
493 else
494 {
495 FT_Vector* vec = outline->points;
496 FT_Vector* limit = vec + outline->n_points;
497
498
499 xMin = xMax = vec->x;
500 yMin = yMax = vec->y;
501 vec++;
502
503 for ( ; vec < limit; vec++ )
504 {
505 FT_Pos x, y;
506
507
508 x = vec->x;
509 if ( x < xMin ) xMin = x;
510 if ( x > xMax ) xMax = x;
511
512 y = vec->y;
513 if ( y < yMin ) yMin = y;
514 if ( y > yMax ) yMax = y;
515 }
516 }
517 acbox->xMin = xMin;
518 acbox->xMax = xMax;
519 acbox->yMin = yMin;
520 acbox->yMax = yMax;
521 }
522 }
FT_Pos xMin
Definition: ftimage.h:117
FT_Pos yMax
Definition: ftimage.h:118
FT_Pos yMin
Definition: ftimage.h:117
FT_Pos xMax
Definition: ftimage.h:118

Referenced by af_loader_load_glyph(), cff_slot_load(), cid_slot_load_glyph(), compute_glyph_metrics(), dump_outline(), ft_glyphslot_preset_bitmap(), FT_Outline_Get_Orientation(), ft_outline_glyph_bbox(), ft_raster1_get_cbox(), ft_smooth_get_cbox(), gray_raster_render(), pfr_slot_load(), profile_outline(), and T1_Load_Glyph().

◆ FT_Outline_Get_Orientation()

FT_Outline_Get_Orientation ( FT_Outline outline)

Definition at line 1044 of file ftoutln.c.

1045 {
1046 FT_BBox cbox;
1047 FT_Int xshift, yshift;
1049 FT_Vector v_prev, v_cur;
1050 FT_Int c, n, first;
1051 FT_Pos area = 0;
1052
1053
1054 if ( !outline || outline->n_points <= 0 )
1056
1057 /* We use the nonzero winding rule to find the orientation. */
1058 /* Since glyph outlines behave much more `regular' than arbitrary */
1059 /* cubic or quadratic curves, this test deals with the polygon */
1060 /* only that is spanned up by the control points. */
1061
1062 FT_Outline_Get_CBox( outline, &cbox );
1063
1064 /* Handle collapsed outlines to avoid undefined FT_MSB. */
1065 if ( cbox.xMin == cbox.xMax || cbox.yMin == cbox.yMax )
1066 return FT_ORIENTATION_NONE;
1067
1068 xshift = FT_MSB( (FT_UInt32)( FT_ABS( cbox.xMax ) |
1069 FT_ABS( cbox.xMin ) ) ) - 14;
1070 xshift = FT_MAX( xshift, 0 );
1071
1072 yshift = FT_MSB( (FT_UInt32)( cbox.yMax - cbox.yMin ) ) - 14;
1073 yshift = FT_MAX( yshift, 0 );
1074
1075 points = outline->points;
1076
1077 first = 0;
1078 for ( c = 0; c < outline->n_contours; c++ )
1079 {
1080 FT_Int last = outline->contours[c];
1081
1082
1083 v_prev.x = points[last].x >> xshift;
1084 v_prev.y = points[last].y >> yshift;
1085
1086 for ( n = first; n <= last; n++ )
1087 {
1088 v_cur.x = points[n].x >> xshift;
1089 v_cur.y = points[n].y >> yshift;
1090
1091 area = ADD_LONG( area,
1092 ( v_cur.y - v_prev.y ) * ( v_cur.x + v_prev.x ) );
1093
1094 v_prev = v_cur;
1095 }
1096
1097 first = last + 1;
1098 }
1099
1100 if ( area > 0 )
1102 else if ( area < 0 )
1104 else
1105 return FT_ORIENTATION_NONE;
1106 }
FT_MSB(FT_UInt32 z)
Definition: ftcalc.c:114
#define ADD_LONG(a, b)
Definition: ftcalc.h:420
#define FT_ABS(a)
Definition: ftobjs.h:74
#define FT_MAX(a, b)
Definition: ftobjs.h:72
FT_Outline_Get_CBox(const FT_Outline *outline, FT_BBox *acbox)
Definition: ftoutln.c:478
static Real area(Real A[2], Real B[2], Real C[2])
Definition: polyDBG.cc:50

Referenced by af_glyph_hints_reload(), FT_Outline_EmboldenXY(), FT_Outline_GetInsideBorder(), and FT_Outline_GetOutsideBorder().

◆ FT_Outline_New()

FT_Outline_New ( FT_Library  library,
FT_UInt  numPoints,
FT_Int  numContours,
FT_Outline anoutline 
)

Definition at line 341 of file ftoutln.c.

345 {
346 if ( !library )
347 return FT_THROW( Invalid_Library_Handle );
348
349 return FT_Outline_New_Internal( library->memory, numPoints,
350 numContours, anoutline );
351 }
FT_Outline_New_Internal(FT_Memory memory, FT_UInt numPoints, FT_Int numContours, FT_Outline *anoutline)
Definition: ftoutln.c:299

Referenced by FT_DEFINE_GLYPH(), FT_Glyph_Stroke(), FT_Glyph_StrokeBorder(), and ft_outline_glyph_copy().

◆ FT_Outline_New_Internal()

FT_Outline_New_Internal ( FT_Memory  memory,
FT_UInt  numPoints,
FT_Int  numContours,
FT_Outline anoutline 
)

Definition at line 299 of file ftoutln.c.

303 {
305
306
307 if ( !anoutline || !memory )
308 return FT_THROW( Invalid_Argument );
309
310 *anoutline = null_outline;
311
312 if ( numContours < 0 ||
313 (FT_UInt)numContours > numPoints )
314 return FT_THROW( Invalid_Argument );
315
316 if ( numPoints > FT_OUTLINE_POINTS_MAX )
317 return FT_THROW( Array_Too_Large );
318
319 if ( FT_NEW_ARRAY( anoutline->points, numPoints ) ||
320 FT_NEW_ARRAY( anoutline->tags, numPoints ) ||
321 FT_NEW_ARRAY( anoutline->contours, numContours ) )
322 goto Fail;
323
324 anoutline->n_points = (FT_Short)numPoints;
325 anoutline->n_contours = (FT_Short)numContours;
326 anoutline->flags |= FT_OUTLINE_OWNER;
327
328 return FT_Err_Ok;
329
330 Fail:
331 anoutline->flags |= FT_OUTLINE_OWNER;
332 FT_Outline_Done_Internal( memory, anoutline );
333
334 return error;
335 }
int Fail
Definition: ehthrow.cxx:24
#define FT_OUTLINE_POINTS_MAX
Definition: ftimage.h:352
#define FT_NEW_ARRAY(ptr, count)
Definition: ftmemory.h:333
signed short FT_Short
Definition: fttypes.h:198
short n_contours
Definition: ftimage.h:336
int flags
Definition: ftimage.h:343
short * contours
Definition: ftimage.h:341
FT_Vector * points
Definition: ftimage.h:339
short n_points
Definition: ftimage.h:337
char * tags
Definition: ftimage.h:340

Referenced by FT_Outline_New().

◆ FT_Outline_Render()

FT_Outline_Render ( FT_Library  library,
FT_Outline outline,
FT_Raster_Params params 
)

Definition at line 614 of file ftoutln.c.

617 {
619 FT_Renderer renderer;
621
622
623 if ( !library )
624 return FT_THROW( Invalid_Library_Handle );
625
626 if ( !outline )
627 return FT_THROW( Invalid_Outline );
628
629 if ( !params )
630 return FT_THROW( Invalid_Argument );
631
632 renderer = library->cur_renderer;
634
635 params->source = (void*)outline;
636
637 error = FT_ERR( Cannot_Render_Glyph );
638 while ( renderer )
639 {
640 error = renderer->raster_render( renderer->raster, params );
641 if ( !error || FT_ERR_NEQ( error, Cannot_Render_Glyph ) )
642 break;
643
644 /* FT_Err_Cannot_Render_Glyph is returned if the render mode */
645 /* is unsupported by the current renderer for this glyph image */
646 /* format */
647
648 /* now, look for another renderer that supports the same */
649 /* format */
651 &node );
652 }
653
654 return error;
655 }
FT_Lookup_Renderer(FT_Library library, FT_Glyph_Format format, FT_ListNode *node)
Definition: ftobjs.c:4264
smooth FT_Module_Constructor FT_Module_Destructor FT_Module_Requester FT_GLYPH_FORMAT_OUTLINE
Definition: ftsmooth.c:426
#define FT_ERR_NEQ(x, e)
Definition: fttypes.h:593
#define FT_ERR(e)
Definition: fttypes.h:586
FT_Renderer cur_renderer
Definition: ftobjs.h:928
FT_ListRec renderers
Definition: ftobjs.h:927
FT_ListNode head
Definition: fttypes.h:569
FT_Raster_Render_Func raster_render
Definition: ftobjs.h:779
FT_Raster raster
Definition: ftobjs.h:778
Definition: dlist.c:348

Referenced by FT_Outline_Get_Bitmap().

◆ FT_Outline_Reverse()

FT_Outline_Reverse ( FT_Outline outline)

Definition at line 553 of file ftoutln.c.

554 {
555 FT_UShort n;
557
558
559 if ( !outline )
560 return;
561
562 first = 0;
563
564 for ( n = 0; n < outline->n_contours; n++ )
565 {
566 last = outline->contours[n];
567
568 /* reverse point table */
569 {
570 FT_Vector* p = outline->points + first;
571 FT_Vector* q = outline->points + last;
573
574
575 while ( p < q )
576 {
577 swap = *p;
578 *p = *q;
579 *q = swap;
580 p++;
581 q--;
582 }
583 }
584
585 /* reverse tags table */
586 {
587 char* p = outline->tags + first;
588 char* q = outline->tags + last;
589
590
591 while ( p < q )
592 {
593 char swap;
594
595
596 swap = *p;
597 *p = *q;
598 *q = swap;
599 p++;
600 q--;
601 }
602 }
603
604 first = last + 1;
605 }
606
608 }
#define FT_OUTLINE_REVERSE_FILL
Definition: ftimage.h:430
unsigned short FT_UShort
Definition: fttypes.h:209
GLfloat GLfloat p
Definition: glext.h:8902
#define swap(a, b)
Definition: qsort.c:63

◆ FT_Outline_Transform()

FT_Outline_Transform ( const FT_Outline outline,
const FT_Matrix matrix 
)

Definition at line 711 of file ftoutln.c.

713 {
714 FT_Vector* vec;
716
717
718 if ( !outline || !matrix )
719 return;
720
721 vec = outline->points;
722 limit = vec + outline->n_points;
723
724 for ( ; vec < limit; vec++ )
726 }
FT_Vector_Transform(FT_Vector *vector, const FT_Matrix *matrix)
Definition: ftoutln.c:688
GLuint GLenum matrix
Definition: glext.h:9407

Referenced by af_loader_embolden_glyph_in_slot(), af_loader_load_glyph(), cff_slot_load(), cid_slot_load_glyph(), FT_GlyphSlot_Oblique(), FT_Load_Glyph(), ft_outline_glyph_transform(), ft_raster1_transform(), ft_smooth_transform(), ftGdiGetGlyphOutline(), pfr_slot_load(), T1_Load_Glyph(), and TT_Process_Composite_Component().

◆ FT_Outline_Translate()

FT_Outline_Translate ( const FT_Outline outline,
FT_Pos  xOffset,
FT_Pos  yOffset 
)

Definition at line 528 of file ftoutln.c.

531 {
532 FT_UShort n;
533 FT_Vector* vec;
534
535
536 if ( !outline )
537 return;
538
539 vec = outline->points;
540
541 for ( n = 0; n < outline->n_points; n++ )
542 {
543 vec->x = ADD_LONG( vec->x, xOffset );
544 vec->y = ADD_LONG( vec->y, yOffset );
545 vec++;
546 }
547 }
int yOffset
Definition: appswitch.c:59
int xOffset
Definition: appswitch.c:59

Referenced by af_loader_load_glyph(), cff_slot_load(), cid_slot_load_glyph(), FT_Load_Glyph(), ft_outline_glyph_transform(), ft_raster1_render(), ft_raster1_transform(), ft_smooth_render_generic(), ft_smooth_transform(), ftGdiGetGlyphOutline(), T1_Load_Glyph(), TT_Load_Glyph(), and TT_Process_Composite_Component().