Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /***************************************************************************/ |
michael@0 | 2 | /* */ |
michael@0 | 3 | /* ftoutln.h */ |
michael@0 | 4 | /* */ |
michael@0 | 5 | /* Support for the FT_Outline type used to store glyph shapes of */ |
michael@0 | 6 | /* most scalable font formats (specification). */ |
michael@0 | 7 | /* */ |
michael@0 | 8 | /* Copyright 1996-2003, 2005-2014 by */ |
michael@0 | 9 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
michael@0 | 10 | /* */ |
michael@0 | 11 | /* This file is part of the FreeType project, and may only be used, */ |
michael@0 | 12 | /* modified, and distributed under the terms of the FreeType project */ |
michael@0 | 13 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
michael@0 | 14 | /* this file you indicate that you have read the license and */ |
michael@0 | 15 | /* understand and accept it fully. */ |
michael@0 | 16 | /* */ |
michael@0 | 17 | /***************************************************************************/ |
michael@0 | 18 | |
michael@0 | 19 | |
michael@0 | 20 | #ifndef __FTOUTLN_H__ |
michael@0 | 21 | #define __FTOUTLN_H__ |
michael@0 | 22 | |
michael@0 | 23 | |
michael@0 | 24 | #include <ft2build.h> |
michael@0 | 25 | #include FT_FREETYPE_H |
michael@0 | 26 | |
michael@0 | 27 | #ifdef FREETYPE_H |
michael@0 | 28 | #error "freetype.h of FreeType 1 has been loaded!" |
michael@0 | 29 | #error "Please fix the directory search order for header files" |
michael@0 | 30 | #error "so that freetype.h of FreeType 2 is found first." |
michael@0 | 31 | #endif |
michael@0 | 32 | |
michael@0 | 33 | |
michael@0 | 34 | FT_BEGIN_HEADER |
michael@0 | 35 | |
michael@0 | 36 | |
michael@0 | 37 | /*************************************************************************/ |
michael@0 | 38 | /* */ |
michael@0 | 39 | /* <Section> */ |
michael@0 | 40 | /* outline_processing */ |
michael@0 | 41 | /* */ |
michael@0 | 42 | /* <Title> */ |
michael@0 | 43 | /* Outline Processing */ |
michael@0 | 44 | /* */ |
michael@0 | 45 | /* <Abstract> */ |
michael@0 | 46 | /* Functions to create, transform, and render vectorial glyph images. */ |
michael@0 | 47 | /* */ |
michael@0 | 48 | /* <Description> */ |
michael@0 | 49 | /* This section contains routines used to create and destroy scalable */ |
michael@0 | 50 | /* glyph images known as `outlines'. These can also be measured, */ |
michael@0 | 51 | /* transformed, and converted into bitmaps and pixmaps. */ |
michael@0 | 52 | /* */ |
michael@0 | 53 | /* <Order> */ |
michael@0 | 54 | /* FT_Outline */ |
michael@0 | 55 | /* FT_OUTLINE_FLAGS */ |
michael@0 | 56 | /* FT_Outline_New */ |
michael@0 | 57 | /* FT_Outline_Done */ |
michael@0 | 58 | /* FT_Outline_Copy */ |
michael@0 | 59 | /* FT_Outline_Translate */ |
michael@0 | 60 | /* FT_Outline_Transform */ |
michael@0 | 61 | /* FT_Outline_Embolden */ |
michael@0 | 62 | /* FT_Outline_EmboldenXY */ |
michael@0 | 63 | /* FT_Outline_Reverse */ |
michael@0 | 64 | /* FT_Outline_Check */ |
michael@0 | 65 | /* */ |
michael@0 | 66 | /* FT_Outline_Get_CBox */ |
michael@0 | 67 | /* FT_Outline_Get_BBox */ |
michael@0 | 68 | /* */ |
michael@0 | 69 | /* FT_Outline_Get_Bitmap */ |
michael@0 | 70 | /* FT_Outline_Render */ |
michael@0 | 71 | /* */ |
michael@0 | 72 | /* FT_Outline_Decompose */ |
michael@0 | 73 | /* FT_Outline_Funcs */ |
michael@0 | 74 | /* FT_Outline_MoveTo_Func */ |
michael@0 | 75 | /* FT_Outline_LineTo_Func */ |
michael@0 | 76 | /* FT_Outline_ConicTo_Func */ |
michael@0 | 77 | /* FT_Outline_CubicTo_Func */ |
michael@0 | 78 | /* */ |
michael@0 | 79 | /*************************************************************************/ |
michael@0 | 80 | |
michael@0 | 81 | |
michael@0 | 82 | /*************************************************************************/ |
michael@0 | 83 | /* */ |
michael@0 | 84 | /* <Function> */ |
michael@0 | 85 | /* FT_Outline_Decompose */ |
michael@0 | 86 | /* */ |
michael@0 | 87 | /* <Description> */ |
michael@0 | 88 | /* Walk over an outline's structure to decompose it into individual */ |
michael@0 | 89 | /* segments and Bézier arcs. This function also emits `move to' */ |
michael@0 | 90 | /* operations to indicate the start of new contours in the outline. */ |
michael@0 | 91 | /* */ |
michael@0 | 92 | /* <Input> */ |
michael@0 | 93 | /* outline :: A pointer to the source target. */ |
michael@0 | 94 | /* */ |
michael@0 | 95 | /* func_interface :: A table of `emitters', i.e., function pointers */ |
michael@0 | 96 | /* called during decomposition to indicate path */ |
michael@0 | 97 | /* operations. */ |
michael@0 | 98 | /* */ |
michael@0 | 99 | /* <InOut> */ |
michael@0 | 100 | /* user :: A typeless pointer that is passed to each */ |
michael@0 | 101 | /* emitter during the decomposition. It can be */ |
michael@0 | 102 | /* used to store the state during the */ |
michael@0 | 103 | /* decomposition. */ |
michael@0 | 104 | /* */ |
michael@0 | 105 | /* <Return> */ |
michael@0 | 106 | /* FreeType error code. 0~means success. */ |
michael@0 | 107 | /* */ |
michael@0 | 108 | /* <Note> */ |
michael@0 | 109 | /* A contour that contains a single point only is represented by a */ |
michael@0 | 110 | /* `move to' operation followed by `line to' to the same point. In */ |
michael@0 | 111 | /* most cases, it is best to filter this out before using the */ |
michael@0 | 112 | /* outline for stroking purposes (otherwise it would result in a */ |
michael@0 | 113 | /* visible dot when round caps are used). */ |
michael@0 | 114 | /* */ |
michael@0 | 115 | FT_EXPORT( FT_Error ) |
michael@0 | 116 | FT_Outline_Decompose( FT_Outline* outline, |
michael@0 | 117 | const FT_Outline_Funcs* func_interface, |
michael@0 | 118 | void* user ); |
michael@0 | 119 | |
michael@0 | 120 | |
michael@0 | 121 | /*************************************************************************/ |
michael@0 | 122 | /* */ |
michael@0 | 123 | /* <Function> */ |
michael@0 | 124 | /* FT_Outline_New */ |
michael@0 | 125 | /* */ |
michael@0 | 126 | /* <Description> */ |
michael@0 | 127 | /* Create a new outline of a given size. */ |
michael@0 | 128 | /* */ |
michael@0 | 129 | /* <Input> */ |
michael@0 | 130 | /* library :: A handle to the library object from where the */ |
michael@0 | 131 | /* outline is allocated. Note however that the new */ |
michael@0 | 132 | /* outline will *not* necessarily be *freed*, when */ |
michael@0 | 133 | /* destroying the library, by @FT_Done_FreeType. */ |
michael@0 | 134 | /* */ |
michael@0 | 135 | /* numPoints :: The maximum number of points within the outline. */ |
michael@0 | 136 | /* Must be smaller than or equal to 0xFFFF (65535). */ |
michael@0 | 137 | /* */ |
michael@0 | 138 | /* numContours :: The maximum number of contours within the outline. */ |
michael@0 | 139 | /* This value must be in the range 0 to `numPoints'. */ |
michael@0 | 140 | /* */ |
michael@0 | 141 | /* <Output> */ |
michael@0 | 142 | /* anoutline :: A handle to the new outline. */ |
michael@0 | 143 | /* */ |
michael@0 | 144 | /* <Return> */ |
michael@0 | 145 | /* FreeType error code. 0~means success. */ |
michael@0 | 146 | /* */ |
michael@0 | 147 | /* <Note> */ |
michael@0 | 148 | /* The reason why this function takes a `library' parameter is simply */ |
michael@0 | 149 | /* to use the library's memory allocator. */ |
michael@0 | 150 | /* */ |
michael@0 | 151 | FT_EXPORT( FT_Error ) |
michael@0 | 152 | FT_Outline_New( FT_Library library, |
michael@0 | 153 | FT_UInt numPoints, |
michael@0 | 154 | FT_Int numContours, |
michael@0 | 155 | FT_Outline *anoutline ); |
michael@0 | 156 | |
michael@0 | 157 | |
michael@0 | 158 | FT_EXPORT( FT_Error ) |
michael@0 | 159 | FT_Outline_New_Internal( FT_Memory memory, |
michael@0 | 160 | FT_UInt numPoints, |
michael@0 | 161 | FT_Int numContours, |
michael@0 | 162 | FT_Outline *anoutline ); |
michael@0 | 163 | |
michael@0 | 164 | |
michael@0 | 165 | /*************************************************************************/ |
michael@0 | 166 | /* */ |
michael@0 | 167 | /* <Function> */ |
michael@0 | 168 | /* FT_Outline_Done */ |
michael@0 | 169 | /* */ |
michael@0 | 170 | /* <Description> */ |
michael@0 | 171 | /* Destroy an outline created with @FT_Outline_New. */ |
michael@0 | 172 | /* */ |
michael@0 | 173 | /* <Input> */ |
michael@0 | 174 | /* library :: A handle of the library object used to allocate the */ |
michael@0 | 175 | /* outline. */ |
michael@0 | 176 | /* */ |
michael@0 | 177 | /* outline :: A pointer to the outline object to be discarded. */ |
michael@0 | 178 | /* */ |
michael@0 | 179 | /* <Return> */ |
michael@0 | 180 | /* FreeType error code. 0~means success. */ |
michael@0 | 181 | /* */ |
michael@0 | 182 | /* <Note> */ |
michael@0 | 183 | /* If the outline's `owner' field is not set, only the outline */ |
michael@0 | 184 | /* descriptor will be released. */ |
michael@0 | 185 | /* */ |
michael@0 | 186 | /* The reason why this function takes an `library' parameter is */ |
michael@0 | 187 | /* simply to use ft_mem_free(). */ |
michael@0 | 188 | /* */ |
michael@0 | 189 | FT_EXPORT( FT_Error ) |
michael@0 | 190 | FT_Outline_Done( FT_Library library, |
michael@0 | 191 | FT_Outline* outline ); |
michael@0 | 192 | |
michael@0 | 193 | |
michael@0 | 194 | FT_EXPORT( FT_Error ) |
michael@0 | 195 | FT_Outline_Done_Internal( FT_Memory memory, |
michael@0 | 196 | FT_Outline* outline ); |
michael@0 | 197 | |
michael@0 | 198 | |
michael@0 | 199 | /*************************************************************************/ |
michael@0 | 200 | /* */ |
michael@0 | 201 | /* <Function> */ |
michael@0 | 202 | /* FT_Outline_Check */ |
michael@0 | 203 | /* */ |
michael@0 | 204 | /* <Description> */ |
michael@0 | 205 | /* Check the contents of an outline descriptor. */ |
michael@0 | 206 | /* */ |
michael@0 | 207 | /* <Input> */ |
michael@0 | 208 | /* outline :: A handle to a source outline. */ |
michael@0 | 209 | /* */ |
michael@0 | 210 | /* <Return> */ |
michael@0 | 211 | /* FreeType error code. 0~means success. */ |
michael@0 | 212 | /* */ |
michael@0 | 213 | FT_EXPORT( FT_Error ) |
michael@0 | 214 | FT_Outline_Check( FT_Outline* outline ); |
michael@0 | 215 | |
michael@0 | 216 | |
michael@0 | 217 | /*************************************************************************/ |
michael@0 | 218 | /* */ |
michael@0 | 219 | /* <Function> */ |
michael@0 | 220 | /* FT_Outline_Get_CBox */ |
michael@0 | 221 | /* */ |
michael@0 | 222 | /* <Description> */ |
michael@0 | 223 | /* Return an outline's `control box'. The control box encloses all */ |
michael@0 | 224 | /* the outline's points, including Bézier control points. Though it */ |
michael@0 | 225 | /* coincides with the exact bounding box for most glyphs, it can be */ |
michael@0 | 226 | /* slightly larger in some situations (like when rotating an outline */ |
michael@0 | 227 | /* that contains Bézier outside arcs). */ |
michael@0 | 228 | /* */ |
michael@0 | 229 | /* Computing the control box is very fast, while getting the bounding */ |
michael@0 | 230 | /* box can take much more time as it needs to walk over all segments */ |
michael@0 | 231 | /* and arcs in the outline. To get the latter, you can use the */ |
michael@0 | 232 | /* `ftbbox' component, which is dedicated to this single task. */ |
michael@0 | 233 | /* */ |
michael@0 | 234 | /* <Input> */ |
michael@0 | 235 | /* outline :: A pointer to the source outline descriptor. */ |
michael@0 | 236 | /* */ |
michael@0 | 237 | /* <Output> */ |
michael@0 | 238 | /* acbox :: The outline's control box. */ |
michael@0 | 239 | /* */ |
michael@0 | 240 | /* <Note> */ |
michael@0 | 241 | /* See @FT_Glyph_Get_CBox for a discussion of tricky fonts. */ |
michael@0 | 242 | /* */ |
michael@0 | 243 | FT_EXPORT( void ) |
michael@0 | 244 | FT_Outline_Get_CBox( const FT_Outline* outline, |
michael@0 | 245 | FT_BBox *acbox ); |
michael@0 | 246 | |
michael@0 | 247 | |
michael@0 | 248 | /*************************************************************************/ |
michael@0 | 249 | /* */ |
michael@0 | 250 | /* <Function> */ |
michael@0 | 251 | /* FT_Outline_Translate */ |
michael@0 | 252 | /* */ |
michael@0 | 253 | /* <Description> */ |
michael@0 | 254 | /* Apply a simple translation to the points of an outline. */ |
michael@0 | 255 | /* */ |
michael@0 | 256 | /* <InOut> */ |
michael@0 | 257 | /* outline :: A pointer to the target outline descriptor. */ |
michael@0 | 258 | /* */ |
michael@0 | 259 | /* <Input> */ |
michael@0 | 260 | /* xOffset :: The horizontal offset. */ |
michael@0 | 261 | /* */ |
michael@0 | 262 | /* yOffset :: The vertical offset. */ |
michael@0 | 263 | /* */ |
michael@0 | 264 | FT_EXPORT( void ) |
michael@0 | 265 | FT_Outline_Translate( const FT_Outline* outline, |
michael@0 | 266 | FT_Pos xOffset, |
michael@0 | 267 | FT_Pos yOffset ); |
michael@0 | 268 | |
michael@0 | 269 | |
michael@0 | 270 | /*************************************************************************/ |
michael@0 | 271 | /* */ |
michael@0 | 272 | /* <Function> */ |
michael@0 | 273 | /* FT_Outline_Copy */ |
michael@0 | 274 | /* */ |
michael@0 | 275 | /* <Description> */ |
michael@0 | 276 | /* Copy an outline into another one. Both objects must have the */ |
michael@0 | 277 | /* same sizes (number of points & number of contours) when this */ |
michael@0 | 278 | /* function is called. */ |
michael@0 | 279 | /* */ |
michael@0 | 280 | /* <Input> */ |
michael@0 | 281 | /* source :: A handle to the source outline. */ |
michael@0 | 282 | /* */ |
michael@0 | 283 | /* <Output> */ |
michael@0 | 284 | /* target :: A handle to the target outline. */ |
michael@0 | 285 | /* */ |
michael@0 | 286 | /* <Return> */ |
michael@0 | 287 | /* FreeType error code. 0~means success. */ |
michael@0 | 288 | /* */ |
michael@0 | 289 | FT_EXPORT( FT_Error ) |
michael@0 | 290 | FT_Outline_Copy( const FT_Outline* source, |
michael@0 | 291 | FT_Outline *target ); |
michael@0 | 292 | |
michael@0 | 293 | |
michael@0 | 294 | /*************************************************************************/ |
michael@0 | 295 | /* */ |
michael@0 | 296 | /* <Function> */ |
michael@0 | 297 | /* FT_Outline_Transform */ |
michael@0 | 298 | /* */ |
michael@0 | 299 | /* <Description> */ |
michael@0 | 300 | /* Apply a simple 2x2 matrix to all of an outline's points. Useful */ |
michael@0 | 301 | /* for applying rotations, slanting, flipping, etc. */ |
michael@0 | 302 | /* */ |
michael@0 | 303 | /* <InOut> */ |
michael@0 | 304 | /* outline :: A pointer to the target outline descriptor. */ |
michael@0 | 305 | /* */ |
michael@0 | 306 | /* <Input> */ |
michael@0 | 307 | /* matrix :: A pointer to the transformation matrix. */ |
michael@0 | 308 | /* */ |
michael@0 | 309 | /* <Note> */ |
michael@0 | 310 | /* You can use @FT_Outline_Translate if you need to translate the */ |
michael@0 | 311 | /* outline's points. */ |
michael@0 | 312 | /* */ |
michael@0 | 313 | FT_EXPORT( void ) |
michael@0 | 314 | FT_Outline_Transform( const FT_Outline* outline, |
michael@0 | 315 | const FT_Matrix* matrix ); |
michael@0 | 316 | |
michael@0 | 317 | |
michael@0 | 318 | /*************************************************************************/ |
michael@0 | 319 | /* */ |
michael@0 | 320 | /* <Function> */ |
michael@0 | 321 | /* FT_Outline_Embolden */ |
michael@0 | 322 | /* */ |
michael@0 | 323 | /* <Description> */ |
michael@0 | 324 | /* Embolden an outline. The new outline will be at most 4~times */ |
michael@0 | 325 | /* `strength' pixels wider and higher. You may think of the left and */ |
michael@0 | 326 | /* bottom borders as unchanged. */ |
michael@0 | 327 | /* */ |
michael@0 | 328 | /* Negative `strength' values to reduce the outline thickness are */ |
michael@0 | 329 | /* possible also. */ |
michael@0 | 330 | /* */ |
michael@0 | 331 | /* <InOut> */ |
michael@0 | 332 | /* outline :: A handle to the target outline. */ |
michael@0 | 333 | /* */ |
michael@0 | 334 | /* <Input> */ |
michael@0 | 335 | /* strength :: How strong the glyph is emboldened. Expressed in */ |
michael@0 | 336 | /* 26.6 pixel format. */ |
michael@0 | 337 | /* */ |
michael@0 | 338 | /* <Return> */ |
michael@0 | 339 | /* FreeType error code. 0~means success. */ |
michael@0 | 340 | /* */ |
michael@0 | 341 | /* <Note> */ |
michael@0 | 342 | /* The used algorithm to increase or decrease the thickness of the */ |
michael@0 | 343 | /* glyph doesn't change the number of points; this means that certain */ |
michael@0 | 344 | /* situations like acute angles or intersections are sometimes */ |
michael@0 | 345 | /* handled incorrectly. */ |
michael@0 | 346 | /* */ |
michael@0 | 347 | /* If you need `better' metrics values you should call */ |
michael@0 | 348 | /* @FT_Outline_Get_CBox or @FT_Outline_Get_BBox. */ |
michael@0 | 349 | /* */ |
michael@0 | 350 | /* Example call: */ |
michael@0 | 351 | /* */ |
michael@0 | 352 | /* { */ |
michael@0 | 353 | /* FT_Load_Glyph( face, index, FT_LOAD_DEFAULT ); */ |
michael@0 | 354 | /* if ( face->slot->format == FT_GLYPH_FORMAT_OUTLINE ) */ |
michael@0 | 355 | /* FT_Outline_Embolden( &face->slot->outline, strength ); */ |
michael@0 | 356 | /* } */ |
michael@0 | 357 | /* */ |
michael@0 | 358 | /* To get meaningful results, font scaling values must be set with */ |
michael@0 | 359 | /* functions like @FT_Set_Char_Size before calling FT_Render_Glyph. */ |
michael@0 | 360 | /* */ |
michael@0 | 361 | FT_EXPORT( FT_Error ) |
michael@0 | 362 | FT_Outline_Embolden( FT_Outline* outline, |
michael@0 | 363 | FT_Pos strength ); |
michael@0 | 364 | |
michael@0 | 365 | |
michael@0 | 366 | /*************************************************************************/ |
michael@0 | 367 | /* */ |
michael@0 | 368 | /* <Function> */ |
michael@0 | 369 | /* FT_Outline_EmboldenXY */ |
michael@0 | 370 | /* */ |
michael@0 | 371 | /* <Description> */ |
michael@0 | 372 | /* Embolden an outline. The new outline will be `xstrength' pixels */ |
michael@0 | 373 | /* wider and `ystrength' pixels higher. Otherwise, it is similar to */ |
michael@0 | 374 | /* @FT_Outline_Embolden, which uses the same strength in both */ |
michael@0 | 375 | /* directions. */ |
michael@0 | 376 | /* */ |
michael@0 | 377 | FT_EXPORT( FT_Error ) |
michael@0 | 378 | FT_Outline_EmboldenXY( FT_Outline* outline, |
michael@0 | 379 | FT_Pos xstrength, |
michael@0 | 380 | FT_Pos ystrength ); |
michael@0 | 381 | |
michael@0 | 382 | |
michael@0 | 383 | /*************************************************************************/ |
michael@0 | 384 | /* */ |
michael@0 | 385 | /* <Function> */ |
michael@0 | 386 | /* FT_Outline_Reverse */ |
michael@0 | 387 | /* */ |
michael@0 | 388 | /* <Description> */ |
michael@0 | 389 | /* Reverse the drawing direction of an outline. This is used to */ |
michael@0 | 390 | /* ensure consistent fill conventions for mirrored glyphs. */ |
michael@0 | 391 | /* */ |
michael@0 | 392 | /* <InOut> */ |
michael@0 | 393 | /* outline :: A pointer to the target outline descriptor. */ |
michael@0 | 394 | /* */ |
michael@0 | 395 | /* <Note> */ |
michael@0 | 396 | /* This function toggles the bit flag @FT_OUTLINE_REVERSE_FILL in */ |
michael@0 | 397 | /* the outline's `flags' field. */ |
michael@0 | 398 | /* */ |
michael@0 | 399 | /* It shouldn't be used by a normal client application, unless it */ |
michael@0 | 400 | /* knows what it is doing. */ |
michael@0 | 401 | /* */ |
michael@0 | 402 | FT_EXPORT( void ) |
michael@0 | 403 | FT_Outline_Reverse( FT_Outline* outline ); |
michael@0 | 404 | |
michael@0 | 405 | |
michael@0 | 406 | /*************************************************************************/ |
michael@0 | 407 | /* */ |
michael@0 | 408 | /* <Function> */ |
michael@0 | 409 | /* FT_Outline_Get_Bitmap */ |
michael@0 | 410 | /* */ |
michael@0 | 411 | /* <Description> */ |
michael@0 | 412 | /* Render an outline within a bitmap. The outline's image is simply */ |
michael@0 | 413 | /* OR-ed to the target bitmap. */ |
michael@0 | 414 | /* */ |
michael@0 | 415 | /* <Input> */ |
michael@0 | 416 | /* library :: A handle to a FreeType library object. */ |
michael@0 | 417 | /* */ |
michael@0 | 418 | /* outline :: A pointer to the source outline descriptor. */ |
michael@0 | 419 | /* */ |
michael@0 | 420 | /* <InOut> */ |
michael@0 | 421 | /* abitmap :: A pointer to the target bitmap descriptor. */ |
michael@0 | 422 | /* */ |
michael@0 | 423 | /* <Return> */ |
michael@0 | 424 | /* FreeType error code. 0~means success. */ |
michael@0 | 425 | /* */ |
michael@0 | 426 | /* <Note> */ |
michael@0 | 427 | /* This function does NOT CREATE the bitmap, it only renders an */ |
michael@0 | 428 | /* outline image within the one you pass to it! Consequently, the */ |
michael@0 | 429 | /* various fields in `abitmap' should be set accordingly. */ |
michael@0 | 430 | /* */ |
michael@0 | 431 | /* It will use the raster corresponding to the default glyph format. */ |
michael@0 | 432 | /* */ |
michael@0 | 433 | /* The value of the `num_grays' field in `abitmap' is ignored. If */ |
michael@0 | 434 | /* you select the gray-level rasterizer, and you want less than 256 */ |
michael@0 | 435 | /* gray levels, you have to use @FT_Outline_Render directly. */ |
michael@0 | 436 | /* */ |
michael@0 | 437 | FT_EXPORT( FT_Error ) |
michael@0 | 438 | FT_Outline_Get_Bitmap( FT_Library library, |
michael@0 | 439 | FT_Outline* outline, |
michael@0 | 440 | const FT_Bitmap *abitmap ); |
michael@0 | 441 | |
michael@0 | 442 | |
michael@0 | 443 | /*************************************************************************/ |
michael@0 | 444 | /* */ |
michael@0 | 445 | /* <Function> */ |
michael@0 | 446 | /* FT_Outline_Render */ |
michael@0 | 447 | /* */ |
michael@0 | 448 | /* <Description> */ |
michael@0 | 449 | /* Render an outline within a bitmap using the current scan-convert. */ |
michael@0 | 450 | /* This function uses an @FT_Raster_Params structure as an argument, */ |
michael@0 | 451 | /* allowing advanced features like direct composition, translucency, */ |
michael@0 | 452 | /* etc. */ |
michael@0 | 453 | /* */ |
michael@0 | 454 | /* <Input> */ |
michael@0 | 455 | /* library :: A handle to a FreeType library object. */ |
michael@0 | 456 | /* */ |
michael@0 | 457 | /* outline :: A pointer to the source outline descriptor. */ |
michael@0 | 458 | /* */ |
michael@0 | 459 | /* <InOut> */ |
michael@0 | 460 | /* params :: A pointer to an @FT_Raster_Params structure used to */ |
michael@0 | 461 | /* describe the rendering operation. */ |
michael@0 | 462 | /* */ |
michael@0 | 463 | /* <Return> */ |
michael@0 | 464 | /* FreeType error code. 0~means success. */ |
michael@0 | 465 | /* */ |
michael@0 | 466 | /* <Note> */ |
michael@0 | 467 | /* You should know what you are doing and how @FT_Raster_Params works */ |
michael@0 | 468 | /* to use this function. */ |
michael@0 | 469 | /* */ |
michael@0 | 470 | /* The field `params.source' will be set to `outline' before the scan */ |
michael@0 | 471 | /* converter is called, which means that the value you give to it is */ |
michael@0 | 472 | /* actually ignored. */ |
michael@0 | 473 | /* */ |
michael@0 | 474 | /* The gray-level rasterizer always uses 256 gray levels. If you */ |
michael@0 | 475 | /* want less gray levels, you have to provide your own span callback. */ |
michael@0 | 476 | /* See the @FT_RASTER_FLAG_DIRECT value of the `flags' field in the */ |
michael@0 | 477 | /* @FT_Raster_Params structure for more details. */ |
michael@0 | 478 | /* */ |
michael@0 | 479 | FT_EXPORT( FT_Error ) |
michael@0 | 480 | FT_Outline_Render( FT_Library library, |
michael@0 | 481 | FT_Outline* outline, |
michael@0 | 482 | FT_Raster_Params* params ); |
michael@0 | 483 | |
michael@0 | 484 | |
michael@0 | 485 | /************************************************************************** |
michael@0 | 486 | * |
michael@0 | 487 | * @enum: |
michael@0 | 488 | * FT_Orientation |
michael@0 | 489 | * |
michael@0 | 490 | * @description: |
michael@0 | 491 | * A list of values used to describe an outline's contour orientation. |
michael@0 | 492 | * |
michael@0 | 493 | * The TrueType and PostScript specifications use different conventions |
michael@0 | 494 | * to determine whether outline contours should be filled or unfilled. |
michael@0 | 495 | * |
michael@0 | 496 | * @values: |
michael@0 | 497 | * FT_ORIENTATION_TRUETYPE :: |
michael@0 | 498 | * According to the TrueType specification, clockwise contours must |
michael@0 | 499 | * be filled, and counter-clockwise ones must be unfilled. |
michael@0 | 500 | * |
michael@0 | 501 | * FT_ORIENTATION_POSTSCRIPT :: |
michael@0 | 502 | * According to the PostScript specification, counter-clockwise contours |
michael@0 | 503 | * must be filled, and clockwise ones must be unfilled. |
michael@0 | 504 | * |
michael@0 | 505 | * FT_ORIENTATION_FILL_RIGHT :: |
michael@0 | 506 | * This is identical to @FT_ORIENTATION_TRUETYPE, but is used to |
michael@0 | 507 | * remember that in TrueType, everything that is to the right of |
michael@0 | 508 | * the drawing direction of a contour must be filled. |
michael@0 | 509 | * |
michael@0 | 510 | * FT_ORIENTATION_FILL_LEFT :: |
michael@0 | 511 | * This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to |
michael@0 | 512 | * remember that in PostScript, everything that is to the left of |
michael@0 | 513 | * the drawing direction of a contour must be filled. |
michael@0 | 514 | * |
michael@0 | 515 | * FT_ORIENTATION_NONE :: |
michael@0 | 516 | * The orientation cannot be determined. That is, different parts of |
michael@0 | 517 | * the glyph have different orientation. |
michael@0 | 518 | * |
michael@0 | 519 | */ |
michael@0 | 520 | typedef enum FT_Orientation_ |
michael@0 | 521 | { |
michael@0 | 522 | FT_ORIENTATION_TRUETYPE = 0, |
michael@0 | 523 | FT_ORIENTATION_POSTSCRIPT = 1, |
michael@0 | 524 | FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE, |
michael@0 | 525 | FT_ORIENTATION_FILL_LEFT = FT_ORIENTATION_POSTSCRIPT, |
michael@0 | 526 | FT_ORIENTATION_NONE |
michael@0 | 527 | |
michael@0 | 528 | } FT_Orientation; |
michael@0 | 529 | |
michael@0 | 530 | |
michael@0 | 531 | /************************************************************************** |
michael@0 | 532 | * |
michael@0 | 533 | * @function: |
michael@0 | 534 | * FT_Outline_Get_Orientation |
michael@0 | 535 | * |
michael@0 | 536 | * @description: |
michael@0 | 537 | * This function analyzes a glyph outline and tries to compute its |
michael@0 | 538 | * fill orientation (see @FT_Orientation). This is done by integrating |
michael@0 | 539 | * the total area covered by the outline. The positive integral |
michael@0 | 540 | * corresponds to the clockwise orientation and @FT_ORIENTATION_POSTSCRIPT |
michael@0 | 541 | * is returned. The negative integral corresponds to the counter-clockwise |
michael@0 | 542 | * orientation and @FT_ORIENTATION_TRUETYPE is returned. |
michael@0 | 543 | * |
michael@0 | 544 | * Note that this will return @FT_ORIENTATION_TRUETYPE for empty |
michael@0 | 545 | * outlines. |
michael@0 | 546 | * |
michael@0 | 547 | * @input: |
michael@0 | 548 | * outline :: |
michael@0 | 549 | * A handle to the source outline. |
michael@0 | 550 | * |
michael@0 | 551 | * @return: |
michael@0 | 552 | * The orientation. |
michael@0 | 553 | * |
michael@0 | 554 | */ |
michael@0 | 555 | FT_EXPORT( FT_Orientation ) |
michael@0 | 556 | FT_Outline_Get_Orientation( FT_Outline* outline ); |
michael@0 | 557 | |
michael@0 | 558 | |
michael@0 | 559 | /* */ |
michael@0 | 560 | |
michael@0 | 561 | |
michael@0 | 562 | FT_END_HEADER |
michael@0 | 563 | |
michael@0 | 564 | #endif /* __FTOUTLN_H__ */ |
michael@0 | 565 | |
michael@0 | 566 | |
michael@0 | 567 | /* END */ |
michael@0 | 568 | |
michael@0 | 569 | |
michael@0 | 570 | /* Local Variables: */ |
michael@0 | 571 | /* coding: utf-8 */ |
michael@0 | 572 | /* End: */ |