Graphiteng
Font.h
Go to the documentation of this file.
00001 /*  GRAPHITE2 LICENSING
00002 
00003     Copyright 2010, SIL International
00004     All rights reserved.
00005 
00006     This library is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU Lesser General Public License as published
00008     by the Free Software Foundation; either version 2.1 of License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Lesser General Public License for more details.
00015 
00016     You should also have received a copy of the GNU Lesser General Public
00017     License along with this library in the file named "LICENSE".
00018     If not, write to the Free Software Foundation, 51 Franklin Street,
00019     Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
00020     internet at http://www.fsf.org/licenses/lgpl.html.
00021 
00022     Alternatively, the contents of this file may be used under the terms
00023     of the Mozilla Public License (http://mozilla.org/MPL) or the GNU
00024     General Public License, as published by the Free Software Foundation,
00025     either version 2 of the License or (at your option) any later version.
00026 */
00027 #pragma once
00028 
00029 #include "graphite2/Types.h"
00030 
00031 #define GR2_VERSION_MAJOR   1
00032 #define GR2_VERSION_MINOR   0
00033 #define GR2_VERSION_BUGFIX  1
00034 
00035 #ifdef __cplusplus
00036 extern "C"
00037 {
00038 #endif
00039 
00040 typedef struct gr_face          gr_face;
00041 typedef struct gr_font          gr_font;
00042 typedef struct gr_feature_ref   gr_feature_ref;
00043 typedef struct gr_feature_val   gr_feature_val;
00044 
00048 GR2_API void gr_engine_version(int *nMajor, int *nMinor, int *nBugFix);
00049 
00056 enum gr_face_options {
00058     gr_face_default = 0,
00060     gr_face_dumbRendering = 1,
00062     gr_face_preloadGlyphs = 2,
00064     gr_face_cacheCmap = 4,
00066     gr_face_preloadAll = 6
00067 };
00068 
00077 typedef const void *(*gr_get_table_fn)(const void* appFaceHandle, unsigned int name, size_t *len);
00078 
00088 GR2_API gr_face* gr_make_face(const void* appFaceHandle/*non-NULL*/, gr_get_table_fn getTable, unsigned int faceOptions);
00089 
00090 #ifndef DISABLE_SEGCACHE
00091 
00100 GR2_API gr_face* gr_make_face_with_seg_cache(const void* appFaceHandle, gr_get_table_fn getTable, unsigned int segCacheMaxSize, unsigned int faceOptions);
00101 #endif
00102 
00108 GR2_API gr_uint32 gr_str_to_tag(const char *str);
00109 
00116 GR2_API void gr_tag_to_str(gr_uint32 tag, char *str);
00117 
00128 GR2_API gr_feature_val* gr_face_featureval_for_lang(const gr_face* pFace, gr_uint32 langname);
00129 
00137 GR2_API const gr_feature_ref* gr_face_find_fref(const gr_face* pFace, gr_uint32 featId);
00138 
00140 GR2_API gr_uint16 gr_face_n_fref(const gr_face* pFace);
00141 
00143 GR2_API const gr_feature_ref* gr_face_fref(const gr_face* pFace, gr_uint16 i);
00144 
00146 GR2_API unsigned short gr_face_n_languages(const gr_face* pFace);
00147 
00149 GR2_API gr_uint32 gr_face_lang_by_index(const gr_face* pFace, gr_uint16 i);
00150 
00152 GR2_API void gr_face_destroy(gr_face *face);
00153 
00155 GR2_API unsigned short gr_face_n_glyphs(const gr_face* pFace);
00156 
00157 #ifndef DISABLE_FILE_FACE
00158 
00164 GR2_API gr_face* gr_make_file_face(const char *filename, unsigned int faceOptions);
00165 
00166 #ifndef DISABLE_SEGCACHE
00167 
00174 GR2_API gr_face* gr_make_file_face_with_seg_cache(const char *filename, unsigned int segCacheMaxSize, unsigned int faceOptions);
00175 #endif
00176 #endif      // !DISABLE_FILE_FACE
00177 
00184 GR2_API gr_font* gr_make_font(float ppm, const gr_face *face);
00185 
00187 typedef float (*gr_advance_fn)(const void* appFontHandle, gr_uint16 glyphid);
00188 
00197 GR2_API gr_font* gr_make_font_with_advance_fn(float ppm, const void* appFontHandle, gr_advance_fn advance, const gr_face *face);
00198 
00200 GR2_API void gr_font_destroy(gr_font *font);
00201 
00208 GR2_API gr_uint16 gr_fref_feature_value(const gr_feature_ref* pfeatureref, const gr_feature_val* feats);
00209 
00217 GR2_API int gr_fref_set_feature_value(const gr_feature_ref* pfeatureref, gr_uint16 val, gr_feature_val* pDest);
00218 
00220 GR2_API gr_uint32 gr_fref_id(const gr_feature_ref* pfeatureref);
00221 
00223 GR2_API gr_uint16 gr_fref_n_values(const gr_feature_ref* pfeatureref);
00224 
00231 GR2_API gr_int16 gr_fref_value(const gr_feature_ref* pfeatureref, gr_uint16 settingno);   
00232 
00242 GR2_API void* gr_fref_label(const gr_feature_ref* pfeatureref, gr_uint16 *langId, enum gr_encform utf, gr_uint32 *length);
00243 
00255 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);
00256 
00258 GR2_API void gr_label_destroy(void * label);
00259 
00261 GR2_API gr_feature_val* gr_featureval_clone(const gr_feature_val* pfeatures);
00262 
00264 GR2_API void gr_featureval_destroy(gr_feature_val *pfeatures);
00265 
00266 #ifdef __cplusplus
00267 }
00268 #endif
00269 
 All Files Functions Typedefs Enumerations Enumerator Defines