1*37da2899SCharles.Forsyth /***************************************************************************/ 2*37da2899SCharles.Forsyth /* */ 3*37da2899SCharles.Forsyth /* ftimage.h */ 4*37da2899SCharles.Forsyth /* */ 5*37da2899SCharles.Forsyth /* FreeType glyph image formats and default raster interface */ 6*37da2899SCharles.Forsyth /* (specification). */ 7*37da2899SCharles.Forsyth /* */ 8*37da2899SCharles.Forsyth /* Copyright 1996-2001, 2002 by */ 9*37da2899SCharles.Forsyth /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 10*37da2899SCharles.Forsyth /* */ 11*37da2899SCharles.Forsyth /* This file is part of the FreeType project, and may only be used, */ 12*37da2899SCharles.Forsyth /* modified, and distributed under the terms of the FreeType project */ 13*37da2899SCharles.Forsyth /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 14*37da2899SCharles.Forsyth /* this file you indicate that you have read the license and */ 15*37da2899SCharles.Forsyth /* understand and accept it fully. */ 16*37da2899SCharles.Forsyth /* */ 17*37da2899SCharles.Forsyth /***************************************************************************/ 18*37da2899SCharles.Forsyth 19*37da2899SCharles.Forsyth /*************************************************************************/ 20*37da2899SCharles.Forsyth /* */ 21*37da2899SCharles.Forsyth /* Note: A `raster' is simply a scan-line converter, used to render */ 22*37da2899SCharles.Forsyth /* FT_Outlines into FT_Bitmaps. */ 23*37da2899SCharles.Forsyth /* */ 24*37da2899SCharles.Forsyth /*************************************************************************/ 25*37da2899SCharles.Forsyth 26*37da2899SCharles.Forsyth 27*37da2899SCharles.Forsyth #ifndef __FTIMAGE_H__ 28*37da2899SCharles.Forsyth #define __FTIMAGE_H__ 29*37da2899SCharles.Forsyth 30*37da2899SCharles.Forsyth 31*37da2899SCharles.Forsyth /* _STANDALONE_ is from ftgrays.c */ 32*37da2899SCharles.Forsyth #ifndef _STANDALONE_ 33*37da2899SCharles.Forsyth #include <ft2build.h> 34*37da2899SCharles.Forsyth #endif 35*37da2899SCharles.Forsyth 36*37da2899SCharles.Forsyth 37*37da2899SCharles.Forsyth FT_BEGIN_HEADER 38*37da2899SCharles.Forsyth 39*37da2899SCharles.Forsyth 40*37da2899SCharles.Forsyth /*************************************************************************/ 41*37da2899SCharles.Forsyth /* */ 42*37da2899SCharles.Forsyth /* <Section> */ 43*37da2899SCharles.Forsyth /* basic_types */ 44*37da2899SCharles.Forsyth /* */ 45*37da2899SCharles.Forsyth /*************************************************************************/ 46*37da2899SCharles.Forsyth 47*37da2899SCharles.Forsyth 48*37da2899SCharles.Forsyth /*************************************************************************/ 49*37da2899SCharles.Forsyth /* */ 50*37da2899SCharles.Forsyth /* <Type> */ 51*37da2899SCharles.Forsyth /* FT_Pos */ 52*37da2899SCharles.Forsyth /* */ 53*37da2899SCharles.Forsyth /* <Description> */ 54*37da2899SCharles.Forsyth /* The type FT_Pos is a 32-bit integer used to store vectorial */ 55*37da2899SCharles.Forsyth /* coordinates. Depending on the context, these can represent */ 56*37da2899SCharles.Forsyth /* distances in integer font units, or 26.6 fixed float pixel */ 57*37da2899SCharles.Forsyth /* coordinates. */ 58*37da2899SCharles.Forsyth /* */ 59*37da2899SCharles.Forsyth typedef signed long FT_Pos; 60*37da2899SCharles.Forsyth 61*37da2899SCharles.Forsyth 62*37da2899SCharles.Forsyth /*************************************************************************/ 63*37da2899SCharles.Forsyth /* */ 64*37da2899SCharles.Forsyth /* <Struct> */ 65*37da2899SCharles.Forsyth /* FT_Vector */ 66*37da2899SCharles.Forsyth /* */ 67*37da2899SCharles.Forsyth /* <Description> */ 68*37da2899SCharles.Forsyth /* A simple structure used to store a 2D vector; coordinates are of */ 69*37da2899SCharles.Forsyth /* the FT_Pos type. */ 70*37da2899SCharles.Forsyth /* */ 71*37da2899SCharles.Forsyth /* <Fields> */ 72*37da2899SCharles.Forsyth /* x :: The horizontal coordinate. */ 73*37da2899SCharles.Forsyth /* y :: The vertical coordinate. */ 74*37da2899SCharles.Forsyth /* */ 75*37da2899SCharles.Forsyth typedef struct FT_Vector_ 76*37da2899SCharles.Forsyth { 77*37da2899SCharles.Forsyth FT_Pos x; 78*37da2899SCharles.Forsyth FT_Pos y; 79*37da2899SCharles.Forsyth 80*37da2899SCharles.Forsyth } FT_Vector; 81*37da2899SCharles.Forsyth 82*37da2899SCharles.Forsyth 83*37da2899SCharles.Forsyth /*************************************************************************/ 84*37da2899SCharles.Forsyth /* */ 85*37da2899SCharles.Forsyth /* <Struct> */ 86*37da2899SCharles.Forsyth /* FT_BBox */ 87*37da2899SCharles.Forsyth /* */ 88*37da2899SCharles.Forsyth /* <Description> */ 89*37da2899SCharles.Forsyth /* A structure used to hold an outline's bounding box, i.e., the */ 90*37da2899SCharles.Forsyth /* coordinates of its extrema in the horizontal and vertical */ 91*37da2899SCharles.Forsyth /* directions. */ 92*37da2899SCharles.Forsyth /* */ 93*37da2899SCharles.Forsyth /* <Fields> */ 94*37da2899SCharles.Forsyth /* xMin :: The horizontal minimum (left-most). */ 95*37da2899SCharles.Forsyth /* */ 96*37da2899SCharles.Forsyth /* yMin :: The vertical minimum (bottom-most). */ 97*37da2899SCharles.Forsyth /* */ 98*37da2899SCharles.Forsyth /* xMax :: The horizontal maximum (right-most). */ 99*37da2899SCharles.Forsyth /* */ 100*37da2899SCharles.Forsyth /* yMax :: The vertical maximum (top-most). */ 101*37da2899SCharles.Forsyth /* */ 102*37da2899SCharles.Forsyth typedef struct FT_BBox_ 103*37da2899SCharles.Forsyth { 104*37da2899SCharles.Forsyth FT_Pos xMin, yMin; 105*37da2899SCharles.Forsyth FT_Pos xMax, yMax; 106*37da2899SCharles.Forsyth 107*37da2899SCharles.Forsyth } FT_BBox; 108*37da2899SCharles.Forsyth 109*37da2899SCharles.Forsyth 110*37da2899SCharles.Forsyth /*************************************************************************/ 111*37da2899SCharles.Forsyth /* */ 112*37da2899SCharles.Forsyth /* <Enum> */ 113*37da2899SCharles.Forsyth /* FT_Pixel_Mode */ 114*37da2899SCharles.Forsyth /* */ 115*37da2899SCharles.Forsyth /* <Description> */ 116*37da2899SCharles.Forsyth /* An enumeration type used to describe the format of pixels in a */ 117*37da2899SCharles.Forsyth /* given bitmap. Note that additional formats may be added in the */ 118*37da2899SCharles.Forsyth /* future. */ 119*37da2899SCharles.Forsyth /* */ 120*37da2899SCharles.Forsyth /* <Values> */ 121*37da2899SCharles.Forsyth /* FT_PIXEL_MODE_NONE :: */ 122*37da2899SCharles.Forsyth /* Value 0 is reserved. */ 123*37da2899SCharles.Forsyth /* */ 124*37da2899SCharles.Forsyth /* FT_PIXEL_MODE_MONO :: */ 125*37da2899SCharles.Forsyth /* A monochrome bitmap, using 1 bit per pixel. Note that pixels */ 126*37da2899SCharles.Forsyth /* are stored in most-significant order (MSB), which means that */ 127*37da2899SCharles.Forsyth /* the left-most pixel in a byte has value 128. */ 128*37da2899SCharles.Forsyth /* */ 129*37da2899SCharles.Forsyth /* FT_PIXEL_MODE_GRAY :: */ 130*37da2899SCharles.Forsyth /* An 8-bit bitmap, generally used to represent anti-aliased glyph */ 131*37da2899SCharles.Forsyth /* images. Each pixel is stored in one byte. Note that the number */ 132*37da2899SCharles.Forsyth /* of value "gray" levels is stored in the `num_bytes' field of */ 133*37da2899SCharles.Forsyth /* the @FT_Bitmap structure (it generally is 256). */ 134*37da2899SCharles.Forsyth /* */ 135*37da2899SCharles.Forsyth /* FT_PIXEL_MODE_GRAY2 :: */ 136*37da2899SCharles.Forsyth /* A 2-bit/pixel bitmap, used to represent embedded anti-aliased */ 137*37da2899SCharles.Forsyth /* bitmaps in font files according to the OpenType specification. */ 138*37da2899SCharles.Forsyth /* We haven't found a single font using this format, however. */ 139*37da2899SCharles.Forsyth /* */ 140*37da2899SCharles.Forsyth /* FT_PIXEL_MODE_GRAY4 :: */ 141*37da2899SCharles.Forsyth /* A 4-bit/pixel bitmap, used to represent embedded anti-aliased */ 142*37da2899SCharles.Forsyth /* bitmaps in font files according to the OpenType specification. */ 143*37da2899SCharles.Forsyth /* We haven't found a single font using this format, however. */ 144*37da2899SCharles.Forsyth /* */ 145*37da2899SCharles.Forsyth /* FT_PIXEL_MODE_LCD :: */ 146*37da2899SCharles.Forsyth /* An 8-bit bitmap, used to represent RGB or BGR decimated glyph */ 147*37da2899SCharles.Forsyth /* images used for display on LCD displays; the bitmap's width is */ 148*37da2899SCharles.Forsyth /* three times wider than the original glyph image. See also */ 149*37da2899SCharles.Forsyth /* @FT_RENDER_MODE_LCD. */ 150*37da2899SCharles.Forsyth /* */ 151*37da2899SCharles.Forsyth /* FT_PIXEL_MODE_LCD_V :: */ 152*37da2899SCharles.Forsyth /* An 8-bit bitmap, used to represent RGB or BGR decimated glyph */ 153*37da2899SCharles.Forsyth /* images used for display on rotated LCD displays; the bitmap's */ 154*37da2899SCharles.Forsyth /* height is three times taller than the original glyph image. */ 155*37da2899SCharles.Forsyth /* See also @FT_RENDER_MODE_LCD_V. */ 156*37da2899SCharles.Forsyth /* */ 157*37da2899SCharles.Forsyth typedef enum FT_Pixel_Mode_ 158*37da2899SCharles.Forsyth { 159*37da2899SCharles.Forsyth FT_PIXEL_MODE_NONE = 0, 160*37da2899SCharles.Forsyth FT_PIXEL_MODE_MONO, 161*37da2899SCharles.Forsyth FT_PIXEL_MODE_GRAY, 162*37da2899SCharles.Forsyth FT_PIXEL_MODE_GRAY2, 163*37da2899SCharles.Forsyth FT_PIXEL_MODE_GRAY4, 164*37da2899SCharles.Forsyth FT_PIXEL_MODE_LCD, 165*37da2899SCharles.Forsyth FT_PIXEL_MODE_LCD_V, 166*37da2899SCharles.Forsyth 167*37da2899SCharles.Forsyth FT_PIXEL_MODE_MAX /* do not remove */ 168*37da2899SCharles.Forsyth 169*37da2899SCharles.Forsyth } FT_Pixel_Mode; 170*37da2899SCharles.Forsyth 171*37da2899SCharles.Forsyth 172*37da2899SCharles.Forsyth /*************************************************************************/ 173*37da2899SCharles.Forsyth /* */ 174*37da2899SCharles.Forsyth /* <Enum> */ 175*37da2899SCharles.Forsyth /* ft_pixel_mode_xxx */ 176*37da2899SCharles.Forsyth /* */ 177*37da2899SCharles.Forsyth /* <Description> */ 178*37da2899SCharles.Forsyth /* A list of deprecated constants. Use the corresponding */ 179*37da2899SCharles.Forsyth /* @FT_Pixel_Mode values instead. */ 180*37da2899SCharles.Forsyth /* */ 181*37da2899SCharles.Forsyth /* <Values> */ 182*37da2899SCharles.Forsyth /* ft_pixel_mode_none :: see @FT_PIXEL_MODE_NONE */ 183*37da2899SCharles.Forsyth /* ft_pixel_mode_mono :: see @FT_PIXEL_MODE_MONO */ 184*37da2899SCharles.Forsyth /* ft_pixel_mode_grays :: see @FT_PIXEL_MODE_GRAY */ 185*37da2899SCharles.Forsyth /* ft_pixel_mode_pal2 :: see @FT_PIXEL_MODE_GRAY2 */ 186*37da2899SCharles.Forsyth /* ft_pixel_mode_pal4 :: see @FT_PIXEL_MODE_GRAY4 */ 187*37da2899SCharles.Forsyth /* */ 188*37da2899SCharles.Forsyth #define ft_pixel_mode_none FT_PIXEL_MODE_NONE 189*37da2899SCharles.Forsyth #define ft_pixel_mode_mono FT_PIXEL_MODE_MONO 190*37da2899SCharles.Forsyth #define ft_pixel_mode_grays FT_PIXEL_MODE_GRAY 191*37da2899SCharles.Forsyth #define ft_pixel_mode_pal2 FT_PIXEL_MODE_GRAY2 192*37da2899SCharles.Forsyth #define ft_pixel_mode_pal4 FT_PIXEL_MODE_GRAY4 193*37da2899SCharles.Forsyth 194*37da2899SCharles.Forsyth /* */ 195*37da2899SCharles.Forsyth 196*37da2899SCharles.Forsyth #if 0 197*37da2899SCharles.Forsyth 198*37da2899SCharles.Forsyth /*************************************************************************/ 199*37da2899SCharles.Forsyth /* */ 200*37da2899SCharles.Forsyth /* <Enum> */ 201*37da2899SCharles.Forsyth /* FT_Palette_Mode */ 202*37da2899SCharles.Forsyth /* */ 203*37da2899SCharles.Forsyth /* <Description> */ 204*37da2899SCharles.Forsyth /* THIS TYPE IS DEPRECATED. DO NOT USE IT! */ 205*37da2899SCharles.Forsyth /* */ 206*37da2899SCharles.Forsyth /* An enumeration type used to describe the format of a bitmap */ 207*37da2899SCharles.Forsyth /* palette, used with ft_pixel_mode_pal4 and ft_pixel_mode_pal8. */ 208*37da2899SCharles.Forsyth /* */ 209*37da2899SCharles.Forsyth /* <Fields> */ 210*37da2899SCharles.Forsyth /* ft_palette_mode_rgb :: The palette is an array of 3-bytes RGB */ 211*37da2899SCharles.Forsyth /* records. */ 212*37da2899SCharles.Forsyth /* */ 213*37da2899SCharles.Forsyth /* ft_palette_mode_rgba :: The palette is an array of 4-bytes RGBA */ 214*37da2899SCharles.Forsyth /* records. */ 215*37da2899SCharles.Forsyth /* */ 216*37da2899SCharles.Forsyth /* <Note> */ 217*37da2899SCharles.Forsyth /* As ft_pixel_mode_pal2, pal4 and pal8 are currently unused by */ 218*37da2899SCharles.Forsyth /* FreeType, these types are not handled by the library itself. */ 219*37da2899SCharles.Forsyth /* */ 220*37da2899SCharles.Forsyth typedef enum FT_Palette_Mode_ 221*37da2899SCharles.Forsyth { 222*37da2899SCharles.Forsyth ft_palette_mode_rgb = 0, 223*37da2899SCharles.Forsyth ft_palette_mode_rgba, 224*37da2899SCharles.Forsyth 225*37da2899SCharles.Forsyth ft_palettte_mode_max /* do not remove */ 226*37da2899SCharles.Forsyth 227*37da2899SCharles.Forsyth } FT_Palette_Mode; 228*37da2899SCharles.Forsyth 229*37da2899SCharles.Forsyth /* */ 230*37da2899SCharles.Forsyth 231*37da2899SCharles.Forsyth #endif 232*37da2899SCharles.Forsyth 233*37da2899SCharles.Forsyth 234*37da2899SCharles.Forsyth /*************************************************************************/ 235*37da2899SCharles.Forsyth /* */ 236*37da2899SCharles.Forsyth /* <Struct> */ 237*37da2899SCharles.Forsyth /* FT_Bitmap */ 238*37da2899SCharles.Forsyth /* */ 239*37da2899SCharles.Forsyth /* <Description> */ 240*37da2899SCharles.Forsyth /* A structure used to describe a bitmap or pixmap to the raster. */ 241*37da2899SCharles.Forsyth /* Note that we now manage pixmaps of various depths through the */ 242*37da2899SCharles.Forsyth /* `pixel_mode' field. */ 243*37da2899SCharles.Forsyth /* */ 244*37da2899SCharles.Forsyth /* <Fields> */ 245*37da2899SCharles.Forsyth /* rows :: The number of bitmap rows. */ 246*37da2899SCharles.Forsyth /* */ 247*37da2899SCharles.Forsyth /* width :: The number of pixels in bitmap row. */ 248*37da2899SCharles.Forsyth /* */ 249*37da2899SCharles.Forsyth /* pitch :: The pitch's absolute value is the number of bytes */ 250*37da2899SCharles.Forsyth /* taken by one bitmap row, including padding. */ 251*37da2899SCharles.Forsyth /* However, the pitch is positive when the bitmap has */ 252*37da2899SCharles.Forsyth /* a `down' flow, and negative when it has an `up' */ 253*37da2899SCharles.Forsyth /* flow. In all cases, the pitch is an offset to add */ 254*37da2899SCharles.Forsyth /* to a bitmap pointer in order to go down one row. */ 255*37da2899SCharles.Forsyth /* */ 256*37da2899SCharles.Forsyth /* buffer :: A typeless pointer to the bitmap buffer. This */ 257*37da2899SCharles.Forsyth /* value should be aligned on 32-bit boundaries in */ 258*37da2899SCharles.Forsyth /* most cases. */ 259*37da2899SCharles.Forsyth /* */ 260*37da2899SCharles.Forsyth /* num_grays :: This field is only used with */ 261*37da2899SCharles.Forsyth /* `FT_PIXEL_MODE_GRAY'; it gives the number of gray */ 262*37da2899SCharles.Forsyth /* levels used in the bitmap. */ 263*37da2899SCharles.Forsyth /* */ 264*37da2899SCharles.Forsyth /* pixel_mode :: The pixel_mode, i.e., how pixel bits are stored. */ 265*37da2899SCharles.Forsyth /* */ 266*37da2899SCharles.Forsyth /* palette_mode :: This field is only used with paletted pixel modes; */ 267*37da2899SCharles.Forsyth /* it indicates how the palette is stored. */ 268*37da2899SCharles.Forsyth /* */ 269*37da2899SCharles.Forsyth /* palette :: A typeless pointer to the bitmap palette; only */ 270*37da2899SCharles.Forsyth /* used for paletted pixel modes. */ 271*37da2899SCharles.Forsyth /* */ 272*37da2899SCharles.Forsyth /* <Note> */ 273*37da2899SCharles.Forsyth /* For now, the only pixel mode supported by FreeType are mono and */ 274*37da2899SCharles.Forsyth /* grays. However, drivers might be added in the future to support */ 275*37da2899SCharles.Forsyth /* more `colorful' options. */ 276*37da2899SCharles.Forsyth /* */ 277*37da2899SCharles.Forsyth /* When using pixel modes pal2, pal4 and pal8 with a void `palette' */ 278*37da2899SCharles.Forsyth /* field, a gray pixmap with respectively 4, 16, and 256 levels of */ 279*37da2899SCharles.Forsyth /* gray is assumed. This, in order to be compatible with some */ 280*37da2899SCharles.Forsyth /* embedded bitmap formats defined in the TrueType specification. */ 281*37da2899SCharles.Forsyth /* */ 282*37da2899SCharles.Forsyth /* Note that no font was found presenting such embedded bitmaps, so */ 283*37da2899SCharles.Forsyth /* this is currently completely unhandled by the library. */ 284*37da2899SCharles.Forsyth /* */ 285*37da2899SCharles.Forsyth typedef struct FT_Bitmap_ 286*37da2899SCharles.Forsyth { 287*37da2899SCharles.Forsyth int rows; 288*37da2899SCharles.Forsyth int width; 289*37da2899SCharles.Forsyth int pitch; 290*37da2899SCharles.Forsyth unsigned char* buffer; 291*37da2899SCharles.Forsyth short num_grays; 292*37da2899SCharles.Forsyth char pixel_mode; 293*37da2899SCharles.Forsyth char palette_mode; 294*37da2899SCharles.Forsyth void* palette; 295*37da2899SCharles.Forsyth 296*37da2899SCharles.Forsyth } FT_Bitmap; 297*37da2899SCharles.Forsyth 298*37da2899SCharles.Forsyth 299*37da2899SCharles.Forsyth /*************************************************************************/ 300*37da2899SCharles.Forsyth /* */ 301*37da2899SCharles.Forsyth /* <Section> */ 302*37da2899SCharles.Forsyth /* outline_processing */ 303*37da2899SCharles.Forsyth /* */ 304*37da2899SCharles.Forsyth /*************************************************************************/ 305*37da2899SCharles.Forsyth 306*37da2899SCharles.Forsyth 307*37da2899SCharles.Forsyth /*************************************************************************/ 308*37da2899SCharles.Forsyth /* */ 309*37da2899SCharles.Forsyth /* <Struct> */ 310*37da2899SCharles.Forsyth /* FT_Outline */ 311*37da2899SCharles.Forsyth /* */ 312*37da2899SCharles.Forsyth /* <Description> */ 313*37da2899SCharles.Forsyth /* This structure is used to describe an outline to the scan-line */ 314*37da2899SCharles.Forsyth /* converter. */ 315*37da2899SCharles.Forsyth /* */ 316*37da2899SCharles.Forsyth /* <Fields> */ 317*37da2899SCharles.Forsyth /* n_contours :: The number of contours in the outline. */ 318*37da2899SCharles.Forsyth /* */ 319*37da2899SCharles.Forsyth /* n_points :: The number of points in the outline. */ 320*37da2899SCharles.Forsyth /* */ 321*37da2899SCharles.Forsyth /* points :: A pointer to an array of `n_points' FT_Vector */ 322*37da2899SCharles.Forsyth /* elements, giving the outline's point coordinates. */ 323*37da2899SCharles.Forsyth /* */ 324*37da2899SCharles.Forsyth /* tags :: A pointer to an array of `n_points' chars, giving */ 325*37da2899SCharles.Forsyth /* each outline point's type. If bit 0 is unset, the */ 326*37da2899SCharles.Forsyth /* point is `off' the curve, i.e. a Bezier control */ 327*37da2899SCharles.Forsyth /* point, while it is `on' when set. */ 328*37da2899SCharles.Forsyth /* */ 329*37da2899SCharles.Forsyth /* Bit 1 is meaningful for `off' points only. If set, */ 330*37da2899SCharles.Forsyth /* it indicates a third-order Bezier arc control point; */ 331*37da2899SCharles.Forsyth /* and a second-order control point if unset. */ 332*37da2899SCharles.Forsyth /* */ 333*37da2899SCharles.Forsyth /* contours :: An array of `n_contours' shorts, giving the end */ 334*37da2899SCharles.Forsyth /* point of each contour within the outline. For */ 335*37da2899SCharles.Forsyth /* example, the first contour is defined by the points */ 336*37da2899SCharles.Forsyth /* `0' to `contours[0]', the second one is defined by */ 337*37da2899SCharles.Forsyth /* the points `contours[0]+1' to `contours[1]', etc. */ 338*37da2899SCharles.Forsyth /* */ 339*37da2899SCharles.Forsyth /* flags :: A set of bit flags used to characterize the outline */ 340*37da2899SCharles.Forsyth /* and give hints to the scan-converter and hinter on */ 341*37da2899SCharles.Forsyth /* how to convert/grid-fit it. See FT_Outline_Flags. */ 342*37da2899SCharles.Forsyth /* */ 343*37da2899SCharles.Forsyth typedef struct FT_Outline_ 344*37da2899SCharles.Forsyth { 345*37da2899SCharles.Forsyth short n_contours; /* number of contours in glyph */ 346*37da2899SCharles.Forsyth short n_points; /* number of points in the glyph */ 347*37da2899SCharles.Forsyth 348*37da2899SCharles.Forsyth FT_Vector* points; /* the outline's points */ 349*37da2899SCharles.Forsyth char* tags; /* the points flags */ 350*37da2899SCharles.Forsyth short* contours; /* the contour end points */ 351*37da2899SCharles.Forsyth 352*37da2899SCharles.Forsyth int flags; /* outline masks */ 353*37da2899SCharles.Forsyth 354*37da2899SCharles.Forsyth } FT_Outline; 355*37da2899SCharles.Forsyth 356*37da2899SCharles.Forsyth 357*37da2899SCharles.Forsyth /*************************************************************************/ 358*37da2899SCharles.Forsyth /* */ 359*37da2899SCharles.Forsyth /* <Enum> */ 360*37da2899SCharles.Forsyth /* FT_Outline_Flags */ 361*37da2899SCharles.Forsyth /* */ 362*37da2899SCharles.Forsyth /* <Description> */ 363*37da2899SCharles.Forsyth /* A simple type used to enumerates the flags in an outline's */ 364*37da2899SCharles.Forsyth /* `outline_flags' field. */ 365*37da2899SCharles.Forsyth /* */ 366*37da2899SCharles.Forsyth /* <Values> */ 367*37da2899SCharles.Forsyth /* FT_OUTLINE_NONE :: Value 0 is reserved. */ 368*37da2899SCharles.Forsyth /* */ 369*37da2899SCharles.Forsyth /* FT_OUTLINE_OWNER :: If set, this flag indicates that the */ 370*37da2899SCharles.Forsyth /* outline's field arrays (i.e. */ 371*37da2899SCharles.Forsyth /* `points', `flags' & `contours') are */ 372*37da2899SCharles.Forsyth /* `owned' by the outline object, and */ 373*37da2899SCharles.Forsyth /* should thus be freed when it is */ 374*37da2899SCharles.Forsyth /* destroyed. */ 375*37da2899SCharles.Forsyth /* */ 376*37da2899SCharles.Forsyth /* FT_OUTLINE_EVEN_ODD_FILL :: By default, outlines are filled using */ 377*37da2899SCharles.Forsyth /* the non-zero winding rule. If set to */ 378*37da2899SCharles.Forsyth /* 1, the outline will be filled using */ 379*37da2899SCharles.Forsyth /* the even-odd fill rule (only works */ 380*37da2899SCharles.Forsyth /* with the smooth raster). */ 381*37da2899SCharles.Forsyth /* */ 382*37da2899SCharles.Forsyth /* FT_OUTLINE_REVERSE_FILL :: By default, outside contours of an */ 383*37da2899SCharles.Forsyth /* outline are oriented in clock-wise */ 384*37da2899SCharles.Forsyth /* direction, as defined in the TrueType */ 385*37da2899SCharles.Forsyth /* specification. This flag is set if */ 386*37da2899SCharles.Forsyth /* the outline uses the opposite */ 387*37da2899SCharles.Forsyth /* direction (typically for Type 1 */ 388*37da2899SCharles.Forsyth /* fonts). This flag is ignored by the */ 389*37da2899SCharles.Forsyth /* scan-converter. However, it is very */ 390*37da2899SCharles.Forsyth /* important for the auto-hinter. */ 391*37da2899SCharles.Forsyth /* */ 392*37da2899SCharles.Forsyth /* FT_OUTLINE_IGNORE_DROPOUTS :: By default, the scan converter will */ 393*37da2899SCharles.Forsyth /* try to detect drop-outs in an outline */ 394*37da2899SCharles.Forsyth /* and correct the glyph bitmap to */ 395*37da2899SCharles.Forsyth /* ensure consistent shape continuity. */ 396*37da2899SCharles.Forsyth /* If set, this flag hints the scan-line */ 397*37da2899SCharles.Forsyth /* converter to ignore such cases. */ 398*37da2899SCharles.Forsyth /* */ 399*37da2899SCharles.Forsyth /* FT_OUTLINE_HIGH_PRECISION :: This flag indicates that the */ 400*37da2899SCharles.Forsyth /* scan-line converter should try to */ 401*37da2899SCharles.Forsyth /* convert this outline to bitmaps with */ 402*37da2899SCharles.Forsyth /* the highest possible quality. It is */ 403*37da2899SCharles.Forsyth /* typically set for small character */ 404*37da2899SCharles.Forsyth /* sizes. Note that this is only a */ 405*37da2899SCharles.Forsyth /* hint, that might be completely */ 406*37da2899SCharles.Forsyth /* ignored by a given scan-converter. */ 407*37da2899SCharles.Forsyth /* */ 408*37da2899SCharles.Forsyth /* FT_OUTLINE_SINGLE_PASS :: This flag is set to force a given */ 409*37da2899SCharles.Forsyth /* scan-converter to only use a single */ 410*37da2899SCharles.Forsyth /* pass over the outline to render a */ 411*37da2899SCharles.Forsyth /* bitmap glyph image. Normally, it is */ 412*37da2899SCharles.Forsyth /* set for very large character sizes. */ 413*37da2899SCharles.Forsyth /* It is only a hint, that might be */ 414*37da2899SCharles.Forsyth /* completely ignored by a given */ 415*37da2899SCharles.Forsyth /* scan-converter. */ 416*37da2899SCharles.Forsyth /* */ 417*37da2899SCharles.Forsyth typedef enum FT_Outline_Flags_ 418*37da2899SCharles.Forsyth { 419*37da2899SCharles.Forsyth FT_OUTLINE_NONE = 0, 420*37da2899SCharles.Forsyth FT_OUTLINE_OWNER = 1, 421*37da2899SCharles.Forsyth FT_OUTLINE_EVEN_ODD_FILL = 2, 422*37da2899SCharles.Forsyth FT_OUTLINE_REVERSE_FILL = 4, 423*37da2899SCharles.Forsyth FT_OUTLINE_IGNORE_DROPOUTS = 8, 424*37da2899SCharles.Forsyth FT_OUTLINE_HIGH_PRECISION = 256, 425*37da2899SCharles.Forsyth FT_OUTLINE_SINGLE_PASS = 512 426*37da2899SCharles.Forsyth 427*37da2899SCharles.Forsyth } FT_Outline_Flags; 428*37da2899SCharles.Forsyth 429*37da2899SCharles.Forsyth 430*37da2899SCharles.Forsyth /************************************************************************* 431*37da2899SCharles.Forsyth * 432*37da2899SCharles.Forsyth * @enum: 433*37da2899SCharles.Forsyth * ft_outline_xxx 434*37da2899SCharles.Forsyth * 435*37da2899SCharles.Forsyth * @description: 436*37da2899SCharles.Forsyth * These constants are deprecated. Please use the corresponding 437*37da2899SCharles.Forsyth * @FT_OUTLINE_XXX values. 438*37da2899SCharles.Forsyth * 439*37da2899SCharles.Forsyth * @values: 440*37da2899SCharles.Forsyth * ft_outline_none :: See @FT_OUTLINE_NONE. 441*37da2899SCharles.Forsyth * ft_outline_owner :: See @FT_OUTLINE_OWNER. 442*37da2899SCharles.Forsyth * ft_outline_even_odd_fill :: See @FT_OUTLINE_EVEN_ODD_FILL. 443*37da2899SCharles.Forsyth * ft_outline_reverse_fill :: See @FT_OUTLINE_REVERSE_FILL. 444*37da2899SCharles.Forsyth * ft_outline_ignore_dropouts :: See @FT_OUTLINE_IGNORE_DROPOUTS. 445*37da2899SCharles.Forsyth * ft_outline_high_precision :: See @FT_OUTLINE_HIGH_PRECISION. 446*37da2899SCharles.Forsyth * ft_outline_single_pass :: See @FT_OUTLINE_SINGLE_PASS. 447*37da2899SCharles.Forsyth */ 448*37da2899SCharles.Forsyth #define ft_outline_none FT_OUTLINE_NONE 449*37da2899SCharles.Forsyth #define ft_outline_owner FT_OUTLINE_OWNER 450*37da2899SCharles.Forsyth #define ft_outline_even_odd_fill FT_OUTLINE_EVEN_ODD_FILL 451*37da2899SCharles.Forsyth #define ft_outline_reverse_fill FT_OUTLINE_REVERSE_FILL 452*37da2899SCharles.Forsyth #define ft_outline_ignore_dropouts FT_OUTLINE_IGNORE_DROPOUTS 453*37da2899SCharles.Forsyth #define ft_outline_high_precision FT_OUTLINE_HIGH_PRECISION 454*37da2899SCharles.Forsyth #define ft_outline_single_pass FT_OUTLINE_SINGLE_PASS 455*37da2899SCharles.Forsyth 456*37da2899SCharles.Forsyth /* */ 457*37da2899SCharles.Forsyth 458*37da2899SCharles.Forsyth #define FT_CURVE_TAG( flag ) ( flag & 3 ) 459*37da2899SCharles.Forsyth 460*37da2899SCharles.Forsyth #define FT_CURVE_TAG_ON 1 461*37da2899SCharles.Forsyth #define FT_CURVE_TAG_CONIC 0 462*37da2899SCharles.Forsyth #define FT_CURVE_TAG_CUBIC 2 463*37da2899SCharles.Forsyth 464*37da2899SCharles.Forsyth #define FT_CURVE_TAG_TOUCH_X 8 /* reserved for the TrueType hinter */ 465*37da2899SCharles.Forsyth #define FT_CURVE_TAG_TOUCH_Y 16 /* reserved for the TrueType hinter */ 466*37da2899SCharles.Forsyth 467*37da2899SCharles.Forsyth #define FT_CURVE_TAG_TOUCH_BOTH ( FT_CURVE_TAG_TOUCH_X | \ 468*37da2899SCharles.Forsyth FT_CURVE_TAG_TOUCH_Y ) 469*37da2899SCharles.Forsyth 470*37da2899SCharles.Forsyth #define FT_Curve_Tag_On FT_CURVE_TAG_ON 471*37da2899SCharles.Forsyth #define FT_Curve_Tag_Conic FT_CURVE_TAG_CONIC 472*37da2899SCharles.Forsyth #define FT_Curve_Tag_Cubic FT_CURVE_TAG_CUBIC 473*37da2899SCharles.Forsyth #define FT_Curve_Tag_Touch_X FT_CURVE_TAG_TOUCH_X 474*37da2899SCharles.Forsyth #define FT_Curve_Tag_Touch_Y FT_CURVE_TAG_TOUCH_Y 475*37da2899SCharles.Forsyth 476*37da2899SCharles.Forsyth /*************************************************************************/ 477*37da2899SCharles.Forsyth /* */ 478*37da2899SCharles.Forsyth /* <FuncType> */ 479*37da2899SCharles.Forsyth /* FT_Outline_MoveToFunc */ 480*37da2899SCharles.Forsyth /* */ 481*37da2899SCharles.Forsyth /* <Description> */ 482*37da2899SCharles.Forsyth /* A function pointer type used to describe the signature of a `move */ 483*37da2899SCharles.Forsyth /* to' function during outline walking/decomposition. */ 484*37da2899SCharles.Forsyth /* */ 485*37da2899SCharles.Forsyth /* A `move to' is emitted to start a new contour in an outline. */ 486*37da2899SCharles.Forsyth /* */ 487*37da2899SCharles.Forsyth /* <Input> */ 488*37da2899SCharles.Forsyth /* to :: A pointer to the target point of the `move to'. */ 489*37da2899SCharles.Forsyth /* */ 490*37da2899SCharles.Forsyth /* user :: A typeless pointer which is passed from the caller of the */ 491*37da2899SCharles.Forsyth /* decomposition function. */ 492*37da2899SCharles.Forsyth /* */ 493*37da2899SCharles.Forsyth /* <Return> */ 494*37da2899SCharles.Forsyth /* Error code. 0 means success. */ 495*37da2899SCharles.Forsyth /* */ 496*37da2899SCharles.Forsyth typedef int 497*37da2899SCharles.Forsyth (*FT_Outline_MoveToFunc)( FT_Vector* to, 498*37da2899SCharles.Forsyth void* user ); 499*37da2899SCharles.Forsyth 500*37da2899SCharles.Forsyth #define FT_Outline_MoveTo_Func FT_Outline_MoveToFunc 501*37da2899SCharles.Forsyth 502*37da2899SCharles.Forsyth /*************************************************************************/ 503*37da2899SCharles.Forsyth /* */ 504*37da2899SCharles.Forsyth /* <FuncType> */ 505*37da2899SCharles.Forsyth /* FT_Outline_LineToFunc */ 506*37da2899SCharles.Forsyth /* */ 507*37da2899SCharles.Forsyth /* <Description> */ 508*37da2899SCharles.Forsyth /* A function pointer type used to describe the signature of a `line */ 509*37da2899SCharles.Forsyth /* to' function during outline walking/decomposition. */ 510*37da2899SCharles.Forsyth /* */ 511*37da2899SCharles.Forsyth /* A `line to' is emitted to indicate a segment in the outline. */ 512*37da2899SCharles.Forsyth /* */ 513*37da2899SCharles.Forsyth /* <Input> */ 514*37da2899SCharles.Forsyth /* to :: A pointer to the target point of the `line to'. */ 515*37da2899SCharles.Forsyth /* */ 516*37da2899SCharles.Forsyth /* user :: A typeless pointer which is passed from the caller of the */ 517*37da2899SCharles.Forsyth /* decomposition function. */ 518*37da2899SCharles.Forsyth /* */ 519*37da2899SCharles.Forsyth /* <Return> */ 520*37da2899SCharles.Forsyth /* Error code. 0 means success. */ 521*37da2899SCharles.Forsyth /* */ 522*37da2899SCharles.Forsyth typedef int 523*37da2899SCharles.Forsyth (*FT_Outline_LineToFunc)( FT_Vector* to, 524*37da2899SCharles.Forsyth void* user ); 525*37da2899SCharles.Forsyth 526*37da2899SCharles.Forsyth #define FT_Outline_LineTo_Func FT_Outline_LineToFunc 527*37da2899SCharles.Forsyth 528*37da2899SCharles.Forsyth /*************************************************************************/ 529*37da2899SCharles.Forsyth /* */ 530*37da2899SCharles.Forsyth /* <FuncType> */ 531*37da2899SCharles.Forsyth /* FT_Outline_ConicToFunc */ 532*37da2899SCharles.Forsyth /* */ 533*37da2899SCharles.Forsyth /* <Description> */ 534*37da2899SCharles.Forsyth /* A function pointer type use to describe the signature of a `conic */ 535*37da2899SCharles.Forsyth /* to' function during outline walking/decomposition. */ 536*37da2899SCharles.Forsyth /* */ 537*37da2899SCharles.Forsyth /* A `conic to' is emitted to indicate a second-order Bezier arc in */ 538*37da2899SCharles.Forsyth /* the outline. */ 539*37da2899SCharles.Forsyth /* */ 540*37da2899SCharles.Forsyth /* <Input> */ 541*37da2899SCharles.Forsyth /* control :: An intermediate control point between the last position */ 542*37da2899SCharles.Forsyth /* and the new target in `to'. */ 543*37da2899SCharles.Forsyth /* */ 544*37da2899SCharles.Forsyth /* to :: A pointer to the target end point of the conic arc. */ 545*37da2899SCharles.Forsyth /* */ 546*37da2899SCharles.Forsyth /* user :: A typeless pointer which is passed from the caller of */ 547*37da2899SCharles.Forsyth /* the decomposition function. */ 548*37da2899SCharles.Forsyth /* */ 549*37da2899SCharles.Forsyth /* <Return> */ 550*37da2899SCharles.Forsyth /* Error code. 0 means success. */ 551*37da2899SCharles.Forsyth /* */ 552*37da2899SCharles.Forsyth typedef int 553*37da2899SCharles.Forsyth (*FT_Outline_ConicToFunc)( FT_Vector* control, 554*37da2899SCharles.Forsyth FT_Vector* to, 555*37da2899SCharles.Forsyth void* user ); 556*37da2899SCharles.Forsyth 557*37da2899SCharles.Forsyth #define FT_Outline_ConicTo_Func FT_Outline_ConicToFunc 558*37da2899SCharles.Forsyth 559*37da2899SCharles.Forsyth /*************************************************************************/ 560*37da2899SCharles.Forsyth /* */ 561*37da2899SCharles.Forsyth /* <FuncType> */ 562*37da2899SCharles.Forsyth /* FT_Outline_CubicToFunc */ 563*37da2899SCharles.Forsyth /* */ 564*37da2899SCharles.Forsyth /* <Description> */ 565*37da2899SCharles.Forsyth /* A function pointer type used to describe the signature of a `cubic */ 566*37da2899SCharles.Forsyth /* to' function during outline walking/decomposition. */ 567*37da2899SCharles.Forsyth /* */ 568*37da2899SCharles.Forsyth /* A `cubic to' is emitted to indicate a third-order Bezier arc. */ 569*37da2899SCharles.Forsyth /* */ 570*37da2899SCharles.Forsyth /* <Input> */ 571*37da2899SCharles.Forsyth /* control1 :: A pointer to the first Bezier control point. */ 572*37da2899SCharles.Forsyth /* */ 573*37da2899SCharles.Forsyth /* control2 :: A pointer to the second Bezier control point. */ 574*37da2899SCharles.Forsyth /* */ 575*37da2899SCharles.Forsyth /* to :: A pointer to the target end point. */ 576*37da2899SCharles.Forsyth /* */ 577*37da2899SCharles.Forsyth /* user :: A typeless pointer which is passed from the caller of */ 578*37da2899SCharles.Forsyth /* the decomposition function. */ 579*37da2899SCharles.Forsyth /* */ 580*37da2899SCharles.Forsyth /* <Return> */ 581*37da2899SCharles.Forsyth /* Error code. 0 means success. */ 582*37da2899SCharles.Forsyth /* */ 583*37da2899SCharles.Forsyth typedef int 584*37da2899SCharles.Forsyth (*FT_Outline_CubicToFunc)( FT_Vector* control1, 585*37da2899SCharles.Forsyth FT_Vector* control2, 586*37da2899SCharles.Forsyth FT_Vector* to, 587*37da2899SCharles.Forsyth void* user ); 588*37da2899SCharles.Forsyth 589*37da2899SCharles.Forsyth #define FT_Outline_CubicTo_Func FT_Outline_CubicToFunc 590*37da2899SCharles.Forsyth 591*37da2899SCharles.Forsyth 592*37da2899SCharles.Forsyth /*************************************************************************/ 593*37da2899SCharles.Forsyth /* */ 594*37da2899SCharles.Forsyth /* <Struct> */ 595*37da2899SCharles.Forsyth /* FT_Outline_Funcs */ 596*37da2899SCharles.Forsyth /* */ 597*37da2899SCharles.Forsyth /* <Description> */ 598*37da2899SCharles.Forsyth /* A structure to hold various function pointers used during outline */ 599*37da2899SCharles.Forsyth /* decomposition in order to emit segments, conic, and cubic Beziers, */ 600*37da2899SCharles.Forsyth /* as well as `move to' and `close to' operations. */ 601*37da2899SCharles.Forsyth /* */ 602*37da2899SCharles.Forsyth /* <Fields> */ 603*37da2899SCharles.Forsyth /* move_to :: The `move to' emitter. */ 604*37da2899SCharles.Forsyth /* */ 605*37da2899SCharles.Forsyth /* line_to :: The segment emitter. */ 606*37da2899SCharles.Forsyth /* */ 607*37da2899SCharles.Forsyth /* conic_to :: The second-order Bezier arc emitter. */ 608*37da2899SCharles.Forsyth /* */ 609*37da2899SCharles.Forsyth /* cubic_to :: The third-order Bezier arc emitter. */ 610*37da2899SCharles.Forsyth /* */ 611*37da2899SCharles.Forsyth /* shift :: The shift that is applied to coordinates before they */ 612*37da2899SCharles.Forsyth /* are sent to the emitter. */ 613*37da2899SCharles.Forsyth /* */ 614*37da2899SCharles.Forsyth /* delta :: The delta that is applied to coordinates before they */ 615*37da2899SCharles.Forsyth /* are sent to the emitter, but after the shift. */ 616*37da2899SCharles.Forsyth /* */ 617*37da2899SCharles.Forsyth /* <Note> */ 618*37da2899SCharles.Forsyth /* The point coordinates sent to the emitters are the transformed */ 619*37da2899SCharles.Forsyth /* version of the original coordinates (this is important for high */ 620*37da2899SCharles.Forsyth /* accuracy during scan-conversion). The transformation is simple: */ 621*37da2899SCharles.Forsyth /* */ 622*37da2899SCharles.Forsyth /* x' = (x << shift) - delta */ 623*37da2899SCharles.Forsyth /* y' = (x << shift) - delta */ 624*37da2899SCharles.Forsyth /* */ 625*37da2899SCharles.Forsyth /* Set the value of `shift' and `delta' to 0 to get the original */ 626*37da2899SCharles.Forsyth /* point coordinates. */ 627*37da2899SCharles.Forsyth /* */ 628*37da2899SCharles.Forsyth typedef struct FT_Outline_Funcs_ 629*37da2899SCharles.Forsyth { 630*37da2899SCharles.Forsyth FT_Outline_MoveToFunc move_to; 631*37da2899SCharles.Forsyth FT_Outline_LineToFunc line_to; 632*37da2899SCharles.Forsyth FT_Outline_ConicToFunc conic_to; 633*37da2899SCharles.Forsyth FT_Outline_CubicToFunc cubic_to; 634*37da2899SCharles.Forsyth 635*37da2899SCharles.Forsyth int shift; 636*37da2899SCharles.Forsyth FT_Pos delta; 637*37da2899SCharles.Forsyth 638*37da2899SCharles.Forsyth } FT_Outline_Funcs; 639*37da2899SCharles.Forsyth 640*37da2899SCharles.Forsyth 641*37da2899SCharles.Forsyth /*************************************************************************/ 642*37da2899SCharles.Forsyth /* */ 643*37da2899SCharles.Forsyth /* <Section> */ 644*37da2899SCharles.Forsyth /* basic_types */ 645*37da2899SCharles.Forsyth /* */ 646*37da2899SCharles.Forsyth /*************************************************************************/ 647*37da2899SCharles.Forsyth 648*37da2899SCharles.Forsyth 649*37da2899SCharles.Forsyth /*************************************************************************/ 650*37da2899SCharles.Forsyth /* */ 651*37da2899SCharles.Forsyth /* <Macro> */ 652*37da2899SCharles.Forsyth /* FT_IMAGE_TAG */ 653*37da2899SCharles.Forsyth /* */ 654*37da2899SCharles.Forsyth /* <Description> */ 655*37da2899SCharles.Forsyth /* This macro converts four letter tags into an unsigned long. */ 656*37da2899SCharles.Forsyth /* */ 657*37da2899SCharles.Forsyth /* <Note> */ 658*37da2899SCharles.Forsyth /* Since many 16bit compilers don't like 32bit enumerations, you */ 659*37da2899SCharles.Forsyth /* should redefine this macro in case of problems to something like */ 660*37da2899SCharles.Forsyth /* this: */ 661*37da2899SCharles.Forsyth /* */ 662*37da2899SCharles.Forsyth /* #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) (value) */ 663*37da2899SCharles.Forsyth /* */ 664*37da2899SCharles.Forsyth /* to get a simple enumeration without assigning special numbers. */ 665*37da2899SCharles.Forsyth /* */ 666*37da2899SCharles.Forsyth #ifndef FT_IMAGE_TAG 667*37da2899SCharles.Forsyth #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) \ 668*37da2899SCharles.Forsyth value = ( ( (unsigned long)_x1 << 24 ) | \ 669*37da2899SCharles.Forsyth ( (unsigned long)_x2 << 16 ) | \ 670*37da2899SCharles.Forsyth ( (unsigned long)_x3 << 8 ) | \ 671*37da2899SCharles.Forsyth (unsigned long)_x4 ) 672*37da2899SCharles.Forsyth #endif /* FT_IMAGE_TAG */ 673*37da2899SCharles.Forsyth 674*37da2899SCharles.Forsyth 675*37da2899SCharles.Forsyth /*************************************************************************/ 676*37da2899SCharles.Forsyth /* */ 677*37da2899SCharles.Forsyth /* <Enum> */ 678*37da2899SCharles.Forsyth /* FT_Glyph_Format */ 679*37da2899SCharles.Forsyth /* */ 680*37da2899SCharles.Forsyth /* <Description> */ 681*37da2899SCharles.Forsyth /* An enumeration type used to describe the format of a given glyph */ 682*37da2899SCharles.Forsyth /* image. Note that this version of FreeType only supports two image */ 683*37da2899SCharles.Forsyth /* formats, even though future font drivers will be able to register */ 684*37da2899SCharles.Forsyth /* their own format. */ 685*37da2899SCharles.Forsyth /* */ 686*37da2899SCharles.Forsyth /* <Values> */ 687*37da2899SCharles.Forsyth /* FT_GLYPH_FORMAT_NONE :: */ 688*37da2899SCharles.Forsyth /* The value 0 is reserved and does describe a glyph format. */ 689*37da2899SCharles.Forsyth /* */ 690*37da2899SCharles.Forsyth /* FT_GLYPH_FORMAT_COMPOSITE :: */ 691*37da2899SCharles.Forsyth /* The glyph image is a composite of several other images. This */ 692*37da2899SCharles.Forsyth /* format is _only_ used with @FT_LOAD_FLAG_NO_RECURSE, and is */ 693*37da2899SCharles.Forsyth /* used to report compound glyphs (like accented characters). */ 694*37da2899SCharles.Forsyth /* */ 695*37da2899SCharles.Forsyth /* FT_GLYPH_FORMAT_BITMAP :: */ 696*37da2899SCharles.Forsyth /* The glyph image is a bitmap, and can be described as an */ 697*37da2899SCharles.Forsyth /* @FT_Bitmap. You generally need to access the `bitmap' field of */ 698*37da2899SCharles.Forsyth /* the @FT_GlyphSlotRec structure to read it. */ 699*37da2899SCharles.Forsyth /* */ 700*37da2899SCharles.Forsyth /* FT_GLYPH_FORMAT_OUTLINE :: */ 701*37da2899SCharles.Forsyth /* The glyph image is a vertorial outline made of line segments */ 702*37da2899SCharles.Forsyth /* and Bezier arcs; it can be described as an @FT_Outline; you */ 703*37da2899SCharles.Forsyth /* generally want to access the `outline' field of the */ 704*37da2899SCharles.Forsyth /* @FT_GlyphSlotRec structure to read it. */ 705*37da2899SCharles.Forsyth /* */ 706*37da2899SCharles.Forsyth /* FT_GLYPH_FORMAT_PLOTTER :: */ 707*37da2899SCharles.Forsyth /* The glyph image is a vectorial path with no inside/outside */ 708*37da2899SCharles.Forsyth /* contours. Some Type 1 fonts, like those in the Hershey family, */ 709*37da2899SCharles.Forsyth /* contain glyphs in this format. These are described as */ 710*37da2899SCharles.Forsyth /* @FT_Outline, but FreeType isn't currently capable of rendering */ 711*37da2899SCharles.Forsyth /* them correctly. */ 712*37da2899SCharles.Forsyth /* */ 713*37da2899SCharles.Forsyth typedef enum FT_Glyph_Format_ 714*37da2899SCharles.Forsyth { 715*37da2899SCharles.Forsyth FT_IMAGE_TAG( FT_GLYPH_FORMAT_NONE, 0, 0, 0, 0 ), 716*37da2899SCharles.Forsyth 717*37da2899SCharles.Forsyth FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ), 718*37da2899SCharles.Forsyth FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP, 'b', 'i', 't', 's' ), 719*37da2899SCharles.Forsyth FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE, 'o', 'u', 't', 'l' ), 720*37da2899SCharles.Forsyth FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER, 'p', 'l', 'o', 't' ) 721*37da2899SCharles.Forsyth 722*37da2899SCharles.Forsyth } FT_Glyph_Format; 723*37da2899SCharles.Forsyth 724*37da2899SCharles.Forsyth 725*37da2899SCharles.Forsyth /*************************************************************************/ 726*37da2899SCharles.Forsyth /* */ 727*37da2899SCharles.Forsyth /* <Enum> */ 728*37da2899SCharles.Forsyth /* ft_glyph_format_xxx */ 729*37da2899SCharles.Forsyth /* */ 730*37da2899SCharles.Forsyth /* <Description> */ 731*37da2899SCharles.Forsyth /* A list of decprecated constants. Use the corresponding */ 732*37da2899SCharles.Forsyth /* @FT_Glyph_Format values instead. */ 733*37da2899SCharles.Forsyth /* */ 734*37da2899SCharles.Forsyth /* <Values> */ 735*37da2899SCharles.Forsyth /* ft_glyph_format_none :: see @FT_GLYPH_FORMAT_NONE */ 736*37da2899SCharles.Forsyth /* ft_glyph_format_composite :: see @FT_GLYPH_FORMAT_COMPOSITE */ 737*37da2899SCharles.Forsyth /* ft_glyph_format_bitmap :: see @FT_GLYPH_FORMAT_BITMAP */ 738*37da2899SCharles.Forsyth /* ft_glyph_format_outline :: see @FT_GLYPH_FORMAT_OUTLINE */ 739*37da2899SCharles.Forsyth /* ft_glyph_format_plotter :: see @FT_GLYPH_FORMAT_PLOTTER */ 740*37da2899SCharles.Forsyth /* */ 741*37da2899SCharles.Forsyth #define ft_glyph_format_none FT_GLYPH_FORMAT_NONE 742*37da2899SCharles.Forsyth #define ft_glyph_format_composite FT_GLYPH_FORMAT_COMPOSITE 743*37da2899SCharles.Forsyth #define ft_glyph_format_bitmap FT_GLYPH_FORMAT_BITMAP 744*37da2899SCharles.Forsyth #define ft_glyph_format_outline FT_GLYPH_FORMAT_OUTLINE 745*37da2899SCharles.Forsyth #define ft_glyph_format_plotter FT_GLYPH_FORMAT_PLOTTER 746*37da2899SCharles.Forsyth 747*37da2899SCharles.Forsyth 748*37da2899SCharles.Forsyth /*************************************************************************/ 749*37da2899SCharles.Forsyth /*************************************************************************/ 750*37da2899SCharles.Forsyth /*************************************************************************/ 751*37da2899SCharles.Forsyth /***** *****/ 752*37da2899SCharles.Forsyth /***** R A S T E R D E F I N I T I O N S *****/ 753*37da2899SCharles.Forsyth /***** *****/ 754*37da2899SCharles.Forsyth /*************************************************************************/ 755*37da2899SCharles.Forsyth /*************************************************************************/ 756*37da2899SCharles.Forsyth /*************************************************************************/ 757*37da2899SCharles.Forsyth 758*37da2899SCharles.Forsyth 759*37da2899SCharles.Forsyth /*************************************************************************/ 760*37da2899SCharles.Forsyth /* */ 761*37da2899SCharles.Forsyth /* A raster is a scan converter, in charge of rendering an outline into */ 762*37da2899SCharles.Forsyth /* a a bitmap. This section contains the public API for rasters. */ 763*37da2899SCharles.Forsyth /* */ 764*37da2899SCharles.Forsyth /* Note that in FreeType 2, all rasters are now encapsulated within */ 765*37da2899SCharles.Forsyth /* specific modules called `renderers'. See `freetype/ftrender.h' for */ 766*37da2899SCharles.Forsyth /* more details on renderers. */ 767*37da2899SCharles.Forsyth /* */ 768*37da2899SCharles.Forsyth /*************************************************************************/ 769*37da2899SCharles.Forsyth 770*37da2899SCharles.Forsyth 771*37da2899SCharles.Forsyth /*************************************************************************/ 772*37da2899SCharles.Forsyth /* */ 773*37da2899SCharles.Forsyth /* <Section> */ 774*37da2899SCharles.Forsyth /* raster */ 775*37da2899SCharles.Forsyth /* */ 776*37da2899SCharles.Forsyth /* <Title> */ 777*37da2899SCharles.Forsyth /* Scanline converter */ 778*37da2899SCharles.Forsyth /* */ 779*37da2899SCharles.Forsyth /* <Abstract> */ 780*37da2899SCharles.Forsyth /* How vectorial outlines are converted into bitmaps and pixmaps. */ 781*37da2899SCharles.Forsyth /* */ 782*37da2899SCharles.Forsyth /* <Description> */ 783*37da2899SCharles.Forsyth /* This section contains technical definitions. */ 784*37da2899SCharles.Forsyth /* */ 785*37da2899SCharles.Forsyth /*************************************************************************/ 786*37da2899SCharles.Forsyth 787*37da2899SCharles.Forsyth 788*37da2899SCharles.Forsyth /*************************************************************************/ 789*37da2899SCharles.Forsyth /* */ 790*37da2899SCharles.Forsyth /* <Type> */ 791*37da2899SCharles.Forsyth /* FT_Raster */ 792*37da2899SCharles.Forsyth /* */ 793*37da2899SCharles.Forsyth /* <Description> */ 794*37da2899SCharles.Forsyth /* A handle (pointer) to a raster object. Each object can be used */ 795*37da2899SCharles.Forsyth /* independently to convert an outline into a bitmap or pixmap. */ 796*37da2899SCharles.Forsyth /* */ 797*37da2899SCharles.Forsyth typedef struct FT_RasterRec_* FT_Raster; 798*37da2899SCharles.Forsyth 799*37da2899SCharles.Forsyth 800*37da2899SCharles.Forsyth /*************************************************************************/ 801*37da2899SCharles.Forsyth /* */ 802*37da2899SCharles.Forsyth /* <Struct> */ 803*37da2899SCharles.Forsyth /* FT_Span */ 804*37da2899SCharles.Forsyth /* */ 805*37da2899SCharles.Forsyth /* <Description> */ 806*37da2899SCharles.Forsyth /* A structure used to model a single span of gray (or black) pixels */ 807*37da2899SCharles.Forsyth /* when rendering a monochrome or anti-aliased bitmap. */ 808*37da2899SCharles.Forsyth /* */ 809*37da2899SCharles.Forsyth /* <Fields> */ 810*37da2899SCharles.Forsyth /* x :: The span's horizontal start position. */ 811*37da2899SCharles.Forsyth /* */ 812*37da2899SCharles.Forsyth /* len :: The span's length in pixels. */ 813*37da2899SCharles.Forsyth /* */ 814*37da2899SCharles.Forsyth /* coverage :: The span color/coverage, ranging from 0 (background) */ 815*37da2899SCharles.Forsyth /* to 255 (foreground). Only used for anti-aliased */ 816*37da2899SCharles.Forsyth /* rendering. */ 817*37da2899SCharles.Forsyth /* */ 818*37da2899SCharles.Forsyth /* <Note> */ 819*37da2899SCharles.Forsyth /* This structure is used by the span drawing callback type named */ 820*37da2899SCharles.Forsyth /* FT_SpanFunc which takes the y-coordinate of the span as a */ 821*37da2899SCharles.Forsyth /* a parameter. */ 822*37da2899SCharles.Forsyth /* */ 823*37da2899SCharles.Forsyth /* The coverage value is always between 0 and 255, even if the number */ 824*37da2899SCharles.Forsyth /* of gray levels have been set through FT_Set_Gray_Levels(). */ 825*37da2899SCharles.Forsyth /* */ 826*37da2899SCharles.Forsyth typedef struct FT_Span_ 827*37da2899SCharles.Forsyth { 828*37da2899SCharles.Forsyth short x; 829*37da2899SCharles.Forsyth unsigned short len; 830*37da2899SCharles.Forsyth unsigned char coverage; 831*37da2899SCharles.Forsyth 832*37da2899SCharles.Forsyth } FT_Span; 833*37da2899SCharles.Forsyth 834*37da2899SCharles.Forsyth 835*37da2899SCharles.Forsyth /*************************************************************************/ 836*37da2899SCharles.Forsyth /* */ 837*37da2899SCharles.Forsyth /* <FuncType> */ 838*37da2899SCharles.Forsyth /* FT_SpanFunc */ 839*37da2899SCharles.Forsyth /* */ 840*37da2899SCharles.Forsyth /* <Description> */ 841*37da2899SCharles.Forsyth /* A function used as a call-back by the anti-aliased renderer in */ 842*37da2899SCharles.Forsyth /* order to let client applications draw themselves the gray pixel */ 843*37da2899SCharles.Forsyth /* spans on each scan line. */ 844*37da2899SCharles.Forsyth /* */ 845*37da2899SCharles.Forsyth /* <Input> */ 846*37da2899SCharles.Forsyth /* y :: The scanline's y-coordinate. */ 847*37da2899SCharles.Forsyth /* */ 848*37da2899SCharles.Forsyth /* count :: The number of spans to draw on this scanline. */ 849*37da2899SCharles.Forsyth /* */ 850*37da2899SCharles.Forsyth /* spans :: A table of `count' spans to draw on the scanline. */ 851*37da2899SCharles.Forsyth /* */ 852*37da2899SCharles.Forsyth /* user :: User-supplied data that is passed to the callback. */ 853*37da2899SCharles.Forsyth /* */ 854*37da2899SCharles.Forsyth /* <Note> */ 855*37da2899SCharles.Forsyth /* This callback allows client applications to directly render the */ 856*37da2899SCharles.Forsyth /* gray spans of the anti-aliased bitmap to any kind of surfaces. */ 857*37da2899SCharles.Forsyth /* */ 858*37da2899SCharles.Forsyth /* This can be used to write anti-aliased outlines directly to a */ 859*37da2899SCharles.Forsyth /* given background bitmap, and even perform translucency. */ 860*37da2899SCharles.Forsyth /* */ 861*37da2899SCharles.Forsyth /* Note that the `count' field cannot be greater than a fixed value */ 862*37da2899SCharles.Forsyth /* defined by the FT_MAX_GRAY_SPANS configuration macro in */ 863*37da2899SCharles.Forsyth /* ftoption.h. By default, this value is set to 32, which means that */ 864*37da2899SCharles.Forsyth /* if there are more than 32 spans on a given scanline, the callback */ 865*37da2899SCharles.Forsyth /* will be called several times with the same `y' parameter in order */ 866*37da2899SCharles.Forsyth /* to draw all callbacks. */ 867*37da2899SCharles.Forsyth /* */ 868*37da2899SCharles.Forsyth /* Otherwise, the callback is only called once per scan-line, and */ 869*37da2899SCharles.Forsyth /* only for those scanlines that do have `gray' pixels on them. */ 870*37da2899SCharles.Forsyth /* */ 871*37da2899SCharles.Forsyth typedef void 872*37da2899SCharles.Forsyth (*FT_SpanFunc)( int y, 873*37da2899SCharles.Forsyth int count, 874*37da2899SCharles.Forsyth FT_Span* spans, 875*37da2899SCharles.Forsyth void* user ); 876*37da2899SCharles.Forsyth 877*37da2899SCharles.Forsyth #define FT_Raster_Span_Func FT_SpanFunc 878*37da2899SCharles.Forsyth 879*37da2899SCharles.Forsyth 880*37da2899SCharles.Forsyth /*************************************************************************/ 881*37da2899SCharles.Forsyth /* */ 882*37da2899SCharles.Forsyth /* <FuncType> */ 883*37da2899SCharles.Forsyth /* FT_Raster_BitTest_Func */ 884*37da2899SCharles.Forsyth /* */ 885*37da2899SCharles.Forsyth /* <Description> */ 886*37da2899SCharles.Forsyth /* THIS TYPE IS DEPRECATED. DO NOT USE IT. */ 887*37da2899SCharles.Forsyth /* */ 888*37da2899SCharles.Forsyth /* A function used as a call-back by the monochrome scan-converter */ 889*37da2899SCharles.Forsyth /* to test whether a given target pixel is already set to the drawing */ 890*37da2899SCharles.Forsyth /* `color'. These tests are crucial to implement drop-out control */ 891*37da2899SCharles.Forsyth /* per-se the TrueType spec. */ 892*37da2899SCharles.Forsyth /* */ 893*37da2899SCharles.Forsyth /* <Input> */ 894*37da2899SCharles.Forsyth /* y :: The pixel's y-coordinate. */ 895*37da2899SCharles.Forsyth /* */ 896*37da2899SCharles.Forsyth /* x :: The pixel's x-coordinate. */ 897*37da2899SCharles.Forsyth /* */ 898*37da2899SCharles.Forsyth /* user :: User-supplied data that is passed to the callback. */ 899*37da2899SCharles.Forsyth /* */ 900*37da2899SCharles.Forsyth /* <Return> */ 901*37da2899SCharles.Forsyth /* 1 if the pixel is `set', 0 otherwise. */ 902*37da2899SCharles.Forsyth /* */ 903*37da2899SCharles.Forsyth typedef int 904*37da2899SCharles.Forsyth (*FT_Raster_BitTest_Func)( int y, 905*37da2899SCharles.Forsyth int x, 906*37da2899SCharles.Forsyth void* user ); 907*37da2899SCharles.Forsyth 908*37da2899SCharles.Forsyth 909*37da2899SCharles.Forsyth /*************************************************************************/ 910*37da2899SCharles.Forsyth /* */ 911*37da2899SCharles.Forsyth /* <FuncType> */ 912*37da2899SCharles.Forsyth /* FT_Raster_BitSet_Func */ 913*37da2899SCharles.Forsyth /* */ 914*37da2899SCharles.Forsyth /* <Description> */ 915*37da2899SCharles.Forsyth /* THIS TYPE IS DEPRECATED. DO NOT USE IT. */ 916*37da2899SCharles.Forsyth /* */ 917*37da2899SCharles.Forsyth /* A function used as a call-back by the monochrome scan-converter */ 918*37da2899SCharles.Forsyth /* to set an individual target pixel. This is crucial to implement */ 919*37da2899SCharles.Forsyth /* drop-out control according to the TrueType specification. */ 920*37da2899SCharles.Forsyth /* */ 921*37da2899SCharles.Forsyth /* <Input> */ 922*37da2899SCharles.Forsyth /* y :: The pixel's y-coordinate. */ 923*37da2899SCharles.Forsyth /* */ 924*37da2899SCharles.Forsyth /* x :: The pixel's x-coordinate. */ 925*37da2899SCharles.Forsyth /* */ 926*37da2899SCharles.Forsyth /* user :: User-supplied data that is passed to the callback. */ 927*37da2899SCharles.Forsyth /* */ 928*37da2899SCharles.Forsyth /* <Return> */ 929*37da2899SCharles.Forsyth /* 1 if the pixel is `set', 0 otherwise. */ 930*37da2899SCharles.Forsyth /* */ 931*37da2899SCharles.Forsyth typedef void 932*37da2899SCharles.Forsyth (*FT_Raster_BitSet_Func)( int y, 933*37da2899SCharles.Forsyth int x, 934*37da2899SCharles.Forsyth void* user ); 935*37da2899SCharles.Forsyth 936*37da2899SCharles.Forsyth 937*37da2899SCharles.Forsyth /*************************************************************************/ 938*37da2899SCharles.Forsyth /* */ 939*37da2899SCharles.Forsyth /* <Enum> */ 940*37da2899SCharles.Forsyth /* FT_Raster_Flag */ 941*37da2899SCharles.Forsyth /* */ 942*37da2899SCharles.Forsyth /* <Description> */ 943*37da2899SCharles.Forsyth /* An enumeration to list the bit flags as used in the `flags' field */ 944*37da2899SCharles.Forsyth /* of a FT_Raster_Params structure. */ 945*37da2899SCharles.Forsyth /* */ 946*37da2899SCharles.Forsyth /* <Values> */ 947*37da2899SCharles.Forsyth /* FT_RASTER_FLAG_DEFAULT :: This value is 0. */ 948*37da2899SCharles.Forsyth /* */ 949*37da2899SCharles.Forsyth /* FT_RASTER_FLAG_AA :: This flag is set to indicate that an */ 950*37da2899SCharles.Forsyth /* anti-aliased glyph image should be */ 951*37da2899SCharles.Forsyth /* generated. Otherwise, it will be */ 952*37da2899SCharles.Forsyth /* monochrome (1-bit) */ 953*37da2899SCharles.Forsyth /* */ 954*37da2899SCharles.Forsyth /* FT_RASTER_FLAG_DIRECT :: This flag is set to indicate direct */ 955*37da2899SCharles.Forsyth /* rendering. In this mode, client */ 956*37da2899SCharles.Forsyth /* applications must provide their own span */ 957*37da2899SCharles.Forsyth /* callback. This lets them directly */ 958*37da2899SCharles.Forsyth /* draw or compose over an existing bitmap. */ 959*37da2899SCharles.Forsyth /* If this bit is not set, the target */ 960*37da2899SCharles.Forsyth /* pixmap's buffer _must_ be zeroed before */ 961*37da2899SCharles.Forsyth /* rendering. */ 962*37da2899SCharles.Forsyth /* */ 963*37da2899SCharles.Forsyth /* Note that for now, direct rendering is */ 964*37da2899SCharles.Forsyth /* only possible with anti-aliased glyphs. */ 965*37da2899SCharles.Forsyth /* */ 966*37da2899SCharles.Forsyth /* FT_RASTER_FLAG_CLIP :: This flag is only used in direct */ 967*37da2899SCharles.Forsyth /* rendering mode. If set, the output will */ 968*37da2899SCharles.Forsyth /* be clipped to a box specified in the */ 969*37da2899SCharles.Forsyth /* "clip_box" field of the FT_Raster_Params */ 970*37da2899SCharles.Forsyth /* structure. */ 971*37da2899SCharles.Forsyth /* */ 972*37da2899SCharles.Forsyth /* Note that by default, the glyph bitmap */ 973*37da2899SCharles.Forsyth /* is clipped to the target pixmap, except */ 974*37da2899SCharles.Forsyth /* in direct rendering mode where all spans */ 975*37da2899SCharles.Forsyth /* are generated if no clipping box is set. */ 976*37da2899SCharles.Forsyth /* */ 977*37da2899SCharles.Forsyth typedef enum 978*37da2899SCharles.Forsyth { 979*37da2899SCharles.Forsyth FT_RASTER_FLAG_DEFAULT = 0, 980*37da2899SCharles.Forsyth FT_RASTER_FLAG_AA = 1, 981*37da2899SCharles.Forsyth FT_RASTER_FLAG_DIRECT = 2, 982*37da2899SCharles.Forsyth FT_RASTER_FLAG_CLIP = 4 983*37da2899SCharles.Forsyth 984*37da2899SCharles.Forsyth } FT_Raster_Flag; 985*37da2899SCharles.Forsyth 986*37da2899SCharles.Forsyth #define ft_raster_flag_default FT_RASTER_FLAG_DEFAULT 987*37da2899SCharles.Forsyth #define ft_raster_flag_aa FT_RASTER_FLAG_AA 988*37da2899SCharles.Forsyth #define ft_raster_flag_direct FT_RASTER_FLAG_DIRECT 989*37da2899SCharles.Forsyth #define ft_raster_flag_clip FT_RASTER_FLAG_CLIP 990*37da2899SCharles.Forsyth 991*37da2899SCharles.Forsyth 992*37da2899SCharles.Forsyth /*************************************************************************/ 993*37da2899SCharles.Forsyth /* */ 994*37da2899SCharles.Forsyth /* <Struct> */ 995*37da2899SCharles.Forsyth /* FT_Raster_Params */ 996*37da2899SCharles.Forsyth /* */ 997*37da2899SCharles.Forsyth /* <Description> */ 998*37da2899SCharles.Forsyth /* A structure to hold the arguments used by a raster's render */ 999*37da2899SCharles.Forsyth /* function. */ 1000*37da2899SCharles.Forsyth /* */ 1001*37da2899SCharles.Forsyth /* <Fields> */ 1002*37da2899SCharles.Forsyth /* target :: The target bitmap. */ 1003*37da2899SCharles.Forsyth /* */ 1004*37da2899SCharles.Forsyth /* source :: A pointer to the source glyph image (e.g. an */ 1005*37da2899SCharles.Forsyth /* FT_Outline). */ 1006*37da2899SCharles.Forsyth /* */ 1007*37da2899SCharles.Forsyth /* flags :: The rendering flags. */ 1008*37da2899SCharles.Forsyth /* */ 1009*37da2899SCharles.Forsyth /* gray_spans :: The gray span drawing callback. */ 1010*37da2899SCharles.Forsyth /* */ 1011*37da2899SCharles.Forsyth /* black_spans :: The black span drawing callback. */ 1012*37da2899SCharles.Forsyth /* */ 1013*37da2899SCharles.Forsyth /* bit_test :: The bit test callback. UNIMPLEMENTED! */ 1014*37da2899SCharles.Forsyth /* */ 1015*37da2899SCharles.Forsyth /* bit_set :: The bit set callback. UNIMPLEMENTED! */ 1016*37da2899SCharles.Forsyth /* */ 1017*37da2899SCharles.Forsyth /* user :: User-supplied data that is passed to each drawing */ 1018*37da2899SCharles.Forsyth /* callback. */ 1019*37da2899SCharles.Forsyth /* */ 1020*37da2899SCharles.Forsyth /* clip_box :: An optional clipping box. It is only used in */ 1021*37da2899SCharles.Forsyth /* direct rendering mode. Note that coordinates here */ 1022*37da2899SCharles.Forsyth /* should be expressed in _integer_ pixels (and not in */ 1023*37da2899SCharles.Forsyth /* 26.6 fixed-point units). */ 1024*37da2899SCharles.Forsyth /* */ 1025*37da2899SCharles.Forsyth /* <Note> */ 1026*37da2899SCharles.Forsyth /* An anti-aliased glyph bitmap is drawn if the FT_RASTER_FLAG_AA bit */ 1027*37da2899SCharles.Forsyth /* flag is set in the `flags' field, otherwise a monochrome bitmap */ 1028*37da2899SCharles.Forsyth /* will be generated. */ 1029*37da2899SCharles.Forsyth /* */ 1030*37da2899SCharles.Forsyth /* If the FT_RASTER_FLAG_DIRECT bit flag is set in `flags', the */ 1031*37da2899SCharles.Forsyth /* raster will call the `gray_spans' callback to draw gray pixel */ 1032*37da2899SCharles.Forsyth /* spans, in the case of an aa glyph bitmap, it will call */ 1033*37da2899SCharles.Forsyth /* `black_spans', and `bit_test' and `bit_set' in the case of a */ 1034*37da2899SCharles.Forsyth /* monochrome bitmap. This allows direct composition over a */ 1035*37da2899SCharles.Forsyth /* pre-existing bitmap through user-provided callbacks to perform the */ 1036*37da2899SCharles.Forsyth /* span drawing/composition. */ 1037*37da2899SCharles.Forsyth /* */ 1038*37da2899SCharles.Forsyth /* Note that the `bit_test' and `bit_set' callbacks are required when */ 1039*37da2899SCharles.Forsyth /* rendering a monochrome bitmap, as they are crucial to implement */ 1040*37da2899SCharles.Forsyth /* correct drop-out control as defined in the TrueType specification. */ 1041*37da2899SCharles.Forsyth /* */ 1042*37da2899SCharles.Forsyth typedef struct FT_Raster_Params_ 1043*37da2899SCharles.Forsyth { 1044*37da2899SCharles.Forsyth FT_Bitmap* target; 1045*37da2899SCharles.Forsyth void* source; 1046*37da2899SCharles.Forsyth int flags; 1047*37da2899SCharles.Forsyth FT_SpanFunc gray_spans; 1048*37da2899SCharles.Forsyth FT_SpanFunc black_spans; 1049*37da2899SCharles.Forsyth FT_Raster_BitTest_Func bit_test; /* doesn't work! */ 1050*37da2899SCharles.Forsyth FT_Raster_BitSet_Func bit_set; /* doesn't work! */ 1051*37da2899SCharles.Forsyth void* user; 1052*37da2899SCharles.Forsyth FT_BBox clip_box; 1053*37da2899SCharles.Forsyth 1054*37da2899SCharles.Forsyth } FT_Raster_Params; 1055*37da2899SCharles.Forsyth 1056*37da2899SCharles.Forsyth 1057*37da2899SCharles.Forsyth /*************************************************************************/ 1058*37da2899SCharles.Forsyth /* */ 1059*37da2899SCharles.Forsyth /* <FuncType> */ 1060*37da2899SCharles.Forsyth /* FT_Raster_NewFunc */ 1061*37da2899SCharles.Forsyth /* */ 1062*37da2899SCharles.Forsyth /* <Description> */ 1063*37da2899SCharles.Forsyth /* A function used to create a new raster object. */ 1064*37da2899SCharles.Forsyth /* */ 1065*37da2899SCharles.Forsyth /* <Input> */ 1066*37da2899SCharles.Forsyth /* memory :: A handle to the memory allocator. */ 1067*37da2899SCharles.Forsyth /* */ 1068*37da2899SCharles.Forsyth /* <Output> */ 1069*37da2899SCharles.Forsyth /* raster :: A handle to the new raster object. */ 1070*37da2899SCharles.Forsyth /* */ 1071*37da2899SCharles.Forsyth /* <Return> */ 1072*37da2899SCharles.Forsyth /* Error code. 0 means success. */ 1073*37da2899SCharles.Forsyth /* */ 1074*37da2899SCharles.Forsyth /* <Note> */ 1075*37da2899SCharles.Forsyth /* The `memory' parameter is a typeless pointer in order to avoid */ 1076*37da2899SCharles.Forsyth /* un-wanted dependencies on the rest of the FreeType code. In */ 1077*37da2899SCharles.Forsyth /* practice, it is a FT_Memory, i.e., a handle to the standard */ 1078*37da2899SCharles.Forsyth /* FreeType memory allocator. However, this field can be completely */ 1079*37da2899SCharles.Forsyth /* ignored by a given raster implementation. */ 1080*37da2899SCharles.Forsyth /* */ 1081*37da2899SCharles.Forsyth typedef int 1082*37da2899SCharles.Forsyth (*FT_Raster_NewFunc)( void* memory, 1083*37da2899SCharles.Forsyth FT_Raster* raster ); 1084*37da2899SCharles.Forsyth 1085*37da2899SCharles.Forsyth #define FT_Raster_New_Func FT_Raster_NewFunc 1086*37da2899SCharles.Forsyth 1087*37da2899SCharles.Forsyth /*************************************************************************/ 1088*37da2899SCharles.Forsyth /* */ 1089*37da2899SCharles.Forsyth /* <FuncType> */ 1090*37da2899SCharles.Forsyth /* FT_Raster_DoneFunc */ 1091*37da2899SCharles.Forsyth /* */ 1092*37da2899SCharles.Forsyth /* <Description> */ 1093*37da2899SCharles.Forsyth /* A function used to destroy a given raster object. */ 1094*37da2899SCharles.Forsyth /* */ 1095*37da2899SCharles.Forsyth /* <Input> */ 1096*37da2899SCharles.Forsyth /* raster :: A handle to the raster object. */ 1097*37da2899SCharles.Forsyth /* */ 1098*37da2899SCharles.Forsyth typedef void 1099*37da2899SCharles.Forsyth (*FT_Raster_DoneFunc)( FT_Raster raster ); 1100*37da2899SCharles.Forsyth 1101*37da2899SCharles.Forsyth #define FT_Raster_Done_Func FT_Raster_DoneFunc 1102*37da2899SCharles.Forsyth 1103*37da2899SCharles.Forsyth /*************************************************************************/ 1104*37da2899SCharles.Forsyth /* */ 1105*37da2899SCharles.Forsyth /* <FuncType> */ 1106*37da2899SCharles.Forsyth /* FT_Raster_ResetFunc */ 1107*37da2899SCharles.Forsyth /* */ 1108*37da2899SCharles.Forsyth /* <Description> */ 1109*37da2899SCharles.Forsyth /* FreeType provides an area of memory called the `render pool', */ 1110*37da2899SCharles.Forsyth /* available to all registered rasters. This pool can be freely used */ 1111*37da2899SCharles.Forsyth /* during a given scan-conversion but is shared by all rasters. Its */ 1112*37da2899SCharles.Forsyth /* content is thus transient. */ 1113*37da2899SCharles.Forsyth /* */ 1114*37da2899SCharles.Forsyth /* This function is called each time the render pool changes, or just */ 1115*37da2899SCharles.Forsyth /* after a new raster object is created. */ 1116*37da2899SCharles.Forsyth /* */ 1117*37da2899SCharles.Forsyth /* <Input> */ 1118*37da2899SCharles.Forsyth /* raster :: A handle to the new raster object. */ 1119*37da2899SCharles.Forsyth /* */ 1120*37da2899SCharles.Forsyth /* pool_base :: The address in memory of the render pool. */ 1121*37da2899SCharles.Forsyth /* */ 1122*37da2899SCharles.Forsyth /* pool_size :: The size in bytes of the render pool. */ 1123*37da2899SCharles.Forsyth /* */ 1124*37da2899SCharles.Forsyth /* <Note> */ 1125*37da2899SCharles.Forsyth /* Rasters can ignore the render pool and rely on dynamic memory */ 1126*37da2899SCharles.Forsyth /* allocation if they want to (a handle to the memory allocator is */ 1127*37da2899SCharles.Forsyth /* passed to the raster constructor). However, this is not */ 1128*37da2899SCharles.Forsyth /* recommended for efficiency purposes. */ 1129*37da2899SCharles.Forsyth /* */ 1130*37da2899SCharles.Forsyth typedef void 1131*37da2899SCharles.Forsyth (*FT_Raster_ResetFunc)( FT_Raster raster, 1132*37da2899SCharles.Forsyth unsigned char* pool_base, 1133*37da2899SCharles.Forsyth unsigned long pool_size ); 1134*37da2899SCharles.Forsyth 1135*37da2899SCharles.Forsyth #define FT_Raster_Reset_Func FT_Raster_ResetFunc 1136*37da2899SCharles.Forsyth 1137*37da2899SCharles.Forsyth /*************************************************************************/ 1138*37da2899SCharles.Forsyth /* */ 1139*37da2899SCharles.Forsyth /* <FuncType> */ 1140*37da2899SCharles.Forsyth /* FT_Raster_SetModeFunc */ 1141*37da2899SCharles.Forsyth /* */ 1142*37da2899SCharles.Forsyth /* <Description> */ 1143*37da2899SCharles.Forsyth /* This function is a generic facility to change modes or attributes */ 1144*37da2899SCharles.Forsyth /* in a given raster. This can be used for debugging purposes, or */ 1145*37da2899SCharles.Forsyth /* simply to allow implementation-specific `features' in a given */ 1146*37da2899SCharles.Forsyth /* raster module. */ 1147*37da2899SCharles.Forsyth /* */ 1148*37da2899SCharles.Forsyth /* <Input> */ 1149*37da2899SCharles.Forsyth /* raster :: A handle to the new raster object. */ 1150*37da2899SCharles.Forsyth /* */ 1151*37da2899SCharles.Forsyth /* mode :: A 4-byte tag used to name the mode or property. */ 1152*37da2899SCharles.Forsyth /* */ 1153*37da2899SCharles.Forsyth /* args :: A pointer to the new mode/property to use. */ 1154*37da2899SCharles.Forsyth /* */ 1155*37da2899SCharles.Forsyth typedef int 1156*37da2899SCharles.Forsyth (*FT_Raster_SetModeFunc)( FT_Raster raster, 1157*37da2899SCharles.Forsyth unsigned long mode, 1158*37da2899SCharles.Forsyth void* args ); 1159*37da2899SCharles.Forsyth 1160*37da2899SCharles.Forsyth #define FT_Raster_Set_Mode_Func FT_Raster_SetModeFunc 1161*37da2899SCharles.Forsyth 1162*37da2899SCharles.Forsyth /*************************************************************************/ 1163*37da2899SCharles.Forsyth /* */ 1164*37da2899SCharles.Forsyth /* <FuncType> */ 1165*37da2899SCharles.Forsyth /* FT_Raster_RenderFunc */ 1166*37da2899SCharles.Forsyth /* */ 1167*37da2899SCharles.Forsyth /* <Description> */ 1168*37da2899SCharles.Forsyth /* Invokes a given raster to scan-convert a given glyph image into a */ 1169*37da2899SCharles.Forsyth /* target bitmap. */ 1170*37da2899SCharles.Forsyth /* */ 1171*37da2899SCharles.Forsyth /* <Input> */ 1172*37da2899SCharles.Forsyth /* raster :: A handle to the raster object. */ 1173*37da2899SCharles.Forsyth /* */ 1174*37da2899SCharles.Forsyth /* params :: A pointer to a FT_Raster_Params structure used to store */ 1175*37da2899SCharles.Forsyth /* the rendering parameters. */ 1176*37da2899SCharles.Forsyth /* */ 1177*37da2899SCharles.Forsyth /* <Return> */ 1178*37da2899SCharles.Forsyth /* Error code. 0 means success. */ 1179*37da2899SCharles.Forsyth /* */ 1180*37da2899SCharles.Forsyth /* <Note> */ 1181*37da2899SCharles.Forsyth /* The exact format of the source image depends on the raster's glyph */ 1182*37da2899SCharles.Forsyth /* format defined in its FT_Raster_Funcs structure. It can be an */ 1183*37da2899SCharles.Forsyth /* FT_Outline or anything else in order to support a large array of */ 1184*37da2899SCharles.Forsyth /* glyph formats. */ 1185*37da2899SCharles.Forsyth /* */ 1186*37da2899SCharles.Forsyth /* Note also that the render function can fail and return a */ 1187*37da2899SCharles.Forsyth /* FT_Err_Unimplemented_Feature error code if the raster used does */ 1188*37da2899SCharles.Forsyth /* not support direct composition. */ 1189*37da2899SCharles.Forsyth /* */ 1190*37da2899SCharles.Forsyth /* XXX: For now, the standard raster doesn't support direct */ 1191*37da2899SCharles.Forsyth /* composition but this should change for the final release (see */ 1192*37da2899SCharles.Forsyth /* the files demos/src/ftgrays.c and demos/src/ftgrays2.c for */ 1193*37da2899SCharles.Forsyth /* examples of distinct implementations which support direct */ 1194*37da2899SCharles.Forsyth /* composition). */ 1195*37da2899SCharles.Forsyth /* */ 1196*37da2899SCharles.Forsyth typedef int 1197*37da2899SCharles.Forsyth (*FT_Raster_RenderFunc)( FT_Raster raster, 1198*37da2899SCharles.Forsyth FT_Raster_Params* params ); 1199*37da2899SCharles.Forsyth 1200*37da2899SCharles.Forsyth #define FT_Raster_Render_Func FT_Raster_RenderFunc 1201*37da2899SCharles.Forsyth 1202*37da2899SCharles.Forsyth /*************************************************************************/ 1203*37da2899SCharles.Forsyth /* */ 1204*37da2899SCharles.Forsyth /* <Struct> */ 1205*37da2899SCharles.Forsyth /* FT_Raster_Funcs */ 1206*37da2899SCharles.Forsyth /* */ 1207*37da2899SCharles.Forsyth /* <Description> */ 1208*37da2899SCharles.Forsyth /* A structure used to describe a given raster class to the library. */ 1209*37da2899SCharles.Forsyth /* */ 1210*37da2899SCharles.Forsyth /* <Fields> */ 1211*37da2899SCharles.Forsyth /* glyph_format :: The supported glyph format for this raster. */ 1212*37da2899SCharles.Forsyth /* */ 1213*37da2899SCharles.Forsyth /* raster_new :: The raster constructor. */ 1214*37da2899SCharles.Forsyth /* */ 1215*37da2899SCharles.Forsyth /* raster_reset :: Used to reset the render pool within the raster. */ 1216*37da2899SCharles.Forsyth /* */ 1217*37da2899SCharles.Forsyth /* raster_render :: A function to render a glyph into a given bitmap. */ 1218*37da2899SCharles.Forsyth /* */ 1219*37da2899SCharles.Forsyth /* raster_done :: The raster destructor. */ 1220*37da2899SCharles.Forsyth /* */ 1221*37da2899SCharles.Forsyth typedef struct FT_Raster_Funcs_ 1222*37da2899SCharles.Forsyth { 1223*37da2899SCharles.Forsyth FT_Glyph_Format glyph_format; 1224*37da2899SCharles.Forsyth FT_Raster_NewFunc raster_new; 1225*37da2899SCharles.Forsyth FT_Raster_ResetFunc raster_reset; 1226*37da2899SCharles.Forsyth FT_Raster_SetModeFunc raster_set_mode; 1227*37da2899SCharles.Forsyth FT_Raster_RenderFunc raster_render; 1228*37da2899SCharles.Forsyth FT_Raster_DoneFunc raster_done; 1229*37da2899SCharles.Forsyth 1230*37da2899SCharles.Forsyth } FT_Raster_Funcs; 1231*37da2899SCharles.Forsyth 1232*37da2899SCharles.Forsyth 1233*37da2899SCharles.Forsyth /* */ 1234*37da2899SCharles.Forsyth 1235*37da2899SCharles.Forsyth 1236*37da2899SCharles.Forsyth FT_END_HEADER 1237*37da2899SCharles.Forsyth 1238*37da2899SCharles.Forsyth #endif /* __FTIMAGE_H__ */ 1239*37da2899SCharles.Forsyth 1240*37da2899SCharles.Forsyth 1241*37da2899SCharles.Forsyth /* END */ 1242