jpayne@69
|
1 /* GRAPHITE2 LICENSING
|
jpayne@69
|
2
|
jpayne@69
|
3 Copyright 2010, SIL International
|
jpayne@69
|
4 All rights reserved.
|
jpayne@69
|
5
|
jpayne@69
|
6 This library is free software; you can redistribute it and/or modify
|
jpayne@69
|
7 it under the terms of the GNU Lesser General Public License as published
|
jpayne@69
|
8 by the Free Software Foundation; either version 2.1 of License, or
|
jpayne@69
|
9 (at your option) any later version.
|
jpayne@69
|
10
|
jpayne@69
|
11 This program is distributed in the hope that it will be useful,
|
jpayne@69
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
jpayne@69
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
jpayne@69
|
14 Lesser General Public License for more details.
|
jpayne@69
|
15
|
jpayne@69
|
16 You should also have received a copy of the GNU Lesser General Public
|
jpayne@69
|
17 License along with this library in the file named "LICENSE".
|
jpayne@69
|
18 If not, write to the Free Software Foundation, 51 Franklin Street,
|
jpayne@69
|
19 Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
|
jpayne@69
|
20 internet at http://www.fsf.org/licenses/lgpl.html.
|
jpayne@69
|
21
|
jpayne@69
|
22 Alternatively, the contents of this file may be used under the terms
|
jpayne@69
|
23 of the Mozilla Public License (http://mozilla.org/MPL) or the GNU
|
jpayne@69
|
24 General Public License, as published by the Free Software Foundation,
|
jpayne@69
|
25 either version 2 of the License or (at your option) any later version.
|
jpayne@69
|
26 */
|
jpayne@69
|
27 #pragma once
|
jpayne@69
|
28
|
jpayne@69
|
29 #include "graphite2/Types.h"
|
jpayne@69
|
30
|
jpayne@69
|
31 #define GR2_VERSION_MAJOR 1
|
jpayne@69
|
32 #define GR2_VERSION_MINOR 3
|
jpayne@69
|
33 #define GR2_VERSION_BUGFIX 13
|
jpayne@69
|
34
|
jpayne@69
|
35 #ifdef __cplusplus
|
jpayne@69
|
36 extern "C"
|
jpayne@69
|
37 {
|
jpayne@69
|
38 #endif
|
jpayne@69
|
39
|
jpayne@69
|
40 typedef struct gr_face gr_face;
|
jpayne@69
|
41 typedef struct gr_font gr_font;
|
jpayne@69
|
42 typedef struct gr_feature_ref gr_feature_ref;
|
jpayne@69
|
43 typedef struct gr_feature_val gr_feature_val;
|
jpayne@69
|
44
|
jpayne@69
|
45 /**
|
jpayne@69
|
46 * Returns version information on this engine
|
jpayne@69
|
47 */
|
jpayne@69
|
48 GR2_API void gr_engine_version(int *nMajor, int *nMinor, int *nBugFix);
|
jpayne@69
|
49
|
jpayne@69
|
50 /**
|
jpayne@69
|
51 * The Face Options allow the application to require that certain tables are
|
jpayne@69
|
52 * read during face construction. This may be of concern if the appFaceHandle
|
jpayne@69
|
53 * used in the gr_get_table_fn may change.
|
jpayne@69
|
54 * The values can be combined
|
jpayne@69
|
55 */
|
jpayne@69
|
56 enum gr_face_options {
|
jpayne@69
|
57 /** No preload, no cmap caching, fail if the graphite tables are invalid */
|
jpayne@69
|
58 gr_face_default = 0,
|
jpayne@69
|
59 /** Dumb rendering will be enabled if the graphite tables are invalid. @deprecated Since 1.311 */
|
jpayne@69
|
60 gr_face_dumbRendering = 1,
|
jpayne@69
|
61 /** preload glyphs at construction time */
|
jpayne@69
|
62 gr_face_preloadGlyphs = 2,
|
jpayne@69
|
63 /** Cache the lookup from code point to glyph ID at construction time */
|
jpayne@69
|
64 gr_face_cacheCmap = 4,
|
jpayne@69
|
65 /** Preload everything */
|
jpayne@69
|
66 gr_face_preloadAll = gr_face_preloadGlyphs | gr_face_cacheCmap
|
jpayne@69
|
67 };
|
jpayne@69
|
68
|
jpayne@69
|
69 /** Holds information about a particular Graphite silf table that has been loaded */
|
jpayne@69
|
70 struct gr_faceinfo {
|
jpayne@69
|
71 gr_uint16 extra_ascent; /**< The extra_ascent in the GDL, in design units */
|
jpayne@69
|
72 gr_uint16 extra_descent; /**< The extra_descent in the GDL, in design units */
|
jpayne@69
|
73 gr_uint16 upem; /**< The design units for the font */
|
jpayne@69
|
74 enum gr_space_contextuals {
|
jpayne@69
|
75 gr_space_unknown = 0, /**< no information is known. */
|
jpayne@69
|
76 gr_space_none = 1, /**< the space character never occurs in any rules. */
|
jpayne@69
|
77 gr_space_left_only = 2, /**< the space character only occurs as the first element in a rule. */
|
jpayne@69
|
78 gr_space_right_only = 3, /**< the space character only occurs as the last element in a rule. */
|
jpayne@69
|
79 gr_space_either_only = 4, /**< the space character only occurs as the only element in a rule. */
|
jpayne@69
|
80 gr_space_both = 5, /**< the space character may occur as the first or last element of a rule. */
|
jpayne@69
|
81 gr_space_cross = 6 /**< the space character occurs in a rule not as a first or last element. */
|
jpayne@69
|
82 } space_contextuals;
|
jpayne@69
|
83 unsigned int has_bidi_pass : 1; /**< the table specifies that a bidirectional pass should run */
|
jpayne@69
|
84 unsigned int line_ends : 1; /**< there are line end contextuals somewhere */
|
jpayne@69
|
85 unsigned int justifies : 1; /**< there are .justify properties set somewhere on some glyphs */
|
jpayne@69
|
86 };
|
jpayne@69
|
87
|
jpayne@69
|
88 typedef struct gr_faceinfo gr_faceinfo;
|
jpayne@69
|
89
|
jpayne@69
|
90 /** type describing function to retrieve font table information
|
jpayne@69
|
91 *
|
jpayne@69
|
92 * @return a pointer to the table in memory. The pointed to memory must exist as
|
jpayne@69
|
93 * long as the gr_face which makes the call.
|
jpayne@69
|
94 * @param appFaceHandle is the unique information passed to gr_make_face()
|
jpayne@69
|
95 * @param name is a 32bit tag to the table name.
|
jpayne@69
|
96 * @param len returned by this function to say how long the table is in memory.
|
jpayne@69
|
97 */
|
jpayne@69
|
98 typedef const void *(*gr_get_table_fn)(const void* appFaceHandle, unsigned int name, size_t *len);
|
jpayne@69
|
99
|
jpayne@69
|
100 /** type describing function to release any resources allocated by the above get_table table function
|
jpayne@69
|
101 *
|
jpayne@69
|
102 * @param appFaceHandle is the unique information passed to gr_make_face()
|
jpayne@69
|
103 * @param pointer to table memory returned by get_table.
|
jpayne@69
|
104 */
|
jpayne@69
|
105 typedef void (*gr_release_table_fn)(const void* appFaceHandle, const void *table_buffer);
|
jpayne@69
|
106
|
jpayne@69
|
107 /** struct housing function pointers to manage font table buffers for the graphite engine. */
|
jpayne@69
|
108 struct gr_face_ops
|
jpayne@69
|
109 {
|
jpayne@69
|
110 /** size in bytes of this structure */
|
jpayne@69
|
111 size_t size;
|
jpayne@69
|
112 /** a pointer to a function to request a table from the client. */
|
jpayne@69
|
113 gr_get_table_fn get_table;
|
jpayne@69
|
114 /** is a pointer to a function to notify the client the a table can be released.
|
jpayne@69
|
115 * This can be NULL to signify that the client does not wish to do any release handling. */
|
jpayne@69
|
116 gr_release_table_fn release_table;
|
jpayne@69
|
117 };
|
jpayne@69
|
118 typedef struct gr_face_ops gr_face_ops;
|
jpayne@69
|
119
|
jpayne@69
|
120 /** Create a gr_face object given application information and a table functions.
|
jpayne@69
|
121 *
|
jpayne@69
|
122 * @return gr_face or NULL if the font fails to load for some reason.
|
jpayne@69
|
123 * @param appFaceHandle This is application specific information that is passed
|
jpayne@69
|
124 * to the getTable function. The appFaceHandle must stay
|
jpayne@69
|
125 * alive as long as the gr_face is alive.
|
jpayne@69
|
126 * @param face_ops Pointer to face specific callback structure for table
|
jpayne@69
|
127 * management. Must stay alive for the duration of the
|
jpayne@69
|
128 * call only.
|
jpayne@69
|
129 * @param faceOptions Bitfield describing various options. See enum gr_face_options for details.
|
jpayne@69
|
130 */
|
jpayne@69
|
131 GR2_API gr_face* gr_make_face_with_ops(const void* appFaceHandle/*non-NULL*/, const gr_face_ops *face_ops, unsigned int faceOptions);
|
jpayne@69
|
132
|
jpayne@69
|
133 /** @deprecated Since v1.2.0 in favour of gr_make_face_with_ops.
|
jpayne@69
|
134 * Create a gr_face object given application information and a getTable function.
|
jpayne@69
|
135 *
|
jpayne@69
|
136 * @return gr_face or NULL if the font fails to load for some reason.
|
jpayne@69
|
137 * @param appFaceHandle This is application specific information that is passed
|
jpayne@69
|
138 * to the getTable function. The appFaceHandle must stay
|
jpayne@69
|
139 * alive as long as the gr_face is alive.
|
jpayne@69
|
140 * @param getTable Callback function to get table data.
|
jpayne@69
|
141 * @param faceOptions Bitfield describing various options. See enum gr_face_options for details.
|
jpayne@69
|
142 */
|
jpayne@69
|
143 GR2_DEPRECATED_API gr_face* gr_make_face(const void* appFaceHandle/*non-NULL*/, gr_get_table_fn getTable, unsigned int faceOptions);
|
jpayne@69
|
144
|
jpayne@69
|
145 /** @deprecated Since 1.3.7 this function is now an alias for gr_make_face_with_ops().
|
jpayne@69
|
146 *
|
jpayne@69
|
147 * Create a gr_face object given application information, with subsegmental caching support
|
jpayne@69
|
148 *
|
jpayne@69
|
149 * @return gr_face or NULL if the font fails to load.
|
jpayne@69
|
150 * @param appFaceHandle is a pointer to application specific information that is passed to getTable.
|
jpayne@69
|
151 * This may not be NULL and must stay alive as long as the gr_face is alive.
|
jpayne@69
|
152 * @param face_ops Pointer to face specific callback structure for table management. Must stay
|
jpayne@69
|
153 * alive for the duration of the call only.
|
jpayne@69
|
154 * @param segCacheMaxSize Unused.
|
jpayne@69
|
155 * @param faceOptions Bitfield of values from enum gr_face_options
|
jpayne@69
|
156 */
|
jpayne@69
|
157 GR2_DEPRECATED_API gr_face* gr_make_face_with_seg_cache_and_ops(const void* appFaceHandle, const gr_face_ops *face_ops, unsigned int segCacheMaxSize, unsigned int faceOptions);
|
jpayne@69
|
158
|
jpayne@69
|
159 /** @deprecated Since 1.3.7 this function is now an alias for gr_make_face().
|
jpayne@69
|
160 *
|
jpayne@69
|
161 * Create a gr_face object given application information, with subsegmental caching support.
|
jpayne@69
|
162 * This function is deprecated as of v1.2.0 in favour of gr_make_face_with_seg_cache_and_ops.
|
jpayne@69
|
163 *
|
jpayne@69
|
164 * @return gr_face or NULL if the font fails to load.
|
jpayne@69
|
165 * @param appFaceHandle is a pointer to application specific information that is passed to getTable.
|
jpayne@69
|
166 * This may not be NULL and must stay alive as long as the gr_face is alive.
|
jpayne@69
|
167 * @param getTable The function graphite calls to access font table data
|
jpayne@69
|
168 * @param segCacheMaxSize How large the segment cache is.
|
jpayne@69
|
169 * @param faceOptions Bitfield of values from enum gr_face_options
|
jpayne@69
|
170 */
|
jpayne@69
|
171 GR2_DEPRECATED_API gr_face* gr_make_face_with_seg_cache(const void* appFaceHandle, gr_get_table_fn getTable, unsigned int segCacheMaxSize, unsigned int faceOptions);
|
jpayne@69
|
172
|
jpayne@69
|
173 /** Convert a tag in a string into a gr_uint32
|
jpayne@69
|
174 *
|
jpayne@69
|
175 * @return gr_uint32 tag, zero padded
|
jpayne@69
|
176 * @param str a nul terminated string of which at most the first 4 characters are read
|
jpayne@69
|
177 */
|
jpayne@69
|
178 GR2_API gr_uint32 gr_str_to_tag(const char *str);
|
jpayne@69
|
179
|
jpayne@69
|
180 /** Convert a gr_uint32 tag into a string
|
jpayne@69
|
181 *
|
jpayne@69
|
182 * @param tag contains the tag to convert
|
jpayne@69
|
183 * @param str is a pointer to a char array of at least size 4 bytes. The first 4 bytes of this array
|
jpayne@69
|
184 * will be overwritten by this function. No nul is appended.
|
jpayne@69
|
185 */
|
jpayne@69
|
186 GR2_API void gr_tag_to_str(gr_uint32 tag, char *str);
|
jpayne@69
|
187
|
jpayne@69
|
188 /** Get feature values for a given language or default
|
jpayne@69
|
189 *
|
jpayne@69
|
190 * @return a copy of the default feature values for a given language. The application must call
|
jpayne@69
|
191 * gr_featureval_destroy() to free this object when done.
|
jpayne@69
|
192 * @param pFace The font face to get feature values from
|
jpayne@69
|
193 * @param langname The language tag to get feature values for. If there is no such language or
|
jpayne@69
|
194 * langname is 0, the default feature values for the font are returned.
|
jpayne@69
|
195 * langname is right 0 padded and assumes lowercase. Thus the en langauge
|
jpayne@69
|
196 * would be 0x656E0000. Langname may also be space padded, thus 0x656E2020.
|
jpayne@69
|
197 */
|
jpayne@69
|
198 GR2_API gr_feature_val* gr_face_featureval_for_lang(const gr_face* pFace, gr_uint32 langname);
|
jpayne@69
|
199
|
jpayne@69
|
200 /** Get feature reference for a given feature id from a face
|
jpayne@69
|
201 *
|
jpayne@69
|
202 * @return a feature reference corresponding to the given id. This data is part of the gr_face and
|
jpayne@69
|
203 * will be freed when the face is destroyed.
|
jpayne@69
|
204 * @param pFace Font face to get information on.
|
jpayne@69
|
205 * @param featId Feature id tag to get reference to.
|
jpayne@69
|
206 */
|
jpayne@69
|
207 GR2_API const gr_feature_ref* gr_face_find_fref(const gr_face* pFace, gr_uint32 featId);
|
jpayne@69
|
208
|
jpayne@69
|
209 /** Returns number of feature references in a face **/
|
jpayne@69
|
210 GR2_API gr_uint16 gr_face_n_fref(const gr_face* pFace);
|
jpayne@69
|
211
|
jpayne@69
|
212 /** Returns feature reference at given index in face **/
|
jpayne@69
|
213 GR2_API const gr_feature_ref* gr_face_fref(const gr_face* pFace, gr_uint16 i);
|
jpayne@69
|
214
|
jpayne@69
|
215 /** Return number of languages the face knows about **/
|
jpayne@69
|
216 GR2_API unsigned short gr_face_n_languages(const gr_face* pFace);
|
jpayne@69
|
217
|
jpayne@69
|
218 /** Returns a language id corresponding to a language of given index in the face **/
|
jpayne@69
|
219 GR2_API gr_uint32 gr_face_lang_by_index(const gr_face* pFace, gr_uint16 i);
|
jpayne@69
|
220
|
jpayne@69
|
221 /** Destroy the given face and free its memory **/
|
jpayne@69
|
222 GR2_API void gr_face_destroy(gr_face *face);
|
jpayne@69
|
223
|
jpayne@69
|
224 /** Returns the number of glyphs in the face **/
|
jpayne@69
|
225 GR2_API unsigned short gr_face_n_glyphs(const gr_face* pFace);
|
jpayne@69
|
226
|
jpayne@69
|
227 /** Returns a faceinfo for the face and script **/
|
jpayne@69
|
228 GR2_API const gr_faceinfo *gr_face_info(const gr_face *pFace, gr_uint32 script);
|
jpayne@69
|
229
|
jpayne@69
|
230 /** Returns whether the font supports a given Unicode character
|
jpayne@69
|
231 *
|
jpayne@69
|
232 * @return true if the character is supported.
|
jpayne@69
|
233 * @param pFace face to test within
|
jpayne@69
|
234 * @param usv Unicode Scalar Value of character to test
|
jpayne@69
|
235 * @param script Tag of script for selecting which set of pseudo glyphs to test. May be NULL.
|
jpayne@69
|
236 */
|
jpayne@69
|
237 GR2_API int gr_face_is_char_supported(const gr_face *pFace, gr_uint32 usv, gr_uint32 script);
|
jpayne@69
|
238
|
jpayne@69
|
239 #ifndef GRAPHITE2_NFILEFACE
|
jpayne@69
|
240 /** Create gr_face from a font file
|
jpayne@69
|
241 *
|
jpayne@69
|
242 * @return gr_face that accesses a font file directly. Returns NULL on failure.
|
jpayne@69
|
243 * @param filename Full path and filename to font file
|
jpayne@69
|
244 * @param faceOptions Bitfile from enum gr_face_options to control face options.
|
jpayne@69
|
245 */
|
jpayne@69
|
246 GR2_API gr_face* gr_make_file_face(const char *filename, unsigned int faceOptions);
|
jpayne@69
|
247
|
jpayne@69
|
248 /** @deprecated Since 1.3.7. This function is now an alias for gr_make_file_face().
|
jpayne@69
|
249 *
|
jpayne@69
|
250 * Create gr_face from a font file, with subsegment caching support.
|
jpayne@69
|
251 *
|
jpayne@69
|
252 * @return gr_face that accesses a font file directly. Returns NULL on failure.
|
jpayne@69
|
253 * @param filename Full path and filename to font file
|
jpayne@69
|
254 * @param segCacheMaxSize Specifies how big to make the cache in segments.
|
jpayne@69
|
255 * @param faceOptions Bitfield from enum gr_face_options to control face options.
|
jpayne@69
|
256 */
|
jpayne@69
|
257 GR2_DEPRECATED_API gr_face* gr_make_file_face_with_seg_cache(const char *filename, unsigned int segCacheMaxSize, unsigned int faceOptions);
|
jpayne@69
|
258 #endif // !GRAPHITE2_NFILEFACE
|
jpayne@69
|
259
|
jpayne@69
|
260 /** Create a font from a face
|
jpayne@69
|
261 *
|
jpayne@69
|
262 * @return gr_font Call font_destroy to free this font
|
jpayne@69
|
263 * @param ppm Resolution of the font in pixels per em
|
jpayne@69
|
264 * @param face Face this font corresponds to. This must stay alive as long as the font is alive.
|
jpayne@69
|
265 */
|
jpayne@69
|
266 GR2_API gr_font* gr_make_font(float ppm, const gr_face *face);
|
jpayne@69
|
267
|
jpayne@69
|
268 /** query function to find the hinted advance of a glyph
|
jpayne@69
|
269 *
|
jpayne@69
|
270 * @param appFontHandle is the unique information passed to gr_make_font_with_advance()
|
jpayne@69
|
271 * @param glyphid is the glyph to retireve the hinted advance for.
|
jpayne@69
|
272 */
|
jpayne@69
|
273 typedef float (*gr_advance_fn)(const void* appFontHandle, gr_uint16 glyphid);
|
jpayne@69
|
274
|
jpayne@69
|
275 /** struct housing function pointers to manage font hinted metrics for the
|
jpayne@69
|
276 * graphite engine. */
|
jpayne@69
|
277 struct gr_font_ops
|
jpayne@69
|
278 {
|
jpayne@69
|
279 /** size of the structure in bytes to allow for future extensibility */
|
jpayne@69
|
280 size_t size;
|
jpayne@69
|
281 /** a pointer to a function to retrieve the hinted
|
jpayne@69
|
282 * advance width of a glyph which the font cannot
|
jpayne@69
|
283 * provide without client assistance. This can be
|
jpayne@69
|
284 * NULL to signify no horizontal hinted metrics are necessary. */
|
jpayne@69
|
285 gr_advance_fn glyph_advance_x;
|
jpayne@69
|
286 /** a pointer to a function to retrieve the hinted
|
jpayne@69
|
287 * advance height of a glyph which the font cannot
|
jpayne@69
|
288 * provide without client assistance. This can be
|
jpayne@69
|
289 * NULL to signify no horizontal hinted metrics are necessary. */
|
jpayne@69
|
290 gr_advance_fn glyph_advance_y;
|
jpayne@69
|
291 };
|
jpayne@69
|
292 typedef struct gr_font_ops gr_font_ops;
|
jpayne@69
|
293
|
jpayne@69
|
294 /** Creates a font with hinted advance width query functions
|
jpayne@69
|
295 *
|
jpayne@69
|
296 * @return gr_font to be destroyed via font_destroy
|
jpayne@69
|
297 * @param ppm size of font in pixels per em
|
jpayne@69
|
298 * @param appFontHandle font specific information that must stay alive as long
|
jpayne@69
|
299 * as the font does
|
jpayne@69
|
300 * @param font_ops pointer font specific callback structure for hinted metrics.
|
jpayne@69
|
301 * Need only stay alive for the duration of the call.
|
jpayne@69
|
302 * @param face the face this font corresponds to. Must stay alive as long as
|
jpayne@69
|
303 * the font does.
|
jpayne@69
|
304 */
|
jpayne@69
|
305 GR2_API gr_font* gr_make_font_with_ops(float ppm, const void* appFontHandle, const gr_font_ops * font_ops, const gr_face *face);
|
jpayne@69
|
306
|
jpayne@69
|
307 /** Creates a font with hinted advance width query function.
|
jpayne@69
|
308 * This function is deprecated. Use gr_make_font_with_ops instead.
|
jpayne@69
|
309 *
|
jpayne@69
|
310 * @return gr_font to be destroyed via font_destroy
|
jpayne@69
|
311 * @param ppm size of font in pixels per em
|
jpayne@69
|
312 * @param appFontHandle font specific information that must stay alive as long
|
jpayne@69
|
313 * as the font does
|
jpayne@69
|
314 * @param getAdvance callback function reference that returns horizontal advance in pixels for a glyph.
|
jpayne@69
|
315 * @param face the face this font corresponds to. Must stay alive as long as
|
jpayne@69
|
316 * the font does.
|
jpayne@69
|
317 */
|
jpayne@69
|
318 GR2_API gr_font* gr_make_font_with_advance_fn(float ppm, const void* appFontHandle, gr_advance_fn getAdvance, const gr_face *face);
|
jpayne@69
|
319
|
jpayne@69
|
320 /** Free a font **/
|
jpayne@69
|
321 GR2_API void gr_font_destroy(gr_font *font);
|
jpayne@69
|
322
|
jpayne@69
|
323 /** get a feature value
|
jpayne@69
|
324 *
|
jpayne@69
|
325 * @return value of specific feature or 0 if any problems.
|
jpayne@69
|
326 * @param pfeatureref gr_feature_ref to the feature
|
jpayne@69
|
327 * @param feats gr_feature_val containing all the values
|
jpayne@69
|
328 */
|
jpayne@69
|
329 GR2_API gr_uint16 gr_fref_feature_value(const gr_feature_ref* pfeatureref, const gr_feature_val* feats);
|
jpayne@69
|
330
|
jpayne@69
|
331 /** set a feature value
|
jpayne@69
|
332 *
|
jpayne@69
|
333 * @return false if there were any problems (value out of range, etc.)
|
jpayne@69
|
334 * @param pfeatureref gr_feature_ref to the feature
|
jpayne@69
|
335 * @param val value to set the feature to
|
jpayne@69
|
336 * @param pDest the gr_feature_val containing all the values for all the features
|
jpayne@69
|
337 */
|
jpayne@69
|
338 GR2_API int gr_fref_set_feature_value(const gr_feature_ref* pfeatureref, gr_uint16 val, gr_feature_val* pDest);
|
jpayne@69
|
339
|
jpayne@69
|
340 /** Returns the id tag for a gr_feature_ref **/
|
jpayne@69
|
341 GR2_API gr_uint32 gr_fref_id(const gr_feature_ref* pfeatureref);
|
jpayne@69
|
342
|
jpayne@69
|
343 /** Returns number of values a feature may take, given a gr_feature_ref **/
|
jpayne@69
|
344 GR2_API gr_uint16 gr_fref_n_values(const gr_feature_ref* pfeatureref);
|
jpayne@69
|
345
|
jpayne@69
|
346 /** Returns the value associated with a particular value in a feature
|
jpayne@69
|
347 *
|
jpayne@69
|
348 * @return value
|
jpayne@69
|
349 * @param pfeatureref gr_feature_ref of the feature of interest
|
jpayne@69
|
350 * @param settingno Index up to the return value of gr_fref_n_values() of the value
|
jpayne@69
|
351 */
|
jpayne@69
|
352 GR2_API gr_int16 gr_fref_value(const gr_feature_ref* pfeatureref, gr_uint16 settingno);
|
jpayne@69
|
353
|
jpayne@69
|
354 /** Returns a string of the UI name of a feature
|
jpayne@69
|
355 *
|
jpayne@69
|
356 * @return string of the UI name, in the encoding form requested. Call gr_label_destroy() after use.
|
jpayne@69
|
357 * @param pfeatureref gr_feature_ref of the feature
|
jpayne@69
|
358 * @param langId This is a pointer since the face may not support a string in the requested
|
jpayne@69
|
359 * language. The actual language of the string is returned in langId
|
jpayne@69
|
360 * @param utf Encoding form for the string
|
jpayne@69
|
361 * @param length Used to return the length of the string returned in bytes.
|
jpayne@69
|
362 */
|
jpayne@69
|
363 GR2_API void* gr_fref_label(const gr_feature_ref* pfeatureref, gr_uint16 *langId, enum gr_encform utf, gr_uint32 *length);
|
jpayne@69
|
364
|
jpayne@69
|
365 /** Return a UI string for a possible value of a feature
|
jpayne@69
|
366 *
|
jpayne@69
|
367 * @return string of the UI name, in the encoding form requested. nul terminated. Call gr_label_destroy()
|
jpayne@69
|
368 * after use.
|
jpayne@69
|
369 * @param pfeatureref gr_feature_ref of the feature
|
jpayne@69
|
370 * @param settingno Value setting index
|
jpayne@69
|
371 * @param langId This is a pointer to the requested language. The requested language id is
|
jpayne@69
|
372 * replaced by the actual language id of the string returned.
|
jpayne@69
|
373 * @param utf Encoding form for the string
|
jpayne@69
|
374 * @param length Returns the length of the string returned in bytes.
|
jpayne@69
|
375 */
|
jpayne@69
|
376 GR2_API void* gr_fref_value_label(const gr_feature_ref* pfeatureref, gr_uint16 settingno/*rather than a value*/, gr_uint16 *langId, enum gr_encform utf, gr_uint32 *length);
|
jpayne@69
|
377
|
jpayne@69
|
378 /** Destroy a previously returned label string **/
|
jpayne@69
|
379 GR2_API void gr_label_destroy(void * label);
|
jpayne@69
|
380
|
jpayne@69
|
381 /** Copies a gr_feature_val **/
|
jpayne@69
|
382 GR2_API gr_feature_val* gr_featureval_clone(const gr_feature_val* pfeatures);
|
jpayne@69
|
383
|
jpayne@69
|
384 /** Destroys a gr_feature_val **/
|
jpayne@69
|
385 GR2_API void gr_featureval_destroy(gr_feature_val *pfeatures);
|
jpayne@69
|
386
|
jpayne@69
|
387 #ifdef __cplusplus
|
jpayne@69
|
388 }
|
jpayne@69
|
389 #endif
|