vrshoot
diff libs/ft2static/freetype/ftoutln.h @ 0:b2f14e535253
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 01 Feb 2014 19:58:19 +0200 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libs/ft2static/freetype/ftoutln.h Sat Feb 01 19:58:19 2014 +0200 1.3 @@ -0,0 +1,537 @@ 1.4 +/***************************************************************************/ 1.5 +/* */ 1.6 +/* ftoutln.h */ 1.7 +/* */ 1.8 +/* Support for the FT_Outline type used to store glyph shapes of */ 1.9 +/* most scalable font formats (specification). */ 1.10 +/* */ 1.11 +/* Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010 by */ 1.12 +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ 1.13 +/* */ 1.14 +/* This file is part of the FreeType project, and may only be used, */ 1.15 +/* modified, and distributed under the terms of the FreeType project */ 1.16 +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 1.17 +/* this file you indicate that you have read the license and */ 1.18 +/* understand and accept it fully. */ 1.19 +/* */ 1.20 +/***************************************************************************/ 1.21 + 1.22 + 1.23 +#ifndef __FTOUTLN_H__ 1.24 +#define __FTOUTLN_H__ 1.25 + 1.26 + 1.27 +#include <ft2build.h> 1.28 +#include FT_FREETYPE_H 1.29 + 1.30 +#ifdef FREETYPE_H 1.31 +#error "freetype.h of FreeType 1 has been loaded!" 1.32 +#error "Please fix the directory search order for header files" 1.33 +#error "so that freetype.h of FreeType 2 is found first." 1.34 +#endif 1.35 + 1.36 + 1.37 +FT_BEGIN_HEADER 1.38 + 1.39 + 1.40 + /*************************************************************************/ 1.41 + /* */ 1.42 + /* <Section> */ 1.43 + /* outline_processing */ 1.44 + /* */ 1.45 + /* <Title> */ 1.46 + /* Outline Processing */ 1.47 + /* */ 1.48 + /* <Abstract> */ 1.49 + /* Functions to create, transform, and render vectorial glyph images. */ 1.50 + /* */ 1.51 + /* <Description> */ 1.52 + /* This section contains routines used to create and destroy scalable */ 1.53 + /* glyph images known as `outlines'. These can also be measured, */ 1.54 + /* transformed, and converted into bitmaps and pixmaps. */ 1.55 + /* */ 1.56 + /* <Order> */ 1.57 + /* FT_Outline */ 1.58 + /* FT_OUTLINE_FLAGS */ 1.59 + /* FT_Outline_New */ 1.60 + /* FT_Outline_Done */ 1.61 + /* FT_Outline_Copy */ 1.62 + /* FT_Outline_Translate */ 1.63 + /* FT_Outline_Transform */ 1.64 + /* FT_Outline_Embolden */ 1.65 + /* FT_Outline_Reverse */ 1.66 + /* FT_Outline_Check */ 1.67 + /* */ 1.68 + /* FT_Outline_Get_CBox */ 1.69 + /* FT_Outline_Get_BBox */ 1.70 + /* */ 1.71 + /* FT_Outline_Get_Bitmap */ 1.72 + /* FT_Outline_Render */ 1.73 + /* */ 1.74 + /* FT_Outline_Decompose */ 1.75 + /* FT_Outline_Funcs */ 1.76 + /* FT_Outline_MoveTo_Func */ 1.77 + /* FT_Outline_LineTo_Func */ 1.78 + /* FT_Outline_ConicTo_Func */ 1.79 + /* FT_Outline_CubicTo_Func */ 1.80 + /* */ 1.81 + /*************************************************************************/ 1.82 + 1.83 + 1.84 + /*************************************************************************/ 1.85 + /* */ 1.86 + /* <Function> */ 1.87 + /* FT_Outline_Decompose */ 1.88 + /* */ 1.89 + /* <Description> */ 1.90 + /* Walk over an outline's structure to decompose it into individual */ 1.91 + /* segments and Bézier arcs. This function also emits `move to' */ 1.92 + /* operations to indicate the start of new contours in the outline. */ 1.93 + /* */ 1.94 + /* <Input> */ 1.95 + /* outline :: A pointer to the source target. */ 1.96 + /* */ 1.97 + /* func_interface :: A table of `emitters', i.e., function pointers */ 1.98 + /* called during decomposition to indicate path */ 1.99 + /* operations. */ 1.100 + /* */ 1.101 + /* <InOut> */ 1.102 + /* user :: A typeless pointer which is passed to each */ 1.103 + /* emitter during the decomposition. It can be */ 1.104 + /* used to store the state during the */ 1.105 + /* decomposition. */ 1.106 + /* */ 1.107 + /* <Return> */ 1.108 + /* FreeType error code. 0~means success. */ 1.109 + /* */ 1.110 + FT_EXPORT( FT_Error ) 1.111 + FT_Outline_Decompose( FT_Outline* outline, 1.112 + const FT_Outline_Funcs* func_interface, 1.113 + void* user ); 1.114 + 1.115 + 1.116 + /*************************************************************************/ 1.117 + /* */ 1.118 + /* <Function> */ 1.119 + /* FT_Outline_New */ 1.120 + /* */ 1.121 + /* <Description> */ 1.122 + /* Create a new outline of a given size. */ 1.123 + /* */ 1.124 + /* <Input> */ 1.125 + /* library :: A handle to the library object from where the */ 1.126 + /* outline is allocated. Note however that the new */ 1.127 + /* outline will *not* necessarily be *freed*, when */ 1.128 + /* destroying the library, by @FT_Done_FreeType. */ 1.129 + /* */ 1.130 + /* numPoints :: The maximal number of points within the outline. */ 1.131 + /* */ 1.132 + /* numContours :: The maximal number of contours within the outline. */ 1.133 + /* */ 1.134 + /* <Output> */ 1.135 + /* anoutline :: A handle to the new outline. */ 1.136 + /* */ 1.137 + /* <Return> */ 1.138 + /* FreeType error code. 0~means success. */ 1.139 + /* */ 1.140 + /* <Note> */ 1.141 + /* The reason why this function takes a `library' parameter is simply */ 1.142 + /* to use the library's memory allocator. */ 1.143 + /* */ 1.144 + FT_EXPORT( FT_Error ) 1.145 + FT_Outline_New( FT_Library library, 1.146 + FT_UInt numPoints, 1.147 + FT_Int numContours, 1.148 + FT_Outline *anoutline ); 1.149 + 1.150 + 1.151 + FT_EXPORT( FT_Error ) 1.152 + FT_Outline_New_Internal( FT_Memory memory, 1.153 + FT_UInt numPoints, 1.154 + FT_Int numContours, 1.155 + FT_Outline *anoutline ); 1.156 + 1.157 + 1.158 + /*************************************************************************/ 1.159 + /* */ 1.160 + /* <Function> */ 1.161 + /* FT_Outline_Done */ 1.162 + /* */ 1.163 + /* <Description> */ 1.164 + /* Destroy an outline created with @FT_Outline_New. */ 1.165 + /* */ 1.166 + /* <Input> */ 1.167 + /* library :: A handle of the library object used to allocate the */ 1.168 + /* outline. */ 1.169 + /* */ 1.170 + /* outline :: A pointer to the outline object to be discarded. */ 1.171 + /* */ 1.172 + /* <Return> */ 1.173 + /* FreeType error code. 0~means success. */ 1.174 + /* */ 1.175 + /* <Note> */ 1.176 + /* If the outline's `owner' field is not set, only the outline */ 1.177 + /* descriptor will be released. */ 1.178 + /* */ 1.179 + /* The reason why this function takes an `library' parameter is */ 1.180 + /* simply to use ft_mem_free(). */ 1.181 + /* */ 1.182 + FT_EXPORT( FT_Error ) 1.183 + FT_Outline_Done( FT_Library library, 1.184 + FT_Outline* outline ); 1.185 + 1.186 + 1.187 + FT_EXPORT( FT_Error ) 1.188 + FT_Outline_Done_Internal( FT_Memory memory, 1.189 + FT_Outline* outline ); 1.190 + 1.191 + 1.192 + /*************************************************************************/ 1.193 + /* */ 1.194 + /* <Function> */ 1.195 + /* FT_Outline_Check */ 1.196 + /* */ 1.197 + /* <Description> */ 1.198 + /* Check the contents of an outline descriptor. */ 1.199 + /* */ 1.200 + /* <Input> */ 1.201 + /* outline :: A handle to a source outline. */ 1.202 + /* */ 1.203 + /* <Return> */ 1.204 + /* FreeType error code. 0~means success. */ 1.205 + /* */ 1.206 + FT_EXPORT( FT_Error ) 1.207 + FT_Outline_Check( FT_Outline* outline ); 1.208 + 1.209 + 1.210 + /*************************************************************************/ 1.211 + /* */ 1.212 + /* <Function> */ 1.213 + /* FT_Outline_Get_CBox */ 1.214 + /* */ 1.215 + /* <Description> */ 1.216 + /* Return an outline's `control box'. The control box encloses all */ 1.217 + /* the outline's points, including Bézier control points. Though it */ 1.218 + /* coincides with the exact bounding box for most glyphs, it can be */ 1.219 + /* slightly larger in some situations (like when rotating an outline */ 1.220 + /* which contains Bézier outside arcs). */ 1.221 + /* */ 1.222 + /* Computing the control box is very fast, while getting the bounding */ 1.223 + /* box can take much more time as it needs to walk over all segments */ 1.224 + /* and arcs in the outline. To get the latter, you can use the */ 1.225 + /* `ftbbox' component which is dedicated to this single task. */ 1.226 + /* */ 1.227 + /* <Input> */ 1.228 + /* outline :: A pointer to the source outline descriptor. */ 1.229 + /* */ 1.230 + /* <Output> */ 1.231 + /* acbox :: The outline's control box. */ 1.232 + /* */ 1.233 + FT_EXPORT( void ) 1.234 + FT_Outline_Get_CBox( const FT_Outline* outline, 1.235 + FT_BBox *acbox ); 1.236 + 1.237 + 1.238 + /*************************************************************************/ 1.239 + /* */ 1.240 + /* <Function> */ 1.241 + /* FT_Outline_Translate */ 1.242 + /* */ 1.243 + /* <Description> */ 1.244 + /* Apply a simple translation to the points of an outline. */ 1.245 + /* */ 1.246 + /* <InOut> */ 1.247 + /* outline :: A pointer to the target outline descriptor. */ 1.248 + /* */ 1.249 + /* <Input> */ 1.250 + /* xOffset :: The horizontal offset. */ 1.251 + /* */ 1.252 + /* yOffset :: The vertical offset. */ 1.253 + /* */ 1.254 + FT_EXPORT( void ) 1.255 + FT_Outline_Translate( const FT_Outline* outline, 1.256 + FT_Pos xOffset, 1.257 + FT_Pos yOffset ); 1.258 + 1.259 + 1.260 + /*************************************************************************/ 1.261 + /* */ 1.262 + /* <Function> */ 1.263 + /* FT_Outline_Copy */ 1.264 + /* */ 1.265 + /* <Description> */ 1.266 + /* Copy an outline into another one. Both objects must have the */ 1.267 + /* same sizes (number of points & number of contours) when this */ 1.268 + /* function is called. */ 1.269 + /* */ 1.270 + /* <Input> */ 1.271 + /* source :: A handle to the source outline. */ 1.272 + /* */ 1.273 + /* <Output> */ 1.274 + /* target :: A handle to the target outline. */ 1.275 + /* */ 1.276 + /* <Return> */ 1.277 + /* FreeType error code. 0~means success. */ 1.278 + /* */ 1.279 + FT_EXPORT( FT_Error ) 1.280 + FT_Outline_Copy( const FT_Outline* source, 1.281 + FT_Outline *target ); 1.282 + 1.283 + 1.284 + /*************************************************************************/ 1.285 + /* */ 1.286 + /* <Function> */ 1.287 + /* FT_Outline_Transform */ 1.288 + /* */ 1.289 + /* <Description> */ 1.290 + /* Apply a simple 2x2 matrix to all of an outline's points. Useful */ 1.291 + /* for applying rotations, slanting, flipping, etc. */ 1.292 + /* */ 1.293 + /* <InOut> */ 1.294 + /* outline :: A pointer to the target outline descriptor. */ 1.295 + /* */ 1.296 + /* <Input> */ 1.297 + /* matrix :: A pointer to the transformation matrix. */ 1.298 + /* */ 1.299 + /* <Note> */ 1.300 + /* You can use @FT_Outline_Translate if you need to translate the */ 1.301 + /* outline's points. */ 1.302 + /* */ 1.303 + FT_EXPORT( void ) 1.304 + FT_Outline_Transform( const FT_Outline* outline, 1.305 + const FT_Matrix* matrix ); 1.306 + 1.307 + 1.308 + /*************************************************************************/ 1.309 + /* */ 1.310 + /* <Function> */ 1.311 + /* FT_Outline_Embolden */ 1.312 + /* */ 1.313 + /* <Description> */ 1.314 + /* Embolden an outline. The new outline will be at most 4~times */ 1.315 + /* `strength' pixels wider and higher. You may think of the left and */ 1.316 + /* bottom borders as unchanged. */ 1.317 + /* */ 1.318 + /* Negative `strength' values to reduce the outline thickness are */ 1.319 + /* possible also. */ 1.320 + /* */ 1.321 + /* <InOut> */ 1.322 + /* outline :: A handle to the target outline. */ 1.323 + /* */ 1.324 + /* <Input> */ 1.325 + /* strength :: How strong the glyph is emboldened. Expressed in */ 1.326 + /* 26.6 pixel format. */ 1.327 + /* */ 1.328 + /* <Return> */ 1.329 + /* FreeType error code. 0~means success. */ 1.330 + /* */ 1.331 + /* <Note> */ 1.332 + /* The used algorithm to increase or decrease the thickness of the */ 1.333 + /* glyph doesn't change the number of points; this means that certain */ 1.334 + /* situations like acute angles or intersections are sometimes */ 1.335 + /* handled incorrectly. */ 1.336 + /* */ 1.337 + /* If you need `better' metrics values you should call */ 1.338 + /* @FT_Outline_Get_CBox ot @FT_Outline_Get_BBox. */ 1.339 + /* */ 1.340 + /* Example call: */ 1.341 + /* */ 1.342 + /* { */ 1.343 + /* FT_Load_Glyph( face, index, FT_LOAD_DEFAULT ); */ 1.344 + /* if ( face->slot->format == FT_GLYPH_FORMAT_OUTLINE ) */ 1.345 + /* FT_Outline_Embolden( &face->slot->outline, strength ); */ 1.346 + /* } */ 1.347 + /* */ 1.348 + FT_EXPORT( FT_Error ) 1.349 + FT_Outline_Embolden( FT_Outline* outline, 1.350 + FT_Pos strength ); 1.351 + 1.352 + 1.353 + /*************************************************************************/ 1.354 + /* */ 1.355 + /* <Function> */ 1.356 + /* FT_Outline_Reverse */ 1.357 + /* */ 1.358 + /* <Description> */ 1.359 + /* Reverse the drawing direction of an outline. This is used to */ 1.360 + /* ensure consistent fill conventions for mirrored glyphs. */ 1.361 + /* */ 1.362 + /* <InOut> */ 1.363 + /* outline :: A pointer to the target outline descriptor. */ 1.364 + /* */ 1.365 + /* <Note> */ 1.366 + /* This function toggles the bit flag @FT_OUTLINE_REVERSE_FILL in */ 1.367 + /* the outline's `flags' field. */ 1.368 + /* */ 1.369 + /* It shouldn't be used by a normal client application, unless it */ 1.370 + /* knows what it is doing. */ 1.371 + /* */ 1.372 + FT_EXPORT( void ) 1.373 + FT_Outline_Reverse( FT_Outline* outline ); 1.374 + 1.375 + 1.376 + /*************************************************************************/ 1.377 + /* */ 1.378 + /* <Function> */ 1.379 + /* FT_Outline_Get_Bitmap */ 1.380 + /* */ 1.381 + /* <Description> */ 1.382 + /* Render an outline within a bitmap. The outline's image is simply */ 1.383 + /* OR-ed to the target bitmap. */ 1.384 + /* */ 1.385 + /* <Input> */ 1.386 + /* library :: A handle to a FreeType library object. */ 1.387 + /* */ 1.388 + /* outline :: A pointer to the source outline descriptor. */ 1.389 + /* */ 1.390 + /* <InOut> */ 1.391 + /* abitmap :: A pointer to the target bitmap descriptor. */ 1.392 + /* */ 1.393 + /* <Return> */ 1.394 + /* FreeType error code. 0~means success. */ 1.395 + /* */ 1.396 + /* <Note> */ 1.397 + /* This function does NOT CREATE the bitmap, it only renders an */ 1.398 + /* outline image within the one you pass to it! Consequently, the */ 1.399 + /* various fields in `abitmap' should be set accordingly. */ 1.400 + /* */ 1.401 + /* It will use the raster corresponding to the default glyph format. */ 1.402 + /* */ 1.403 + /* The value of the `num_grays' field in `abitmap' is ignored. If */ 1.404 + /* you select the gray-level rasterizer, and you want less than 256 */ 1.405 + /* gray levels, you have to use @FT_Outline_Render directly. */ 1.406 + /* */ 1.407 + FT_EXPORT( FT_Error ) 1.408 + FT_Outline_Get_Bitmap( FT_Library library, 1.409 + FT_Outline* outline, 1.410 + const FT_Bitmap *abitmap ); 1.411 + 1.412 + 1.413 + /*************************************************************************/ 1.414 + /* */ 1.415 + /* <Function> */ 1.416 + /* FT_Outline_Render */ 1.417 + /* */ 1.418 + /* <Description> */ 1.419 + /* Render an outline within a bitmap using the current scan-convert. */ 1.420 + /* This function uses an @FT_Raster_Params structure as an argument, */ 1.421 + /* allowing advanced features like direct composition, translucency, */ 1.422 + /* etc. */ 1.423 + /* */ 1.424 + /* <Input> */ 1.425 + /* library :: A handle to a FreeType library object. */ 1.426 + /* */ 1.427 + /* outline :: A pointer to the source outline descriptor. */ 1.428 + /* */ 1.429 + /* <InOut> */ 1.430 + /* params :: A pointer to an @FT_Raster_Params structure used to */ 1.431 + /* describe the rendering operation. */ 1.432 + /* */ 1.433 + /* <Return> */ 1.434 + /* FreeType error code. 0~means success. */ 1.435 + /* */ 1.436 + /* <Note> */ 1.437 + /* You should know what you are doing and how @FT_Raster_Params works */ 1.438 + /* to use this function. */ 1.439 + /* */ 1.440 + /* The field `params.source' will be set to `outline' before the scan */ 1.441 + /* converter is called, which means that the value you give to it is */ 1.442 + /* actually ignored. */ 1.443 + /* */ 1.444 + /* The gray-level rasterizer always uses 256 gray levels. If you */ 1.445 + /* want less gray levels, you have to provide your own span callback. */ 1.446 + /* See the @FT_RASTER_FLAG_DIRECT value of the `flags' field in the */ 1.447 + /* @FT_Raster_Params structure for more details. */ 1.448 + /* */ 1.449 + FT_EXPORT( FT_Error ) 1.450 + FT_Outline_Render( FT_Library library, 1.451 + FT_Outline* outline, 1.452 + FT_Raster_Params* params ); 1.453 + 1.454 + 1.455 + /************************************************************************** 1.456 + * 1.457 + * @enum: 1.458 + * FT_Orientation 1.459 + * 1.460 + * @description: 1.461 + * A list of values used to describe an outline's contour orientation. 1.462 + * 1.463 + * The TrueType and PostScript specifications use different conventions 1.464 + * to determine whether outline contours should be filled or unfilled. 1.465 + * 1.466 + * @values: 1.467 + * FT_ORIENTATION_TRUETYPE :: 1.468 + * According to the TrueType specification, clockwise contours must 1.469 + * be filled, and counter-clockwise ones must be unfilled. 1.470 + * 1.471 + * FT_ORIENTATION_POSTSCRIPT :: 1.472 + * According to the PostScript specification, counter-clockwise contours 1.473 + * must be filled, and clockwise ones must be unfilled. 1.474 + * 1.475 + * FT_ORIENTATION_FILL_RIGHT :: 1.476 + * This is identical to @FT_ORIENTATION_TRUETYPE, but is used to 1.477 + * remember that in TrueType, everything that is to the right of 1.478 + * the drawing direction of a contour must be filled. 1.479 + * 1.480 + * FT_ORIENTATION_FILL_LEFT :: 1.481 + * This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to 1.482 + * remember that in PostScript, everything that is to the left of 1.483 + * the drawing direction of a contour must be filled. 1.484 + * 1.485 + * FT_ORIENTATION_NONE :: 1.486 + * The orientation cannot be determined. That is, different parts of 1.487 + * the glyph have different orientation. 1.488 + * 1.489 + */ 1.490 + typedef enum FT_Orientation_ 1.491 + { 1.492 + FT_ORIENTATION_TRUETYPE = 0, 1.493 + FT_ORIENTATION_POSTSCRIPT = 1, 1.494 + FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE, 1.495 + FT_ORIENTATION_FILL_LEFT = FT_ORIENTATION_POSTSCRIPT, 1.496 + FT_ORIENTATION_NONE 1.497 + 1.498 + } FT_Orientation; 1.499 + 1.500 + 1.501 + /************************************************************************** 1.502 + * 1.503 + * @function: 1.504 + * FT_Outline_Get_Orientation 1.505 + * 1.506 + * @description: 1.507 + * This function analyzes a glyph outline and tries to compute its 1.508 + * fill orientation (see @FT_Orientation). This is done by computing 1.509 + * the direction of each global horizontal and/or vertical extrema 1.510 + * within the outline. 1.511 + * 1.512 + * Note that this will return @FT_ORIENTATION_TRUETYPE for empty 1.513 + * outlines. 1.514 + * 1.515 + * @input: 1.516 + * outline :: 1.517 + * A handle to the source outline. 1.518 + * 1.519 + * @return: 1.520 + * The orientation. 1.521 + * 1.522 + */ 1.523 + FT_EXPORT( FT_Orientation ) 1.524 + FT_Outline_Get_Orientation( FT_Outline* outline ); 1.525 + 1.526 + 1.527 + /* */ 1.528 + 1.529 + 1.530 +FT_END_HEADER 1.531 + 1.532 +#endif /* __FTOUTLN_H__ */ 1.533 + 1.534 + 1.535 +/* END */ 1.536 + 1.537 + 1.538 +/* Local Variables: */ 1.539 +/* coding: utf-8 */ 1.540 +/* End: */