1 | /***************************************************************************/ |
---|
2 | /* */ |
---|
3 | /* ftadvanc.h */ |
---|
4 | /* */ |
---|
5 | /* Quick computation of advance widths (specification only). */ |
---|
6 | /* */ |
---|
7 | /* Copyright 2008 by */ |
---|
8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
---|
9 | /* */ |
---|
10 | /* This file is part of the FreeType project, and may only be used, */ |
---|
11 | /* modified, and distributed under the terms of the FreeType project */ |
---|
12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
---|
13 | /* this file you indicate that you have read the license and */ |
---|
14 | /* understand and accept it fully. */ |
---|
15 | /* */ |
---|
16 | /***************************************************************************/ |
---|
17 | |
---|
18 | |
---|
19 | #ifndef __FTADVANC_H__ |
---|
20 | #define __FTADVANC_H__ |
---|
21 | |
---|
22 | |
---|
23 | #include <ft2build.h> |
---|
24 | #include FT_FREETYPE_H |
---|
25 | |
---|
26 | #ifdef FREETYPE_H |
---|
27 | #error "freetype.h of FreeType 1 has been loaded!" |
---|
28 | #error "Please fix the directory search order for header files" |
---|
29 | #error "so that freetype.h of FreeType 2 is found first." |
---|
30 | #endif |
---|
31 | |
---|
32 | |
---|
33 | FT_BEGIN_HEADER |
---|
34 | |
---|
35 | |
---|
36 | /************************************************************************** |
---|
37 | * |
---|
38 | * @section: |
---|
39 | * quick_advance |
---|
40 | * |
---|
41 | * @title: |
---|
42 | * Quick retrieval of advance values |
---|
43 | * |
---|
44 | * @abstract: |
---|
45 | * Retrieve horizontal and vertical advance values without processing |
---|
46 | * glyph outlines, if possible. |
---|
47 | * |
---|
48 | * @description: |
---|
49 | * This section contains functions to quickly extract advance values |
---|
50 | * without handling glyph outlines, if possible. |
---|
51 | */ |
---|
52 | |
---|
53 | |
---|
54 | /*************************************************************************/ |
---|
55 | /* */ |
---|
56 | /* <Const> */ |
---|
57 | /* FT_ADVANCE_FLAG_FAST_ONLY */ |
---|
58 | /* */ |
---|
59 | /* <Description> */ |
---|
60 | /* A bit-flag to be OR-ed with the `flags' parameter of the */ |
---|
61 | /* @FT_Get_Advance and @FT_Get_Advances functions. */ |
---|
62 | /* */ |
---|
63 | /* If set, it indicates that you want these functions to fail if the */ |
---|
64 | /* corresponding hinting mode or font driver doesn't allow for very */ |
---|
65 | /* quick advance computation. */ |
---|
66 | /* */ |
---|
67 | /* Typically, glyphs which are either unscaled, unhinted, bitmapped, */ |
---|
68 | /* or light-hinted can have their advance width computed very */ |
---|
69 | /* quickly. */ |
---|
70 | /* */ |
---|
71 | /* Normal and bytecode hinted modes, which require loading, scaling, */ |
---|
72 | /* and hinting of the glyph outline, are extremely slow by */ |
---|
73 | /* comparison. */ |
---|
74 | /* */ |
---|
75 | #define FT_ADVANCE_FLAG_FAST_ONLY 0x20000000UL |
---|
76 | |
---|
77 | |
---|
78 | /*************************************************************************/ |
---|
79 | /* */ |
---|
80 | /* <Function> */ |
---|
81 | /* FT_Get_Advance */ |
---|
82 | /* */ |
---|
83 | /* <Description> */ |
---|
84 | /* Retrieve the advance value of a given glyph outline in an */ |
---|
85 | /* @FT_Face. By default, the unhinted advance is returned in font */ |
---|
86 | /* units. */ |
---|
87 | /* */ |
---|
88 | /* <Input> */ |
---|
89 | /* face :: The source @FT_Face handle. */ |
---|
90 | /* */ |
---|
91 | /* gindex :: The glyph index. */ |
---|
92 | /* */ |
---|
93 | /* load_flags :: A set of bit flags similar to those used when */ |
---|
94 | /* calling @FT_Load_Glyph, used to determine what kind */ |
---|
95 | /* of advances you need. */ |
---|
96 | /* <Output> */ |
---|
97 | /* padvance :: The advance value, in either font units or 16.16 */ |
---|
98 | /* format. */ |
---|
99 | /* */ |
---|
100 | /* If @FT_LOAD_VERTICAL_LAYOUT is set, this is the */ |
---|
101 | /* vertical advance corresponding to a vertical layout. */ |
---|
102 | /* Otherwise, it is the horizontal advance in a */ |
---|
103 | /* horizontal layout. */ |
---|
104 | /* */ |
---|
105 | /* <Return> */ |
---|
106 | /* FreeType error code. 0 means success. */ |
---|
107 | /* */ |
---|
108 | /* <Note> */ |
---|
109 | /* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */ |
---|
110 | /* if the corresponding font backend doesn't have a quick way to */ |
---|
111 | /* retrieve the advances. */ |
---|
112 | /* */ |
---|
113 | /* A scaled advance is returned in 16.16 format but isn't transformed */ |
---|
114 | /* by the affine transformation specified by @FT_Set_Transform. */ |
---|
115 | /* */ |
---|
116 | FT_EXPORT( FT_Error ) |
---|
117 | FT_Get_Advance( FT_Face face, |
---|
118 | FT_UInt gindex, |
---|
119 | FT_Int32 load_flags, |
---|
120 | FT_Fixed *padvance ); |
---|
121 | |
---|
122 | |
---|
123 | /*************************************************************************/ |
---|
124 | /* */ |
---|
125 | /* <Function> */ |
---|
126 | /* FT_Get_Advances */ |
---|
127 | /* */ |
---|
128 | /* <Description> */ |
---|
129 | /* Retrieve the advance values of several glyph outlines in an */ |
---|
130 | /* @FT_Face. By default, the unhinted advances are returned in font */ |
---|
131 | /* units. */ |
---|
132 | /* */ |
---|
133 | /* <Input> */ |
---|
134 | /* face :: The source @FT_Face handle. */ |
---|
135 | /* */ |
---|
136 | /* start :: The first glyph index. */ |
---|
137 | /* */ |
---|
138 | /* count :: The number of advance values you want to retrieve. */ |
---|
139 | /* */ |
---|
140 | /* load_flags :: A set of bit flags similar to those used when */ |
---|
141 | /* calling @FT_Load_Glyph. */ |
---|
142 | /* */ |
---|
143 | /* <Output> */ |
---|
144 | /* padvance :: The advances, in either font units or 16.16 format. */ |
---|
145 | /* This array must contain at least `count' elements. */ |
---|
146 | /* */ |
---|
147 | /* If @FT_LOAD_VERTICAL_LAYOUT is set, these are the */ |
---|
148 | /* vertical advances corresponding to a vertical layout. */ |
---|
149 | /* Otherwise, they are the horizontal advances in a */ |
---|
150 | /* horizontal layout. */ |
---|
151 | /* */ |
---|
152 | /* <Return> */ |
---|
153 | /* FreeType error code. 0 means success. */ |
---|
154 | /* */ |
---|
155 | /* <Note> */ |
---|
156 | /* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */ |
---|
157 | /* if the corresponding font backend doesn't have a quick way to */ |
---|
158 | /* retrieve the advances. */ |
---|
159 | /* */ |
---|
160 | /* Scaled advances are returned in 16.16 format but aren't */ |
---|
161 | /* transformed by the affine transformation specified by */ |
---|
162 | /* @FT_Set_Transform. */ |
---|
163 | /* */ |
---|
164 | FT_EXPORT( FT_Error ) |
---|
165 | FT_Get_Advances( FT_Face face, |
---|
166 | FT_UInt start, |
---|
167 | FT_UInt count, |
---|
168 | FT_Int32 load_flags, |
---|
169 | FT_Fixed *padvances ); |
---|
170 | |
---|
171 | /* */ |
---|
172 | |
---|
173 | |
---|
174 | FT_END_HEADER |
---|
175 | |
---|
176 | #endif /* __FTADVANC_H__ */ |
---|
177 | |
---|
178 | |
---|
179 | /* END */ |
---|