PageRenderTime 771ms CodeModel.GetById 175ms app.highlight 250ms RepoModel.GetById 249ms app.codeStats 1ms

/src/compiler/android-ndk/jni/freetype/include/freetype/ftimage.h

http://ftk.googlecode.com/
C++ Header | 1042 lines | 170 code | 102 blank | 770 comment | 0 complexity | ed6e8727abd9693d4a78f42b9b7e6c20 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1/***************************************************************************/
  2/*                                                                         */
  3/*  ftimage.h                                                              */
  4/*                                                                         */
  5/*    FreeType glyph image formats and default raster interface            */
  6/*    (specification).                                                     */
  7/*                                                                         */
  8/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,   */
  9/*            2010 by                                                      */
 10/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 11/*                                                                         */
 12/*  This file is part of the FreeType project, and may only be used,       */
 13/*  modified, and distributed under the terms of the FreeType project      */
 14/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
 15/*  this file you indicate that you have read the license and              */
 16/*  understand and accept it fully.                                        */
 17/*                                                                         */
 18/***************************************************************************/
 19
 20  /*************************************************************************/
 21  /*                                                                       */
 22  /* Note: A `raster' is simply a scan-line converter, used to render      */
 23  /*       FT_Outlines into FT_Bitmaps.                                    */
 24  /*                                                                       */
 25  /*************************************************************************/
 26
 27
 28#ifndef __FTIMAGE_H__
 29#define __FTIMAGE_H__
 30
 31
 32  /* _STANDALONE_ is from ftgrays.c */
 33#ifndef _STANDALONE_
 34#include <ft2build.h>
 35#endif
 36
 37
 38FT_BEGIN_HEADER
 39
 40
 41  /*************************************************************************/
 42  /*                                                                       */
 43  /* <Section>                                                             */
 44  /*    basic_types                                                        */
 45  /*                                                                       */
 46  /*************************************************************************/
 47
 48
 49  /*************************************************************************/
 50  /*                                                                       */
 51  /* <Type>                                                                */
 52  /*    FT_Pos                                                             */
 53  /*                                                                       */
 54  /* <Description>                                                         */
 55  /*    The type FT_Pos is used to store vectorial coordinates.  Depending */
 56  /*    on the context, these can represent distances in integer font      */
 57  /*    units, or 16.16, or 26.6 fixed float pixel coordinates.            */
 58  /*                                                                       */
 59  typedef signed long  FT_Pos;
 60
 61
 62  /*************************************************************************/
 63  /*                                                                       */
 64  /* <Struct>                                                              */
 65  /*    FT_Vector                                                          */
 66  /*                                                                       */
 67  /* <Description>                                                         */
 68  /*    A simple structure used to store a 2D vector; coordinates are of   */
 69  /*    the FT_Pos type.                                                   */
 70  /*                                                                       */
 71  /* <Fields>                                                              */
 72  /*    x :: The horizontal coordinate.                                    */
 73  /*    y :: The vertical coordinate.                                      */
 74  /*                                                                       */
 75  typedef struct  FT_Vector_
 76  {
 77    FT_Pos  x;
 78    FT_Pos  y;
 79
 80  } FT_Vector;
 81
 82
 83  /*************************************************************************/
 84  /*                                                                       */
 85  /* <Struct>                                                              */
 86  /*    FT_BBox                                                            */
 87  /*                                                                       */
 88  /* <Description>                                                         */
 89  /*    A structure used to hold an outline's bounding box, i.e., the      */
 90  /*    coordinates of its extrema in the horizontal and vertical          */
 91  /*    directions.                                                        */
 92  /*                                                                       */
 93  /* <Fields>                                                              */
 94  /*    xMin :: The horizontal minimum (left-most).                        */
 95  /*                                                                       */
 96  /*    yMin :: The vertical minimum (bottom-most).                        */
 97  /*                                                                       */
 98  /*    xMax :: The horizontal maximum (right-most).                       */
 99  /*                                                                       */
100  /*    yMax :: The vertical maximum (top-most).                           */
101  /*                                                                       */
102  /* <Note>                                                                */
103  /*    The bounding box is specified with the coordinates of the lower    */
104  /*    left and the upper right corner.  In PostScript, those values are  */
105  /*    often called (llx,lly) and (urx,ury), respectively.                */
106  /*                                                                       */
107  /*    If `yMin' is negative, this value gives the glyph's descender.     */
108  /*    Otherwise, the glyph doesn't descend below the baseline.           */
109  /*    Similarly, if `ymax' is positive, this value gives the glyph's     */
110  /*    ascender.                                                          */
111  /*                                                                       */
112  /*    `xMin' gives the horizontal distance from the glyph's origin to    */
113  /*    the left edge of the glyph's bounding box.  If `xMin' is negative, */
114  /*    the glyph extends to the left of the origin.                       */
115  /*                                                                       */
116  typedef struct  FT_BBox_
117  {
118    FT_Pos  xMin, yMin;
119    FT_Pos  xMax, yMax;
120
121  } FT_BBox;
122
123
124  /*************************************************************************/
125  /*                                                                       */
126  /* <Enum>                                                                */
127  /*    FT_Pixel_Mode                                                      */
128  /*                                                                       */
129  /* <Description>                                                         */
130  /*    An enumeration type used to describe the format of pixels in a     */
131  /*    given bitmap.  Note that additional formats may be added in the    */
132  /*    future.                                                            */
133  /*                                                                       */
134  /* <Values>                                                              */
135  /*    FT_PIXEL_MODE_NONE ::                                              */
136  /*      Value~0 is reserved.                                             */
137  /*                                                                       */
138  /*    FT_PIXEL_MODE_MONO ::                                              */
139  /*      A monochrome bitmap, using 1~bit per pixel.  Note that pixels    */
140  /*      are stored in most-significant order (MSB), which means that     */
141  /*      the left-most pixel in a byte has value 128.                     */
142  /*                                                                       */
143  /*    FT_PIXEL_MODE_GRAY ::                                              */
144  /*      An 8-bit bitmap, generally used to represent anti-aliased glyph  */
145  /*      images.  Each pixel is stored in one byte.  Note that the number */
146  /*      of `gray' levels is stored in the `num_grays' field of the       */
147  /*      @FT_Bitmap structure (it generally is 256).                      */
148  /*                                                                       */
149  /*    FT_PIXEL_MODE_GRAY2 ::                                             */
150  /*      A 2-bit per pixel bitmap, used to represent embedded             */
151  /*      anti-aliased bitmaps in font files according to the OpenType     */
152  /*      specification.  We haven't found a single font using this        */
153  /*      format, however.                                                 */
154  /*                                                                       */
155  /*    FT_PIXEL_MODE_GRAY4 ::                                             */
156  /*      A 4-bit per pixel bitmap, representing embedded anti-aliased     */
157  /*      bitmaps in font files according to the OpenType specification.   */
158  /*      We haven't found a single font using this format, however.       */
159  /*                                                                       */
160  /*    FT_PIXEL_MODE_LCD ::                                               */
161  /*      An 8-bit bitmap, representing RGB or BGR decimated glyph images  */
162  /*      used for display on LCD displays; the bitmap is three times      */
163  /*      wider than the original glyph image.  See also                   */
164  /*      @FT_RENDER_MODE_LCD.                                             */
165  /*                                                                       */
166  /*    FT_PIXEL_MODE_LCD_V ::                                             */
167  /*      An 8-bit bitmap, representing RGB or BGR decimated glyph images  */
168  /*      used for display on rotated LCD displays; the bitmap is three    */
169  /*      times taller than the original glyph image.  See also            */
170  /*      @FT_RENDER_MODE_LCD_V.                                           */
171  /*                                                                       */
172  typedef enum  FT_Pixel_Mode_
173  {
174    FT_PIXEL_MODE_NONE = 0,
175    FT_PIXEL_MODE_MONO,
176    FT_PIXEL_MODE_GRAY,
177    FT_PIXEL_MODE_GRAY2,
178    FT_PIXEL_MODE_GRAY4,
179    FT_PIXEL_MODE_LCD,
180    FT_PIXEL_MODE_LCD_V,
181
182    FT_PIXEL_MODE_MAX      /* do not remove */
183
184  } FT_Pixel_Mode;
185
186
187  /*************************************************************************/
188  /*                                                                       */
189  /* <Enum>                                                                */
190  /*    ft_pixel_mode_xxx                                                  */
191  /*                                                                       */
192  /* <Description>                                                         */
193  /*    A list of deprecated constants.  Use the corresponding             */
194  /*    @FT_Pixel_Mode values instead.                                     */
195  /*                                                                       */
196  /* <Values>                                                              */
197  /*    ft_pixel_mode_none  :: See @FT_PIXEL_MODE_NONE.                    */
198  /*    ft_pixel_mode_mono  :: See @FT_PIXEL_MODE_MONO.                    */
199  /*    ft_pixel_mode_grays :: See @FT_PIXEL_MODE_GRAY.                    */
200  /*    ft_pixel_mode_pal2  :: See @FT_PIXEL_MODE_GRAY2.                   */
201  /*    ft_pixel_mode_pal4  :: See @FT_PIXEL_MODE_GRAY4.                   */
202  /*                                                                       */
203#define ft_pixel_mode_none   FT_PIXEL_MODE_NONE
204#define ft_pixel_mode_mono   FT_PIXEL_MODE_MONO
205#define ft_pixel_mode_grays  FT_PIXEL_MODE_GRAY
206#define ft_pixel_mode_pal2   FT_PIXEL_MODE_GRAY2
207#define ft_pixel_mode_pal4   FT_PIXEL_MODE_GRAY4
208
209 /* */
210
211#if 0
212
213  /*************************************************************************/
214  /*                                                                       */
215  /* <Enum>                                                                */
216  /*    FT_Palette_Mode                                                    */
217  /*                                                                       */
218  /* <Description>                                                         */
219  /*    THIS TYPE IS DEPRECATED.  DO NOT USE IT!                           */
220  /*                                                                       */
221  /*    An enumeration type to describe the format of a bitmap palette,    */
222  /*    used with ft_pixel_mode_pal4 and ft_pixel_mode_pal8.               */
223  /*                                                                       */
224  /* <Values>                                                              */
225  /*    ft_palette_mode_rgb  :: The palette is an array of 3-byte RGB      */
226  /*                            records.                                   */
227  /*                                                                       */
228  /*    ft_palette_mode_rgba :: The palette is an array of 4-byte RGBA     */
229  /*                            records.                                   */
230  /*                                                                       */
231  /* <Note>                                                                */
232  /*    As ft_pixel_mode_pal2, pal4 and pal8 are currently unused by       */
233  /*    FreeType, these types are not handled by the library itself.       */
234  /*                                                                       */
235  typedef enum  FT_Palette_Mode_
236  {
237    ft_palette_mode_rgb = 0,
238    ft_palette_mode_rgba,
239
240    ft_palette_mode_max   /* do not remove */
241
242  } FT_Palette_Mode;
243
244  /* */
245
246#endif
247
248
249  /*************************************************************************/
250  /*                                                                       */
251  /* <Struct>                                                              */
252  /*    FT_Bitmap                                                          */
253  /*                                                                       */
254  /* <Description>                                                         */
255  /*    A structure used to describe a bitmap or pixmap to the raster.     */
256  /*    Note that we now manage pixmaps of various depths through the      */
257  /*    `pixel_mode' field.                                                */
258  /*                                                                       */
259  /* <Fields>                                                              */
260  /*    rows         :: The number of bitmap rows.                         */
261  /*                                                                       */
262  /*    width        :: The number of pixels in bitmap row.                */
263  /*                                                                       */
264  /*    pitch        :: The pitch's absolute value is the number of bytes  */
265  /*                    taken by one bitmap row, including padding.        */
266  /*                    However, the pitch is positive when the bitmap has */
267  /*                    a `down' flow, and negative when it has an `up'    */
268  /*                    flow.  In all cases, the pitch is an offset to add */
269  /*                    to a bitmap pointer in order to go down one row.   */
270  /*                                                                       */
271  /*                    For the B/W rasterizer, `pitch' is always an even  */
272  /*                    number.                                            */
273  /*                                                                       */
274  /*    buffer       :: A typeless pointer to the bitmap buffer.  This     */
275  /*                    value should be aligned on 32-bit boundaries in    */
276  /*                    most cases.                                        */
277  /*                                                                       */
278  /*    num_grays    :: This field is only used with                       */
279  /*                    @FT_PIXEL_MODE_GRAY; it gives the number of gray   */
280  /*                    levels used in the bitmap.                         */
281  /*                                                                       */
282  /*    pixel_mode   :: The pixel mode, i.e., how pixel bits are stored.   */
283  /*                    See @FT_Pixel_Mode for possible values.            */
284  /*                                                                       */
285  /*    palette_mode :: This field is intended for paletted pixel modes;   */
286  /*                    it indicates how the palette is stored.  Not       */
287  /*                    used currently.                                    */
288  /*                                                                       */
289  /*    palette      :: A typeless pointer to the bitmap palette; this     */
290  /*                    field is intended for paletted pixel modes.  Not   */
291  /*                    used currently.                                    */
292  /*                                                                       */
293  /* <Note>                                                                */
294  /*   For now, the only pixel modes supported by FreeType are mono and    */
295  /*   grays.  However, drivers might be added in the future to support    */
296  /*   more `colorful' options.                                            */
297  /*                                                                       */
298  typedef struct  FT_Bitmap_
299  {
300    int             rows;
301    int             width;
302    int             pitch;
303    unsigned char*  buffer;
304    short           num_grays;
305    char            pixel_mode;
306    char            palette_mode;
307    void*           palette;
308
309  } FT_Bitmap;
310
311
312  /*************************************************************************/
313  /*                                                                       */
314  /* <Section>                                                             */
315  /*    outline_processing                                                 */
316  /*                                                                       */
317  /*************************************************************************/
318
319
320  /*************************************************************************/
321  /*                                                                       */
322  /* <Struct>                                                              */
323  /*    FT_Outline                                                         */
324  /*                                                                       */
325  /* <Description>                                                         */
326  /*    This structure is used to describe an outline to the scan-line     */
327  /*    converter.                                                         */
328  /*                                                                       */
329  /* <Fields>                                                              */
330  /*    n_contours :: The number of contours in the outline.               */
331  /*                                                                       */
332  /*    n_points   :: The number of points in the outline.                 */
333  /*                                                                       */
334  /*    points     :: A pointer to an array of `n_points' @FT_Vector       */
335  /*                  elements, giving the outline's point coordinates.    */
336  /*                                                                       */
337  /*    tags       :: A pointer to an array of `n_points' chars, giving    */
338  /*                  each outline point's type.                           */
339  /*                                                                       */
340  /*                  If bit~0 is unset, the point is `off' the curve,     */
341  /*                  i.e., a Bézier control point, while it is `on' if    */
342  /*                  set.                                                 */
343  /*                                                                       */
344  /*                  Bit~1 is meaningful for `off' points only.  If set,  */
345  /*                  it indicates a third-order Bézier arc control point; */
346  /*                  and a second-order control point if unset.           */
347  /*                                                                       */
348  /*                  If bit~2 is set, bits 5-7 contain the drop-out mode  */
349  /*                  (as defined in the OpenType specification; the value */
350  /*                  is the same as the argument to the SCANMODE          */
351  /*                  instruction).                                        */
352  /*                                                                       */
353  /*                  Bits 3 and~4 are reserved for internal purposes.     */
354  /*                                                                       */
355  /*    contours   :: An array of `n_contours' shorts, giving the end      */
356  /*                  point of each contour within the outline.  For       */
357  /*                  example, the first contour is defined by the points  */
358  /*                  `0' to `contours[0]', the second one is defined by   */
359  /*                  the points `contours[0]+1' to `contours[1]', etc.    */
360  /*                                                                       */
361  /*    flags      :: A set of bit flags used to characterize the outline  */
362  /*                  and give hints to the scan-converter and hinter on   */
363  /*                  how to convert/grid-fit it.  See @FT_OUTLINE_FLAGS.  */
364  /*                                                                       */
365  /* <Note>                                                                */
366  /*    The B/W rasterizer only checks bit~2 in the `tags' array for the   */
367  /*    first point of each contour.  The drop-out mode as given with      */
368  /*    @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, and       */
369  /*    @FT_OUTLINE_INCLUDE_STUBS in `flags' is then overridden.           */
370  /*                                                                       */
371  typedef struct  FT_Outline_
372  {
373    short       n_contours;      /* number of contours in glyph        */
374    short       n_points;        /* number of points in the glyph      */
375
376    FT_Vector*  points;          /* the outline's points               */
377    char*       tags;            /* the points flags                   */
378    short*      contours;        /* the contour end points             */
379
380    int         flags;           /* outline masks                      */
381
382  } FT_Outline;
383
384  /* Following limits must be consistent with */
385  /* FT_Outline.{n_contours,n_points}         */
386#define FT_OUTLINE_CONTOURS_MAX  SHRT_MAX
387#define FT_OUTLINE_POINTS_MAX    SHRT_MAX
388
389
390  /*************************************************************************/
391  /*                                                                       */
392  /* <Enum>                                                                */
393  /*    FT_OUTLINE_FLAGS                                                   */
394  /*                                                                       */
395  /* <Description>                                                         */
396  /*    A list of bit-field constants use for the flags in an outline's    */
397  /*    `flags' field.                                                     */
398  /*                                                                       */
399  /* <Values>                                                              */
400  /*    FT_OUTLINE_NONE ::                                                 */
401  /*      Value~0 is reserved.                                             */
402  /*                                                                       */
403  /*    FT_OUTLINE_OWNER ::                                                */
404  /*      If set, this flag indicates that the outline's field arrays      */
405  /*      (i.e., `points', `flags', and `contours') are `owned' by the     */
406  /*      outline object, and should thus be freed when it is destroyed.   */
407  /*                                                                       */
408  /*    FT_OUTLINE_EVEN_ODD_FILL ::                                        */
409  /*      By default, outlines are filled using the non-zero winding rule. */
410  /*      If set to 1, the outline will be filled using the even-odd fill  */
411  /*      rule (only works with the smooth rasterizer).                    */
412  /*                                                                       */
413  /*    FT_OUTLINE_REVERSE_FILL ::                                         */
414  /*      By default, outside contours of an outline are oriented in       */
415  /*      clock-wise direction, as defined in the TrueType specification.  */
416  /*      This flag is set if the outline uses the opposite direction      */
417  /*      (typically for Type~1 fonts).  This flag is ignored by the scan  */
418  /*      converter.                                                       */
419  /*                                                                       */
420  /*    FT_OUTLINE_IGNORE_DROPOUTS ::                                      */
421  /*      By default, the scan converter will try to detect drop-outs in   */
422  /*      an outline and correct the glyph bitmap to ensure consistent     */
423  /*      shape continuity.  If set, this flag hints the scan-line         */
424  /*      converter to ignore such cases.  See below for more information. */
425  /*                                                                       */
426  /*    FT_OUTLINE_SMART_DROPOUTS ::                                       */
427  /*      Select smart dropout control.  If unset, use simple dropout      */
428  /*      control.  Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set.  See    */
429  /*      below for more information.                                      */
430  /*                                                                       */
431  /*    FT_OUTLINE_INCLUDE_STUBS ::                                        */
432  /*      If set, turn pixels on for `stubs', otherwise exclude them.      */
433  /*      Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set.  See below for    */
434  /*      more information.                                                */
435  /*                                                                       */
436  /*    FT_OUTLINE_HIGH_PRECISION ::                                       */
437  /*      This flag indicates that the scan-line converter should try to   */
438  /*      convert this outline to bitmaps with the highest possible        */
439  /*      quality.  It is typically set for small character sizes.  Note   */
440  /*      that this is only a hint that might be completely ignored by a   */
441  /*      given scan-converter.                                            */
442  /*                                                                       */
443  /*    FT_OUTLINE_SINGLE_PASS ::                                          */
444  /*      This flag is set to force a given scan-converter to only use a   */
445  /*      single pass over the outline to render a bitmap glyph image.     */
446  /*      Normally, it is set for very large character sizes.  It is only  */
447  /*      a hint that might be completely ignored by a given               */
448  /*      scan-converter.                                                  */
449  /*                                                                       */
450  /* <Note>                                                                */
451  /*    The flags @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, */
452  /*    and @FT_OUTLINE_INCLUDE_STUBS are ignored by the smooth            */
453  /*    rasterizer.                                                        */
454  /*                                                                       */
455  /*    There exists a second mechanism to pass the drop-out mode to the   */
456  /*    B/W rasterizer; see the `tags' field in @FT_Outline.               */
457  /*                                                                       */
458  /*    Please refer to the description of the `SCANTYPE' instruction in   */
459  /*    the OpenType specification (in file `ttinst1.doc') how simple      */
460  /*    drop-outs, smart drop-outs, and stubs are defined.                 */
461  /*                                                                       */
462#define FT_OUTLINE_NONE             0x0
463#define FT_OUTLINE_OWNER            0x1
464#define FT_OUTLINE_EVEN_ODD_FILL    0x2
465#define FT_OUTLINE_REVERSE_FILL     0x4
466#define FT_OUTLINE_IGNORE_DROPOUTS  0x8
467#define FT_OUTLINE_SMART_DROPOUTS   0x10
468#define FT_OUTLINE_INCLUDE_STUBS    0x20
469
470#define FT_OUTLINE_HIGH_PRECISION   0x100
471#define FT_OUTLINE_SINGLE_PASS      0x200
472
473
474 /*************************************************************************
475  *
476  * @enum:
477  *   ft_outline_flags
478  *
479  * @description:
480  *   These constants are deprecated.  Please use the corresponding
481  *   @FT_OUTLINE_FLAGS values.
482  *
483  * @values:
484  *   ft_outline_none            :: See @FT_OUTLINE_NONE.
485  *   ft_outline_owner           :: See @FT_OUTLINE_OWNER.
486  *   ft_outline_even_odd_fill   :: See @FT_OUTLINE_EVEN_ODD_FILL.
487  *   ft_outline_reverse_fill    :: See @FT_OUTLINE_REVERSE_FILL.
488  *   ft_outline_ignore_dropouts :: See @FT_OUTLINE_IGNORE_DROPOUTS.
489  *   ft_outline_high_precision  :: See @FT_OUTLINE_HIGH_PRECISION.
490  *   ft_outline_single_pass     :: See @FT_OUTLINE_SINGLE_PASS.
491  */
492#define ft_outline_none             FT_OUTLINE_NONE
493#define ft_outline_owner            FT_OUTLINE_OWNER
494#define ft_outline_even_odd_fill    FT_OUTLINE_EVEN_ODD_FILL
495#define ft_outline_reverse_fill     FT_OUTLINE_REVERSE_FILL
496#define ft_outline_ignore_dropouts  FT_OUTLINE_IGNORE_DROPOUTS
497#define ft_outline_high_precision   FT_OUTLINE_HIGH_PRECISION
498#define ft_outline_single_pass      FT_OUTLINE_SINGLE_PASS
499
500  /* */
501
502#define FT_CURVE_TAG( flag )  ( flag & 3 )
503
504#define FT_CURVE_TAG_ON            1
505#define FT_CURVE_TAG_CONIC         0
506#define FT_CURVE_TAG_CUBIC         2
507
508#define FT_CURVE_TAG_HAS_SCANMODE  4
509
510#define FT_CURVE_TAG_TOUCH_X       8  /* reserved for the TrueType hinter */
511#define FT_CURVE_TAG_TOUCH_Y      16  /* reserved for the TrueType hinter */
512
513#define FT_CURVE_TAG_TOUCH_BOTH    ( FT_CURVE_TAG_TOUCH_X | \
514                                     FT_CURVE_TAG_TOUCH_Y )
515
516#define FT_Curve_Tag_On       FT_CURVE_TAG_ON
517#define FT_Curve_Tag_Conic    FT_CURVE_TAG_CONIC
518#define FT_Curve_Tag_Cubic    FT_CURVE_TAG_CUBIC
519#define FT_Curve_Tag_Touch_X  FT_CURVE_TAG_TOUCH_X
520#define FT_Curve_Tag_Touch_Y  FT_CURVE_TAG_TOUCH_Y
521
522
523  /*************************************************************************/
524  /*                                                                       */
525  /* <FuncType>                                                            */
526  /*    FT_Outline_MoveToFunc                                              */
527  /*                                                                       */
528  /* <Description>                                                         */
529  /*    A function pointer type used to describe the signature of a `move  */
530  /*    to' function during outline walking/decomposition.                 */
531  /*                                                                       */
532  /*    A `move to' is emitted to start a new contour in an outline.       */
533  /*                                                                       */
534  /* <Input>                                                               */
535  /*    to   :: A pointer to the target point of the `move to'.            */
536  /*                                                                       */
537  /*    user :: A typeless pointer which is passed from the caller of the  */
538  /*            decomposition function.                                    */
539  /*                                                                       */
540  /* <Return>                                                              */
541  /*    Error code.  0~means success.                                      */
542  /*                                                                       */
543  typedef int
544  (*FT_Outline_MoveToFunc)( const FT_Vector*  to,
545                            void*             user );
546
547#define FT_Outline_MoveTo_Func  FT_Outline_MoveToFunc
548
549
550  /*************************************************************************/
551  /*                                                                       */
552  /* <FuncType>                                                            */
553  /*    FT_Outline_LineToFunc                                              */
554  /*                                                                       */
555  /* <Description>                                                         */
556  /*    A function pointer type used to describe the signature of a `line  */
557  /*    to' function during outline walking/decomposition.                 */
558  /*                                                                       */
559  /*    A `line to' is emitted to indicate a segment in the outline.       */
560  /*                                                                       */
561  /* <Input>                                                               */
562  /*    to   :: A pointer to the target point of the `line to'.            */
563  /*                                                                       */
564  /*    user :: A typeless pointer which is passed from the caller of the  */
565  /*            decomposition function.                                    */
566  /*                                                                       */
567  /* <Return>                                                              */
568  /*    Error code.  0~means success.                                      */
569  /*                                                                       */
570  typedef int
571  (*FT_Outline_LineToFunc)( const FT_Vector*  to,
572                            void*             user );
573
574#define FT_Outline_LineTo_Func  FT_Outline_LineToFunc
575
576
577  /*************************************************************************/
578  /*                                                                       */
579  /* <FuncType>                                                            */
580  /*    FT_Outline_ConicToFunc                                             */
581  /*                                                                       */
582  /* <Description>                                                         */
583  /*    A function pointer type used to describe the signature of a `conic */
584  /*    to' function during outline walking or decomposition.              */
585  /*                                                                       */
586  /*    A `conic to' is emitted to indicate a second-order Bézier arc in   */
587  /*    the outline.                                                       */
588  /*                                                                       */
589  /* <Input>                                                               */
590  /*    control :: An intermediate control point between the last position */
591  /*               and the new target in `to'.                             */
592  /*                                                                       */
593  /*    to      :: A pointer to the target end point of the conic arc.     */
594  /*                                                                       */
595  /*    user    :: A typeless pointer which is passed from the caller of   */
596  /*               the decomposition function.                             */
597  /*                                                                       */
598  /* <Return>                                                              */
599  /*    Error code.  0~means success.                                      */
600  /*                                                                       */
601  typedef int
602  (*FT_Outline_ConicToFunc)( const FT_Vector*  control,
603                             const FT_Vector*  to,
604                             void*             user );
605
606#define FT_Outline_ConicTo_Func  FT_Outline_ConicToFunc
607
608
609  /*************************************************************************/
610  /*                                                                       */
611  /* <FuncType>                                                            */
612  /*    FT_Outline_CubicToFunc                                             */
613  /*                                                                       */
614  /* <Description>                                                         */
615  /*    A function pointer type used to describe the signature of a `cubic */
616  /*    to' function during outline walking or decomposition.              */
617  /*                                                                       */
618  /*    A `cubic to' is emitted to indicate a third-order Bézier arc.      */
619  /*                                                                       */
620  /* <Input>                                                               */
621  /*    control1 :: A pointer to the first Bézier control point.           */
622  /*                                                                       */
623  /*    control2 :: A pointer to the second Bézier control point.          */
624  /*                                                                       */
625  /*    to       :: A pointer to the target end point.                     */
626  /*                                                                       */
627  /*    user     :: A typeless pointer which is passed from the caller of  */
628  /*                the decomposition function.                            */
629  /*                                                                       */
630  /* <Return>                                                              */
631  /*    Error code.  0~means success.                                      */
632  /*                                                                       */
633  typedef int
634  (*FT_Outline_CubicToFunc)( const FT_Vector*  control1,
635                             const FT_Vector*  control2,
636                             const FT_Vector*  to,
637                             void*             user );
638
639#define FT_Outline_CubicTo_Func  FT_Outline_CubicToFunc
640
641
642  /*************************************************************************/
643  /*                                                                       */
644  /* <Struct>                                                              */
645  /*    FT_Outline_Funcs                                                   */
646  /*                                                                       */
647  /* <Description>                                                         */
648  /*    A structure to hold various function pointers used during outline  */
649  /*    decomposition in order to emit segments, conic, and cubic Béziers. */
650  /*                                                                       */
651  /* <Fields>                                                              */
652  /*    move_to  :: The `move to' emitter.                                 */
653  /*                                                                       */
654  /*    line_to  :: The segment emitter.                                   */
655  /*                                                                       */
656  /*    conic_to :: The second-order Bézier arc emitter.                   */
657  /*                                                                       */
658  /*    cubic_to :: The third-order Bézier arc emitter.                    */
659  /*                                                                       */
660  /*    shift    :: The shift that is applied to coordinates before they   */
661  /*                are sent to the emitter.                               */
662  /*                                                                       */
663  /*    delta    :: The delta that is applied to coordinates before they   */
664  /*                are sent to the emitter, but after the shift.          */
665  /*                                                                       */
666  /* <Note>                                                                */
667  /*    The point coordinates sent to the emitters are the transformed     */
668  /*    version of the original coordinates (this is important for high    */
669  /*    accuracy during scan-conversion).  The transformation is simple:   */
670  /*                                                                       */
671  /*    {                                                                  */
672  /*      x' = (x << shift) - delta                                        */
673  /*      y' = (x << shift) - delta                                        */
674  /*    }                                                                  */
675  /*                                                                       */
676  /*    Set the values of `shift' and `delta' to~0 to get the original     */
677  /*    point coordinates.                                                 */
678  /*                                                                       */
679  typedef struct  FT_Outline_Funcs_
680  {
681    FT_Outline_MoveToFunc   move_to;
682    FT_Outline_LineToFunc   line_to;
683    FT_Outline_ConicToFunc  conic_to;
684    FT_Outline_CubicToFunc  cubic_to;
685
686    int                     shift;
687    FT_Pos                  delta;
688
689  } FT_Outline_Funcs;
690
691
692  /*************************************************************************/
693  /*                                                                       */
694  /* <Section>                                                             */
695  /*    basic_types                                                        */
696  /*                                                                       */
697  /*************************************************************************/
698
699
700  /*************************************************************************/
701  /*                                                                       */
702  /* <Macro>                                                               */
703  /*    FT_IMAGE_TAG                                                       */
704  /*                                                                       */
705  /* <Description>                                                         */
706  /*    This macro converts four-letter tags to an unsigned long type.     */
707  /*                                                                       */
708  /* <Note>                                                                */
709  /*    Since many 16-bit compilers don't like 32-bit enumerations, you    */
710  /*    should redefine this macro in case of problems to something like   */
711  /*    this:                                                              */
712  /*                                                                       */
713  /*    {                                                                  */
714  /*      #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 )  value         */
715  /*    }                                                                  */
716  /*                                                                       */
717  /*    to get a simple enumeration without assigning special numbers.     */
718  /*                                                                       */
719#ifndef FT_IMAGE_TAG
720#define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 )  \
721          value = ( ( (unsigned long)_x1 << 24 ) | \
722                    ( (unsigned long)_x2 << 16 ) | \
723                    ( (unsigned long)_x3 << 8  ) | \
724                      (unsigned long)_x4         )
725#endif /* FT_IMAGE_TAG */
726
727
728  /*************************************************************************/
729  /*                                                                       */
730  /* <Enum>                                                                */
731  /*    FT_Glyph_Format                                                    */
732  /*                                                                       */
733  /* <Description>                                                         */
734  /*    An enumeration type used to describe the format of a given glyph   */
735  /*    image.  Note that this version of FreeType only supports two image */
736  /*    formats, even though future font drivers will be able to register  */
737  /*    their own format.                                                  */
738  /*                                                                       */
739  /* <Values>                                                              */
740  /*    FT_GLYPH_FORMAT_NONE ::                                            */
741  /*      The value~0 is reserved.                                         */
742  /*                                                                       */
743  /*    FT_GLYPH_FORMAT_COMPOSITE ::                                       */
744  /*      The glyph image is a composite of several other images.  This    */
745  /*      format is _only_ used with @FT_LOAD_NO_RECURSE, and is used to   */
746  /*      report compound glyphs (like accented characters).               */
747  /*                                                                       */
748  /*    FT_GLYPH_FORMAT_BITMAP ::                                          */
749  /*      The glyph image is a bitmap, and can be described as an          */
750  /*      @FT_Bitmap.  You generally need to access the `bitmap' field of  */
751  /*      the @FT_GlyphSlotRec structure to read it.                       */
752  /*                                                                       */
753  /*    FT_GLYPH_FORMAT_OUTLINE ::                                         */
754  /*      The glyph image is a vectorial outline made of line segments     */
755  /*      and Bézier arcs; it can be described as an @FT_Outline; you      */
756  /*      generally want to access the `outline' field of the              */
757  /*      @FT_GlyphSlotRec structure to read it.                           */
758  /*                                                                       */
759  /*    FT_GLYPH_FORMAT_PLOTTER ::                                         */
760  /*      The glyph image is a vectorial path with no inside and outside   */
761  /*      contours.  Some Type~1 fonts, like those in the Hershey family,  */
762  /*      contain glyphs in this format.  These are described as           */
763  /*      @FT_Outline, but FreeType isn't currently capable of rendering   */
764  /*      them correctly.                                                  */
765  /*                                                                       */
766  typedef enum  FT_Glyph_Format_
767  {
768    FT_IMAGE_TAG( FT_GLYPH_FORMAT_NONE, 0, 0, 0, 0 ),
769
770    FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ),
771    FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP,    'b', 'i', 't', 's' ),
772    FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE,   'o', 'u', 't', 'l' ),
773    FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER,   'p', 'l', 'o', 't' )
774
775  } FT_Glyph_Format;
776
777
778  /*************************************************************************/
779  /*                                                                       */
780  /* <Enum>                                                                */
781  /*    ft_glyph_format_xxx                                                */
782  /*                                                                       */
783  /* <Description>                                                         */
784  /*    A list of deprecated constants.  Use the corresponding             */
785  /*    @FT_Glyph_Format values instead.                                   */
786  /*                                                                       */
787  /* <Values>                                                              */
788  /*    ft_glyph_format_none      :: See @FT_GLYPH_FORMAT_NONE.            */
789  /*    ft_glyph_format_composite :: See @FT_GLYPH_FORMAT_COMPOSITE.       */
790  /*    ft_glyph_format_bitmap    :: See @FT_GLYPH_FORMAT_BITMAP.          */
791  /*    ft_glyph_format_outline   :: See @FT_GLYPH_FORMAT_OUTLINE.         */
792  /*    ft_glyph_format_plotter   :: See @FT_GLYPH_FORMAT_PLOTTER.         */
793  /*                                                                       */
794#define ft_glyph_format_none       FT_GLYPH_FORMAT_NONE
795#define ft_glyph_format_composite  FT_GLYPH_FORMAT_COMPOSITE
796#define ft_glyph_format_bitmap     FT_GLYPH_FORMAT_BITMAP
797#define ft_glyph_format_outline    FT_GLYPH_FORMAT_OUTLINE
798#define ft_glyph_format_plotter    FT_GLYPH_FORMAT_PLOTTER
799
800
801  /*************************************************************************/
802  /*************************************************************************/
803  /*************************************************************************/
804  /*****                                                               *****/
805  /*****            R A S T E R   D …

Large files files are truncated, but you can click here to view the full file