Graphiteng
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Font.h
Go to the documentation of this file.
1 /* GRAPHITE2 LICENSING
2 
3  Copyright 2010, SIL International
4  All rights reserved.
5 
6  This library is free software; you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published
8  by the Free Software Foundation; either version 2.1 of License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should also have received a copy of the GNU Lesser General Public
17  License along with this library in the file named "LICENSE".
18  If not, write to the Free Software Foundation, 51 Franklin Street,
19  Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
20  internet at http://www.fsf.org/licenses/lgpl.html.
21 
22  Alternatively, the contents of this file may be used under the terms
23  of the Mozilla Public License (http://mozilla.org/MPL) or the GNU
24  General Public License, as published by the Free Software Foundation,
25  either version 2 of the License or (at your option) any later version.
26 */
27 #pragma once
28 
29 #include "graphite2/Types.h"
30 
31 #define GR2_VERSION_MAJOR 1
32 #define GR2_VERSION_MINOR 3
33 #define GR2_VERSION_BUGFIX 5
34 
35 #ifdef __cplusplus
36 extern "C"
37 {
38 #endif
39 
40 typedef struct gr_face gr_face;
41 typedef struct gr_font gr_font;
44 
48 GR2_API void gr_engine_version(int *nMajor, int *nMinor, int *nBugFix);
49 
67 };
68 
70 struct gr_faceinfo {
83  unsigned int has_bidi_pass : 1;
84  unsigned int line_ends : 1;
85  unsigned int justifies : 1;
86 };
87 
88 typedef struct gr_faceinfo gr_faceinfo;
89 
98 typedef const void *(*gr_get_table_fn)(const void* appFaceHandle, unsigned int name, size_t *len);
99 
105 typedef void (*gr_release_table_fn)(const void* appFaceHandle, const void *table_buffer);
106 
109 {
111  size_t size;
117 };
118 typedef struct gr_face_ops gr_face_ops;
119 
131 GR2_API gr_face* gr_make_face_with_ops(const void* appFaceHandle/*non-NULL*/, const gr_face_ops *face_ops, unsigned int faceOptions);
132 
143 GR2_API gr_face* gr_make_face(const void* appFaceHandle/*non-NULL*/, gr_get_table_fn getTable, unsigned int faceOptions);
144 
145 //#ifndef GRAPHITE2_NSEGCACHE
156 GR2_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);
157 
168 GR2_API gr_face* gr_make_face_with_seg_cache(const void* appFaceHandle, gr_get_table_fn getTable, unsigned int segCacheMaxSize, unsigned int faceOptions);
169 //#endif
170 
176 GR2_API gr_uint32 gr_str_to_tag(const char *str);
177 
184 GR2_API void gr_tag_to_str(gr_uint32 tag, char *str);
185 
197 
205 GR2_API const gr_feature_ref* gr_face_find_fref(const gr_face* pFace, gr_uint32 featId);
206 
209 
211 GR2_API const gr_feature_ref* gr_face_fref(const gr_face* pFace, gr_uint16 i);
212 
214 GR2_API unsigned short gr_face_n_languages(const gr_face* pFace);
215 
218 
220 GR2_API void gr_face_destroy(gr_face *face);
221 
223 GR2_API unsigned short gr_face_n_glyphs(const gr_face* pFace);
224 
226 GR2_API const gr_faceinfo *gr_face_info(const gr_face *pFace, gr_uint32 script);
227 
235 GR2_API int gr_face_is_char_supported(const gr_face *pFace, gr_uint32 usv, gr_uint32 script);
236 
237 #ifndef GRAPHITE2_NFILEFACE
238 
244 GR2_API gr_face* gr_make_file_face(const char *filename, unsigned int faceOptions);
245 
246 //#ifndef GRAPHITE2_NSEGCACHE
254 GR2_API gr_face* gr_make_file_face_with_seg_cache(const char *filename, unsigned int segCacheMaxSize, unsigned int faceOptions);
255 //#endif
256 #endif // !GRAPHITE2_NFILEFACE
257 
264 GR2_API gr_font* gr_make_font(float ppm, const gr_face *face);
265 
271 typedef float (*gr_advance_fn)(const void* appFontHandle, gr_uint16 glyphid);
272 
276 {
278  size_t size;
289 };
290 typedef struct gr_font_ops gr_font_ops;
291 
303 GR2_API gr_font* gr_make_font_with_ops(float ppm, const void* appFontHandle, const gr_font_ops * font_ops, const gr_face *face);
304 
316 GR2_API gr_font* gr_make_font_with_advance_fn(float ppm, const void* appFontHandle, gr_advance_fn getAdvance, const gr_face *face);
317 
319 GR2_API void gr_font_destroy(gr_font *font);
320 
327 GR2_API gr_uint16 gr_fref_feature_value(const gr_feature_ref* pfeatureref, const gr_feature_val* feats);
328 
336 GR2_API int gr_fref_set_feature_value(const gr_feature_ref* pfeatureref, gr_uint16 val, gr_feature_val* pDest);
337 
339 GR2_API gr_uint32 gr_fref_id(const gr_feature_ref* pfeatureref);
340 
343 
350 GR2_API gr_int16 gr_fref_value(const gr_feature_ref* pfeatureref, gr_uint16 settingno);
351 
361 GR2_API void* gr_fref_label(const gr_feature_ref* pfeatureref, gr_uint16 *langId, enum gr_encform utf, gr_uint32 *length);
362 
374 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);
375 
377 GR2_API void gr_label_destroy(void * label);
378 
381 
384 
385 #ifdef __cplusplus
386 }
387 #endif
388