~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/3rdparty/freetype/include/freetype/ftoutln.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************/
 
2
/*                                                                         */
 
3
/*  ftoutln.h                                                              */
 
4
/*                                                                         */
 
5
/*    Support for the FT_Outline type used to store glyph shapes of        */
 
6
/*    most scalable font formats (specification).                          */
 
7
/*                                                                         */
 
8
/*  Copyright 1996-2001, 2002, 2003 by                                     */
 
9
/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 
10
/*                                                                         */
 
11
/*  This file is part of the FreeType project, and may only be used,       */
 
12
/*  modified, and distributed under the terms of the FreeType project      */
 
13
/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
 
14
/*  this file you indicate that you have read the license and              */
 
15
/*  understand and accept it fully.                                        */
 
16
/*                                                                         */
 
17
/***************************************************************************/
 
18
 
 
19
 
 
20
#ifndef __FTOUTLN_H__
 
21
#define __FTOUTLN_H__
 
22
 
 
23
 
 
24
#include <ft2build.h>
 
25
#include FT_FREETYPE_H
 
26
 
 
27
#ifdef FREETYPE_H
 
28
#error "freetype.h of FreeType 1 has been loaded!"
 
29
#error "Please fix the directory search order for header files"
 
30
#error "so that freetype.h of FreeType 2 is found first."
 
31
#endif
 
32
 
 
33
 
 
34
FT_BEGIN_HEADER
 
35
 
 
36
 
 
37
  /*************************************************************************/
 
38
  /*                                                                       */
 
39
  /* <Section>                                                             */
 
40
  /*    outline_processing                                                 */
 
41
  /*                                                                       */
 
42
  /* <Title>                                                               */
 
43
  /*    Outline Processing                                                 */
 
44
  /*                                                                       */
 
45
  /* <Abstract>                                                            */
 
46
  /*    Functions to create, transform, and render vectorial glyph images. */
 
47
  /*                                                                       */
 
48
  /* <Description>                                                         */
 
49
  /*    This section contains routines used to create and destroy scalable */
 
50
  /*    glyph images known as `outlines'.  These can also be measured,     */
 
51
  /*    transformed, and converted into bitmaps and pixmaps.               */
 
52
  /*                                                                       */
 
53
  /* <Order>                                                               */
 
54
  /*    FT_Outline                                                         */
 
55
  /*    FT_OUTLINE_FLAGS                                                   */
 
56
  /*    FT_Outline_New                                                     */
 
57
  /*    FT_Outline_Done                                                    */
 
58
  /*    FT_Outline_Copy                                                    */
 
59
  /*    FT_Outline_Translate                                               */
 
60
  /*    FT_Outline_Transform                                               */
 
61
  /*    FT_Outline_Reverse                                                 */
 
62
  /*    FT_Outline_Check                                                   */
 
63
  /*                                                                       */
 
64
  /*    FT_Outline_Get_CBox                                                */
 
65
  /*    FT_Outline_Get_BBox                                                */
 
66
  /*                                                                       */
 
67
  /*    FT_Outline_Get_Bitmap                                              */
 
68
  /*    FT_Outline_Render                                                  */
 
69
  /*                                                                       */
 
70
  /*    FT_Outline_Decompose                                               */
 
71
  /*    FT_Outline_Funcs                                                   */
 
72
  /*    FT_Outline_MoveTo_Func                                             */
 
73
  /*    FT_Outline_LineTo_Func                                             */
 
74
  /*    FT_Outline_ConicTo_Func                                            */
 
75
  /*    FT_Outline_CubicTo_Func                                            */
 
76
  /*                                                                       */
 
77
  /*************************************************************************/
 
78
 
 
79
 
 
80
  /*************************************************************************/
 
81
  /*                                                                       */
 
82
  /* <Function>                                                            */
 
83
  /*    FT_Outline_Decompose                                               */
 
84
  /*                                                                       */
 
85
  /* <Description>                                                         */
 
86
  /*    Walks over an outline's structure to decompose it into individual  */
 
87
  /*    segments and Bezier arcs.  This function is also able to emit      */
 
88
  /*    `move to' and `close to' operations to indicate the start and end  */
 
89
  /*    of new contours in the outline.                                    */
 
90
  /*                                                                       */
 
91
  /* <Input>                                                               */
 
92
  /*    outline        :: A pointer to the source target.                  */
 
93
  /*                                                                       */
 
94
  /*    func_interface :: A table of `emitters', i.e,. function pointers   */
 
95
  /*                      called during decomposition to indicate path     */
 
96
  /*                      operations.                                      */
 
97
  /*                                                                       */
 
98
  /* <InOut>                                                               */
 
99
  /*    user           :: A typeless pointer which is passed to each       */
 
100
  /*                      emitter during the decomposition.  It can be     */
 
101
  /*                      used to store the state during the               */
 
102
  /*                      decomposition.                                   */
 
103
  /*                                                                       */
 
104
  /* <Return>                                                              */
 
105
  /*    FreeType error code.  0 means sucess.                              */
 
106
  /*                                                                       */
 
107
  FT_EXPORT( FT_Error )
 
108
  FT_Outline_Decompose( FT_Outline*              outline,
 
109
                        const FT_Outline_Funcs*  func_interface,
 
110
                        void*                    user );
 
111
 
 
112
 
 
113
  /*************************************************************************/
 
114
  /*                                                                       */
 
115
  /* <Function>                                                            */
 
116
  /*    FT_Outline_New                                                     */
 
117
  /*                                                                       */
 
118
  /* <Description>                                                         */
 
119
  /*    Creates a new outline of a given size.                             */
 
120
  /*                                                                       */
 
121
  /* <Input>                                                               */
 
122
  /*    library     :: A handle to the library object from where the       */
 
123
  /*                   outline is allocated.  Note however that the new    */
 
124
  /*                   outline will NOT necessarily be FREED, when         */
 
125
  /*                   destroying the library, by FT_Done_FreeType().      */
 
126
  /*                                                                       */
 
127
  /*    numPoints   :: The maximal number of points within the outline.    */
 
128
  /*                                                                       */
 
129
  /*    numContours :: The maximal number of contours within the outline.  */
 
130
  /*                                                                       */
 
131
  /* <Output>                                                              */
 
132
  /*    anoutline   :: A handle to the new outline.  NULL in case of       */
 
133
  /*                   error.                                              */
 
134
  /*                                                                       */
 
135
  /* <Return>                                                              */
 
136
  /*    FreeType error code.  0 means success.                             */
 
137
  /*                                                                       */
 
138
  /* <Note>                                                                */
 
139
  /*    The reason why this function takes a `library' parameter is simply */
 
140
  /*    to use the library's memory allocator.                             */
 
141
  /*                                                                       */
 
142
  FT_EXPORT( FT_Error )
 
143
  FT_Outline_New( FT_Library   library,
 
144
                  FT_UInt      numPoints,
 
145
                  FT_Int       numContours,
 
146
                  FT_Outline  *anoutline );
 
147
 
 
148
 
 
149
  FT_EXPORT( FT_Error )
 
150
  FT_Outline_New_Internal( FT_Memory    memory,
 
151
                           FT_UInt      numPoints,
 
152
                           FT_Int       numContours,
 
153
                           FT_Outline  *anoutline );
 
154
 
 
155
 
 
156
  /*************************************************************************/
 
157
  /*                                                                       */
 
158
  /* <Function>                                                            */
 
159
  /*    FT_Outline_Done                                                    */
 
160
  /*                                                                       */
 
161
  /* <Description>                                                         */
 
162
  /*    Destroys an outline created with FT_Outline_New().                 */
 
163
  /*                                                                       */
 
164
  /* <Input>                                                               */
 
165
  /*    library :: A handle of the library object used to allocate the     */
 
166
  /*               outline.                                                */
 
167
  /*                                                                       */
 
168
  /*    outline :: A pointer to the outline object to be discarded.        */
 
169
  /*                                                                       */
 
170
  /* <Return>                                                              */
 
171
  /*    FreeType error code.  0 means success.                             */
 
172
  /*                                                                       */
 
173
  /* <Note>                                                                */
 
174
  /*    If the outline's `owner' field is not set, only the outline        */
 
175
  /*    descriptor will be released.                                       */
 
176
  /*                                                                       */
 
177
  /*    The reason why this function takes an `library' parameter is       */
 
178
  /*    simply to use FT_Free().                                           */
 
179
  /*                                                                       */
 
180
  FT_EXPORT( FT_Error )
 
181
  FT_Outline_Done( FT_Library   library,
 
182
                   FT_Outline*  outline );
 
183
 
 
184
 
 
185
  FT_EXPORT( FT_Error )
 
186
  FT_Outline_Done_Internal( FT_Memory    memory,
 
187
                            FT_Outline*  outline );
 
188
 
 
189
 
 
190
  /*************************************************************************/
 
191
  /*                                                                       */
 
192
  /* <Function>                                                            */
 
193
  /*    FT_Outline_Check                                                   */
 
194
  /*                                                                       */
 
195
  /* <Description>                                                         */
 
196
  /*    Check the contents of an outline descriptor.                       */
 
197
  /*                                                                       */
 
198
  /* <Input>                                                               */
 
199
  /*    outline :: A handle to a source outline.                           */
 
200
  /*                                                                       */
 
201
  /* <Return>                                                              */
 
202
  /*    FreeType error code.  0 means success.                             */
 
203
  /*                                                                       */
 
204
  FT_EXPORT( FT_Error )
 
205
  FT_Outline_Check( FT_Outline*  outline );
 
206
 
 
207
 
 
208
  /*************************************************************************/
 
209
  /*                                                                       */
 
210
  /* <Function>                                                            */
 
211
  /*    FT_Outline_Get_CBox                                                */
 
212
  /*                                                                       */
 
213
  /* <Description>                                                         */
 
214
  /*    Returns an outline's `control box'.  The control box encloses all  */
 
215
  /*    the outline's points, including Bezier control points.  Though it  */
 
216
  /*    coincides with the exact bounding box for most glyphs, it can be   */
 
217
  /*    slightly larger in some situations (like when rotating an outline  */
 
218
  /*    which contains Bezier outside arcs).                               */
 
219
  /*                                                                       */
 
220
  /*    Computing the control box is very fast, while getting the bounding */
 
221
  /*    box can take much more time as it needs to walk over all segments  */
 
222
  /*    and arcs in the outline.  To get the latter, you can use the       */
 
223
  /*    `ftbbox' component which is dedicated to this single task.         */
 
224
  /*                                                                       */
 
225
  /* <Input>                                                               */
 
226
  /*    outline :: A pointer to the source outline descriptor.             */
 
227
  /*                                                                       */
 
228
  /* <Output>                                                              */
 
229
  /*    acbox   :: The outline's control box.                              */
 
230
  /*                                                                       */
 
231
  FT_EXPORT( void )
 
232
  FT_Outline_Get_CBox( FT_Outline*  outline,
 
233
                       FT_BBox     *acbox );
 
234
 
 
235
 
 
236
  /*************************************************************************/
 
237
  /*                                                                       */
 
238
  /* <Function>                                                            */
 
239
  /*    FT_Outline_Translate                                               */
 
240
  /*                                                                       */
 
241
  /* <Description>                                                         */
 
242
  /*    Applies a simple translation to the points of an outline.          */
 
243
  /*                                                                       */
 
244
  /* <InOut>                                                               */
 
245
  /*    outline :: A pointer to the target outline descriptor.             */
 
246
  /*                                                                       */
 
247
  /* <Input>                                                               */
 
248
  /*    xOffset :: The horizontal offset.                                  */
 
249
  /*                                                                       */
 
250
  /*    yOffset :: The vertical offset.                                    */
 
251
  /*                                                                       */
 
252
  FT_EXPORT( void )
 
253
  FT_Outline_Translate( FT_Outline*  outline,
 
254
                        FT_Pos       xOffset,
 
255
                        FT_Pos       yOffset );
 
256
 
 
257
 
 
258
  /*************************************************************************/
 
259
  /*                                                                       */
 
260
  /* <Function>                                                            */
 
261
  /*    FT_Outline_Copy                                                    */
 
262
  /*                                                                       */
 
263
  /* <Description>                                                         */
 
264
  /*    Copies an outline into another one.  Both objects must have the    */
 
265
  /*    same sizes (number of points & number of contours) when this       */
 
266
  /*    function is called.                                                */
 
267
  /*                                                                       */
 
268
  /* <Input>                                                               */
 
269
  /*    source :: A handle to the source outline.                          */
 
270
  /*                                                                       */
 
271
  /* <Output>                                                              */
 
272
  /*    target :: A handle to the target outline.                          */
 
273
  /*                                                                       */
 
274
  /* <Return>                                                              */
 
275
  /*    FreeType error code.  0 means success.                             */
 
276
  /*                                                                       */
 
277
  FT_EXPORT( FT_Error )
 
278
  FT_Outline_Copy( FT_Outline*  source,
 
279
                   FT_Outline  *target );
 
280
 
 
281
 
 
282
  /*************************************************************************/
 
283
  /*                                                                       */
 
284
  /* <Function>                                                            */
 
285
  /*    FT_Outline_Transform                                               */
 
286
  /*                                                                       */
 
287
  /* <Description>                                                         */
 
288
  /*    Applies a simple 2x2 matrix to all of an outline's points.  Useful */
 
289
  /*    for applying rotations, slanting, flipping, etc.                   */
 
290
  /*                                                                       */
 
291
  /* <InOut>                                                               */
 
292
  /*    outline :: A pointer to the target outline descriptor.             */
 
293
  /*                                                                       */
 
294
  /* <Input>                                                               */
 
295
  /*    matrix  :: A pointer to the transformation matrix.                 */
 
296
  /*                                                                       */
 
297
  /* <Note>                                                                */
 
298
  /*    You can use FT_Outline_Translate() if you need to translate the    */
 
299
  /*    outline's points.                                                  */
 
300
  /*                                                                       */
 
301
  FT_EXPORT( void )
 
302
  FT_Outline_Transform( FT_Outline*  outline,
 
303
                        FT_Matrix*   matrix );
 
304
 
 
305
 
 
306
  /*************************************************************************/
 
307
  /*                                                                       */
 
308
  /* <Function>                                                            */
 
309
  /*    FT_Outline_Reverse                                                 */
 
310
  /*                                                                       */
 
311
  /* <Description>                                                         */
 
312
  /*    Reverses the drawing direction of an outline.  This is used to     */
 
313
  /*    ensure consistent fill conventions for mirrored glyphs.            */
 
314
  /*                                                                       */
 
315
  /* <InOut>                                                               */
 
316
  /*    outline :: A pointer to the target outline descriptor.             */
 
317
  /*                                                                       */
 
318
  /* <Note>                                                                */
 
319
  /*    This functions toggles the bit flag `FT_OUTLINE_REVERSE_FILL' in   */
 
320
  /*    the outline's `flags' field.                                       */
 
321
  /*                                                                       */
 
322
  /*    It shouldn't be used by a normal client application, unless it     */
 
323
  /*    knows what it is doing.                                            */
 
324
  /*                                                                       */
 
325
  FT_EXPORT( void )
 
326
  FT_Outline_Reverse( FT_Outline*  outline );
 
327
 
 
328
 
 
329
  /*************************************************************************/
 
330
  /*                                                                       */
 
331
  /* <Function>                                                            */
 
332
  /*    FT_Outline_Get_Bitmap                                              */
 
333
  /*                                                                       */
 
334
  /* <Description>                                                         */
 
335
  /*    Renders an outline within a bitmap.  The outline's image is simply */
 
336
  /*    OR-ed to the target bitmap.                                        */
 
337
  /*                                                                       */
 
338
  /* <Input>                                                               */
 
339
  /*    library :: A handle to a FreeType library object.                  */
 
340
  /*                                                                       */
 
341
  /*    outline :: A pointer to the source outline descriptor.             */
 
342
  /*                                                                       */
 
343
  /* <Output>                                                              */
 
344
  /*    abitmap :: A pointer to the target bitmap descriptor.              */
 
345
  /*                                                                       */
 
346
  /* <Return>                                                              */
 
347
  /*    FreeType error code.  0 means success.                             */
 
348
  /*                                                                       */
 
349
  /* <Note>                                                                */
 
350
  /*    This function does NOT CREATE the bitmap, it only renders an       */
 
351
  /*    outline image within the one you pass to it!                       */
 
352
  /*                                                                       */
 
353
  /*    It will use the raster correponding to the default glyph format.   */
 
354
  /*                                                                       */
 
355
  FT_EXPORT( FT_Error )
 
356
  FT_Outline_Get_Bitmap( FT_Library   library,
 
357
                         FT_Outline*  outline,
 
358
                         FT_Bitmap   *abitmap );
 
359
 
 
360
 
 
361
  /*************************************************************************/
 
362
  /*                                                                       */
 
363
  /* <Function>                                                            */
 
364
  /*    FT_Outline_Render                                                  */
 
365
  /*                                                                       */
 
366
  /* <Description>                                                         */
 
367
  /*    Renders an outline within a bitmap using the current scan-convert. */
 
368
  /*    This functions uses an FT_Raster_Params structure as an argument,  */
 
369
  /*    allowing advanced features like direct composition, translucency,  */
 
370
  /*    etc.                                                               */
 
371
  /*                                                                       */
 
372
  /* <Input>                                                               */
 
373
  /*    library :: A handle to a FreeType library object.                  */
 
374
  /*                                                                       */
 
375
  /*    outline :: A pointer to the source outline descriptor.             */
 
376
  /*                                                                       */
 
377
  /* <InOut>                                                               */
 
378
  /*    params  :: A pointer to a FT_Raster_Params structure used to       */
 
379
  /*               describe the rendering operation.                       */
 
380
  /*                                                                       */
 
381
  /* <Return>                                                              */
 
382
  /*    FreeType error code.  0 means success.                             */
 
383
  /*                                                                       */
 
384
  /* <Note>                                                                */
 
385
  /*    You should know what you are doing and how FT_Raster_Params works  */
 
386
  /*    to use this function.                                              */
 
387
  /*                                                                       */
 
388
  /*    The field `params.source' will be set to `outline' before the scan */
 
389
  /*    converter is called, which means that the value you give to it is  */
 
390
  /*    actually ignored.                                                  */
 
391
  /*                                                                       */
 
392
  FT_EXPORT( FT_Error )
 
393
  FT_Outline_Render( FT_Library         library,
 
394
                     FT_Outline*        outline,
 
395
                     FT_Raster_Params*  params );
 
396
 
 
397
 
 
398
 /**************************************************************************
 
399
  *
 
400
  * @enum:
 
401
  *   FT_Orientation
 
402
  *  
 
403
  * @description:
 
404
  *   A list of values used to describe an outline's contour orientation.
 
405
  *
 
406
  *   The TrueType and Postscript specifications use different conventions
 
407
  *   to determine whether outline contours should be filled or unfilled.
 
408
  *   
 
409
  * @values:
 
410
  *   FT_ORIENTATION_TRUETYPE ::
 
411
  *     According to the TrueType specification, clockwise contours must
 
412
  *     be filled, and counter-clockwise ones must be unfilled.
 
413
  *
 
414
  *   FT_ORIENTATION_POSTSCRIPT ::
 
415
  *     According to the Postscript specification, counter-clockwise contours
 
416
  *     must be filled, and clockwise ones must be unfilled.
 
417
  *
 
418
  *   FT_ORIENTATION_FILL_RIGHT ::
 
419
  *     This is identical to @FT_ORIENTATION_TRUETYPE, but is used to
 
420
  *     remember that in TrueType, everything that is to the right of
 
421
  *     the drawing direction of a contour must be filled.
 
422
  *
 
423
  *   FT_ORIENTATION_FILL_LEFT ::
 
424
  *     This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to
 
425
  *     remember that in Postscript, everything that is to the left of
 
426
  *     the drawing direction of a contour must be filled.
 
427
  */
 
428
  typedef enum
 
429
  {
 
430
    FT_ORIENTATION_TRUETYPE   = 0,
 
431
    FT_ORIENTATION_POSTSCRIPT = 1,
 
432
    FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE,
 
433
    FT_ORIENTATION_FILL_LEFT  = FT_ORIENTATION_POSTSCRIPT
 
434
  
 
435
  } FT_Orientation;
 
436
 
 
437
 
 
438
 /**************************************************************************
 
439
  *
 
440
  * @function:
 
441
  *   FT_Outline_Get_Orientation
 
442
  *  
 
443
  * @description:
 
444
  *   This function analyzes a glyph outline and tries to compute its
 
445
  *   fill orientation (see @FT_Orientation).  This is done by computing
 
446
  *   the direction of each global horizontal and/or vertical extrema
 
447
  *   within the outline.
 
448
  *
 
449
  *   Note that this will return @FT_ORIENTATION_TRUETYPE for empty
 
450
  *   outlines.
 
451
  *
 
452
  * @input:
 
453
  *   outline ::
 
454
  *     A handle to the source outline.
 
455
  *
 
456
  * @return:
 
457
  *   The orientation.
 
458
  *
 
459
  */
 
460
  FT_EXPORT( FT_Orientation )
 
461
  FT_Outline_Get_Orientation( FT_Outline*  outline );
 
462
 
 
463
 
 
464
  /* */
 
465
 
 
466
 
 
467
FT_END_HEADER
 
468
 
 
469
#endif /* __FTOUTLN_H__ */
 
470
 
 
471
 
 
472
/* END */