OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* ftoutln.h */ | 3 /* ftoutln.h */ |
4 /* */ | 4 /* */ |
5 /* Support for the FT_Outline type used to store glyph shapes of */ | 5 /* Support for the FT_Outline type used to store glyph shapes of */ |
6 /* most scalable font formats (specification). */ | 6 /* most scalable font formats (specification). */ |
7 /* */ | 7 /* */ |
8 /* Copyright 1996-2003, 2005-2012 by */ | 8 /* Copyright 1996-2003, 2005-2014 by */ |
9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
10 /* */ | 10 /* */ |
11 /* This file is part of the FreeType project, and may only be used, */ | 11 /* This file is part of the FreeType project, and may only be used, */ |
12 /* modified, and distributed under the terms of the FreeType project */ | 12 /* modified, and distributed under the terms of the FreeType project */ |
13 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 13 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
14 /* this file you indicate that you have read the license and */ | 14 /* this file you indicate that you have read the license and */ |
15 /* understand and accept it fully. */ | 15 /* understand and accept it fully. */ |
16 /* */ | 16 /* */ |
17 /***************************************************************************/ | 17 /***************************************************************************/ |
18 | 18 |
19 | 19 |
20 #ifndef __FTOUTLN_H__ | 20 #ifndef __FTOUTLN_H__ |
21 #define __FTOUTLN_H__ | 21 #define __FTOUTLN_H__ |
22 | 22 |
23 | 23 |
24 #include "../ft2build.h" | 24 #include <ft2build.h> |
25 #include "freetype.h" | 25 #include FT_FREETYPE_H |
26 | 26 |
27 #ifdef FREETYPE_H | 27 #ifdef FREETYPE_H |
28 #error "freetype.h of FreeType 1 has been loaded!" | 28 #error "freetype.h of FreeType 1 has been loaded!" |
29 #error "Please fix the directory search order for header files" | 29 #error "Please fix the directory search order for header files" |
30 #error "so that freetype.h of FreeType 2 is found first." | 30 #error "so that freetype.h of FreeType 2 is found first." |
31 #endif | 31 #endif |
32 | 32 |
33 | 33 |
34 FT_BEGIN_HEADER | 34 FT_BEGIN_HEADER |
35 | 35 |
36 | 36 |
37 /*************************************************************************/ | 37 /*************************************************************************/ |
38 /* */ | 38 /* */ |
39 /* <Section> */ | 39 /* <Section> */ |
40 /* outline_processing */ | 40 /* outline_processing */ |
41 /* */ | 41 /* */ |
42 /* <Title> */ | 42 /* <Title> */ |
43 /* Outline Processing */ | 43 /* Outline Processing */ |
44 /* */ | 44 /* */ |
45 /* <Abstract> */ | 45 /* <Abstract> */ |
46 /* Functions to create, transform, and render vectorial glyph images. */ | 46 /* Functions to create, transform, and render vectorial glyph images. */ |
47 /* */ | 47 /* */ |
48 /* <Description> */ | 48 /* <Description> */ |
49 /* This section contains routines used to create and destroy scalable */ | 49 /* This section contains routines used to create and destroy scalable */ |
50 /* glyph images known as `outlines'. These can also be measured, */ | 50 /* glyph images known as `outlines'. These can also be measured, */ |
51 /* transformed, and converted into bitmaps and pixmaps. */ | 51 /* transformed, and converted into bitmaps and pixmaps. */ |
52 /* */ | 52 /* */ |
53 /* <Order> */ | 53 /* <Order> */ |
54 /* FT_Outline */ | 54 /* FT_Outline */ |
55 /* FT_OUTLINE_FLAGS */ | |
56 /* FT_Outline_New */ | 55 /* FT_Outline_New */ |
57 /* FT_Outline_Done */ | 56 /* FT_Outline_Done */ |
58 /* FT_Outline_Copy */ | 57 /* FT_Outline_Copy */ |
59 /* FT_Outline_Translate */ | 58 /* FT_Outline_Translate */ |
60 /* FT_Outline_Transform */ | 59 /* FT_Outline_Transform */ |
61 /* FT_Outline_Embolden */ | 60 /* FT_Outline_Embolden */ |
62 /* FT_Outline_EmboldenXY */ | 61 /* FT_Outline_EmboldenXY */ |
63 /* FT_Outline_Reverse */ | 62 /* FT_Outline_Reverse */ |
64 /* FT_Outline_Check */ | 63 /* FT_Outline_Check */ |
65 /* */ | 64 /* */ |
66 /* FT_Outline_Get_CBox */ | 65 /* FT_Outline_Get_CBox */ |
67 /* FT_Outline_Get_BBox */ | 66 /* FT_Outline_Get_BBox */ |
68 /* */ | 67 /* */ |
69 /* FT_Outline_Get_Bitmap */ | 68 /* FT_Outline_Get_Bitmap */ |
70 /* FT_Outline_Render */ | 69 /* FT_Outline_Render */ |
71 /* */ | |
72 /* FT_Outline_Decompose */ | 70 /* FT_Outline_Decompose */ |
73 /* FT_Outline_Funcs */ | 71 /* FT_Outline_Funcs */ |
74 /* FT_Outline_MoveTo_Func */ | 72 /* FT_Outline_MoveToFunc */ |
75 /* FT_Outline_LineTo_Func */ | 73 /* FT_Outline_LineToFunc */ |
76 /* FT_Outline_ConicTo_Func */ | 74 /* FT_Outline_ConicToFunc */ |
77 /* FT_Outline_CubicTo_Func */ | 75 /* FT_Outline_CubicToFunc */ |
| 76 /* */ |
| 77 /* FT_Orientation */ |
| 78 /* FT_Outline_Get_Orientation */ |
| 79 /* */ |
| 80 /* FT_OUTLINE_XXX */ |
78 /* */ | 81 /* */ |
79 /*************************************************************************/ | 82 /*************************************************************************/ |
80 | 83 |
81 | 84 |
82 /*************************************************************************/ | 85 /*************************************************************************/ |
83 /* */ | 86 /* */ |
84 /* <Function> */ | 87 /* <Function> */ |
85 /* FT_Outline_Decompose */ | 88 /* FT_Outline_Decompose */ |
86 /* */ | 89 /* */ |
87 /* <Description> */ | 90 /* <Description> */ |
88 /* Walk over an outline's structure to decompose it into individual */ | 91 /* Walk over an outline's structure to decompose it into individual */ |
89 /* segments and Bézier arcs. This function also emits `move to' */ | 92 /* segments and Bézier arcs. This function also emits `move to' */ |
90 /* operations to indicate the start of new contours in the outline. */ | 93 /* operations to indicate the start of new contours in the outline. */ |
91 /* */ | 94 /* */ |
92 /* <Input> */ | 95 /* <Input> */ |
93 /* outline :: A pointer to the source target. */ | 96 /* outline :: A pointer to the source target. */ |
94 /* */ | 97 /* */ |
95 /* func_interface :: A table of `emitters', i.e., function pointers */ | 98 /* func_interface :: A table of `emitters', i.e., function pointers */ |
96 /* called during decomposition to indicate path */ | 99 /* called during decomposition to indicate path */ |
97 /* operations. */ | 100 /* operations. */ |
98 /* */ | 101 /* */ |
99 /* <InOut> */ | 102 /* <InOut> */ |
100 /* user :: A typeless pointer which is passed to each */ | 103 /* user :: A typeless pointer that is passed to each */ |
101 /* emitter during the decomposition. It can be */ | 104 /* emitter during the decomposition. It can be */ |
102 /* used to store the state during the */ | 105 /* used to store the state during the */ |
103 /* decomposition. */ | 106 /* decomposition. */ |
104 /* */ | 107 /* */ |
105 /* <Return> */ | 108 /* <Return> */ |
106 /* FreeType error code. 0~means success. */ | 109 /* FreeType error code. 0~means success. */ |
107 /* */ | 110 /* */ |
| 111 /* <Note> */ |
| 112 /* A contour that contains a single point only is represented by a */ |
| 113 /* `move to' operation followed by `line to' to the same point. In */ |
| 114 /* most cases, it is best to filter this out before using the */ |
| 115 /* outline for stroking purposes (otherwise it would result in a */ |
| 116 /* visible dot when round caps are used). */ |
| 117 /* */ |
108 FT_EXPORT( FT_Error ) | 118 FT_EXPORT( FT_Error ) |
109 FT_Outline_Decompose( FT_Outline* outline, | 119 FT_Outline_Decompose( FT_Outline* outline, |
110 const FT_Outline_Funcs* func_interface, | 120 const FT_Outline_Funcs* func_interface, |
111 void* user ); | 121 void* user ); |
112 | 122 |
113 | 123 |
114 /*************************************************************************/ | 124 /*************************************************************************/ |
115 /* */ | 125 /* */ |
116 /* <Function> */ | 126 /* <Function> */ |
117 /* FT_Outline_New */ | 127 /* FT_Outline_New */ |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 /*************************************************************************/ | 220 /*************************************************************************/ |
211 /* */ | 221 /* */ |
212 /* <Function> */ | 222 /* <Function> */ |
213 /* FT_Outline_Get_CBox */ | 223 /* FT_Outline_Get_CBox */ |
214 /* */ | 224 /* */ |
215 /* <Description> */ | 225 /* <Description> */ |
216 /* Return an outline's `control box'. The control box encloses all */ | 226 /* Return an outline's `control box'. The control box encloses all */ |
217 /* the outline's points, including Bézier control points. Though it */ | 227 /* the outline's points, including Bézier control points. Though it */ |
218 /* coincides with the exact bounding box for most glyphs, it can be */ | 228 /* coincides with the exact bounding box for most glyphs, it can be */ |
219 /* slightly larger in some situations (like when rotating an outline */ | 229 /* slightly larger in some situations (like when rotating an outline */ |
220 /* which contains Bézier outside arcs). */ | 230 /* that contains Bézier outside arcs). */ |
221 /* */ | 231 /* */ |
222 /* Computing the control box is very fast, while getting the bounding */ | 232 /* Computing the control box is very fast, while getting the bounding */ |
223 /* box can take much more time as it needs to walk over all segments */ | 233 /* box can take much more time as it needs to walk over all segments */ |
224 /* and arcs in the outline. To get the latter, you can use the */ | 234 /* and arcs in the outline. To get the latter, you can use the */ |
225 /* `ftbbox' component which is dedicated to this single task. */ | 235 /* `ftbbox' component, which is dedicated to this single task. */ |
226 /* */ | 236 /* */ |
227 /* <Input> */ | 237 /* <Input> */ |
228 /* outline :: A pointer to the source outline descriptor. */ | 238 /* outline :: A pointer to the source outline descriptor. */ |
229 /* */ | 239 /* */ |
230 /* <Output> */ | 240 /* <Output> */ |
231 /* acbox :: The outline's control box. */ | 241 /* acbox :: The outline's control box. */ |
232 /* */ | 242 /* */ |
233 /* <Note> */ | 243 /* <Note> */ |
234 /* See @FT_Glyph_Get_CBox for a discussion of tricky fonts. */ | 244 /* See @FT_Glyph_Get_CBox for a discussion of tricky fonts. */ |
235 /* */ | 245 /* */ |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 /* @FT_Outline_Get_CBox or @FT_Outline_Get_BBox. */ | 351 /* @FT_Outline_Get_CBox or @FT_Outline_Get_BBox. */ |
342 /* */ | 352 /* */ |
343 /* Example call: */ | 353 /* Example call: */ |
344 /* */ | 354 /* */ |
345 /* { */ | 355 /* { */ |
346 /* FT_Load_Glyph( face, index, FT_LOAD_DEFAULT ); */ | 356 /* FT_Load_Glyph( face, index, FT_LOAD_DEFAULT ); */ |
347 /* if ( face->slot->format == FT_GLYPH_FORMAT_OUTLINE ) */ | 357 /* if ( face->slot->format == FT_GLYPH_FORMAT_OUTLINE ) */ |
348 /* FT_Outline_Embolden( &face->slot->outline, strength ); */ | 358 /* FT_Outline_Embolden( &face->slot->outline, strength ); */ |
349 /* } */ | 359 /* } */ |
350 /* */ | 360 /* */ |
| 361 /* To get meaningful results, font scaling values must be set with */ |
| 362 /* functions like @FT_Set_Char_Size before calling FT_Render_Glyph. */ |
| 363 /* */ |
351 FT_EXPORT( FT_Error ) | 364 FT_EXPORT( FT_Error ) |
352 FT_Outline_Embolden( FT_Outline* outline, | 365 FT_Outline_Embolden( FT_Outline* outline, |
353 FT_Pos strength ); | 366 FT_Pos strength ); |
354 | 367 |
355 | 368 |
356 /*************************************************************************/ | 369 /*************************************************************************/ |
357 /* */ | 370 /* */ |
358 /* <Function> */ | 371 /* <Function> */ |
359 /* FT_Outline_EmboldenXY */ | 372 /* FT_Outline_EmboldenXY */ |
360 /* */ | 373 /* */ |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 } FT_Orientation; | 531 } FT_Orientation; |
519 | 532 |
520 | 533 |
521 /************************************************************************** | 534 /************************************************************************** |
522 * | 535 * |
523 * @function: | 536 * @function: |
524 * FT_Outline_Get_Orientation | 537 * FT_Outline_Get_Orientation |
525 * | 538 * |
526 * @description: | 539 * @description: |
527 * This function analyzes a glyph outline and tries to compute its | 540 * This function analyzes a glyph outline and tries to compute its |
528 * fill orientation (see @FT_Orientation). This is done by computing | 541 * fill orientation (see @FT_Orientation). This is done by integrating |
529 * the direction of each global horizontal and/or vertical extrema | 542 * the total area covered by the outline. The positive integral |
530 * within the outline. | 543 * corresponds to the clockwise orientation and @FT_ORIENTATION_POSTSCRIPT |
| 544 * is returned. The negative integral corresponds to the counter-clockwise |
| 545 * orientation and @FT_ORIENTATION_TRUETYPE is returned. |
531 * | 546 * |
532 * Note that this will return @FT_ORIENTATION_TRUETYPE for empty | 547 * Note that this will return @FT_ORIENTATION_TRUETYPE for empty |
533 * outlines. | 548 * outlines. |
534 * | 549 * |
535 * @input: | 550 * @input: |
536 * outline :: | 551 * outline :: |
537 * A handle to the source outline. | 552 * A handle to the source outline. |
538 * | 553 * |
539 * @return: | 554 * @return: |
540 * The orientation. | 555 * The orientation. |
541 * | 556 * |
542 */ | 557 */ |
543 FT_EXPORT( FT_Orientation ) | 558 FT_EXPORT( FT_Orientation ) |
544 FT_Outline_Get_Orientation( FT_Outline* outline ); | 559 FT_Outline_Get_Orientation( FT_Outline* outline ); |
545 | 560 |
546 | |
547 /* */ | 561 /* */ |
548 | 562 |
549 | 563 |
550 FT_END_HEADER | 564 FT_END_HEADER |
551 | 565 |
552 #endif /* __FTOUTLN_H__ */ | 566 #endif /* __FTOUTLN_H__ */ |
553 | 567 |
554 | 568 |
555 /* END */ | 569 /* END */ |
556 | 570 |
557 | 571 |
558 /* Local Variables: */ | 572 /* Local Variables: */ |
559 /* coding: utf-8 */ | 573 /* coding: utf-8 */ |
560 /* End: */ | 574 /* End: */ |
OLD | NEW |