Graphiteng
 All Files Functions 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 1
33 #define GR2_VERSION_BUGFIX 3
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 
77 typedef const void *(*gr_get_table_fn)(const void* appFaceHandle, unsigned int name, size_t *len);
78 
88 GR2_API gr_face* gr_make_face(const void* appFaceHandle/*non-NULL*/, gr_get_table_fn getTable, unsigned int faceOptions);
89 
90 //#ifndef GRAPHITE2_NSEGCACHE
100 GR2_API gr_face* gr_make_face_with_seg_cache(const void* appFaceHandle, gr_get_table_fn getTable, unsigned int segCacheMaxSize, unsigned int faceOptions);
101 //#endif
102 
108 GR2_API gr_uint32 gr_str_to_tag(const char *str);
109 
116 GR2_API void gr_tag_to_str(gr_uint32 tag, char *str);
117 
129 
137 GR2_API const gr_feature_ref* gr_face_find_fref(const gr_face* pFace, gr_uint32 featId);
138 
141 
143 GR2_API const gr_feature_ref* gr_face_fref(const gr_face* pFace, gr_uint16 i);
144 
146 GR2_API unsigned short gr_face_n_languages(const gr_face* pFace);
147 
150 
152 GR2_API void gr_face_destroy(gr_face *face);
153 
155 GR2_API unsigned short gr_face_n_glyphs(const gr_face* pFace);
156 
157 #ifndef GRAPHITE2_NFILEFACE
158 
164 GR2_API gr_face* gr_make_file_face(const char *filename, unsigned int faceOptions);
165 
166 //#ifndef GRAPHITE2_NSEGCACHE
174 GR2_API gr_face* gr_make_file_face_with_seg_cache(const char *filename, unsigned int segCacheMaxSize, unsigned int faceOptions);
175 //#endif
176 #endif // !GRAPHITE2_NFILEFACE
177 
184 GR2_API gr_font* gr_make_font(float ppm, const gr_face *face);
185 
187 typedef float (*gr_advance_fn)(const void* appFontHandle, gr_uint16 glyphid);
188 
197 GR2_API gr_font* gr_make_font_with_advance_fn(float ppm, const void* appFontHandle, gr_advance_fn advance, const gr_face *face);
198 
200 GR2_API void gr_font_destroy(gr_font *font);
201 
208 GR2_API gr_uint16 gr_fref_feature_value(const gr_feature_ref* pfeatureref, const gr_feature_val* feats);
209 
217 GR2_API int gr_fref_set_feature_value(const gr_feature_ref* pfeatureref, gr_uint16 val, gr_feature_val* pDest);
218 
220 GR2_API gr_uint32 gr_fref_id(const gr_feature_ref* pfeatureref);
221 
224 
231 GR2_API gr_int16 gr_fref_value(const gr_feature_ref* pfeatureref, gr_uint16 settingno);
232 
242 GR2_API void* gr_fref_label(const gr_feature_ref* pfeatureref, gr_uint16 *langId, enum gr_encform utf, gr_uint32 *length);
243 
255 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);
256 
258 GR2_API void gr_label_destroy(void * label);
259 
262 
265 
266 #ifdef __cplusplus
267 }
268 #endif
269