Graphiteng
|
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 #include "graphite2/Font.h" 00031 00032 #ifdef __cplusplus 00033 extern "C" 00034 { 00035 #endif 00036 00037 enum gr_break_weight { 00038 gr_breakNone = 0, 00039 /* after break weights */ 00040 gr_breakWhitespace = 10, 00041 gr_breakWord = 15, 00042 gr_breakIntra = 20, 00043 gr_breakLetter = 30, 00044 gr_breakClip = 40, 00045 /* before break weights */ 00046 gr_breakBeforeWhitespace = -10, 00047 gr_breakBeforeWord = -15, 00048 gr_breakBeforeIntra = -20, 00049 gr_breakBeforeLetter = -30, 00050 gr_breakBeforeClip = -40 00051 }; 00052 00053 enum gr_justFlags { 00055 gr_justStartInline = 1, 00057 gr_justEndInline = 2 00058 }; 00059 00061 enum gr_attrCode { 00063 gr_slatAdvX = 0, 00065 gr_slatAdvY, 00067 gr_slatAttTo, 00069 gr_slatAttX, 00071 gr_slatAttY, 00073 gr_slatAttGpt, 00075 gr_slatAttXOff, 00077 gr_slatAttYOff, 00079 gr_slatAttWithX, 00081 gr_slatAttWithY, 00083 gr_slatWithGpt, 00085 gr_slatAttWithXOff, 00087 gr_slatAttWithYOff, 00089 gr_slatAttLevel, 00091 gr_slatBreak, 00093 gr_slatCompRef, 00095 gr_slatDir, 00097 gr_slatInsert, 00099 gr_slatPosX, 00101 gr_slatPosY, 00103 gr_slatShiftX, 00105 gr_slatShiftY, 00107 gr_slatUserDefnV1, 00109 gr_slatMeasureSol, 00111 gr_slatMeasureEol, 00113 gr_slatJStretch, 00115 gr_slatJShrink, 00117 gr_slatJStep, 00119 gr_slatJWeight, 00121 gr_slatJWidth, 00123 gr_slatSegSplit = gr_slatJStretch + 29, 00125 gr_slatUserDefn, 00126 00128 gr_slatMax, 00130 gr_slatNoEffect = gr_slatMax + 1 00131 }; 00132 00133 enum gr_bidirtl { 00135 gr_rtl = 1, 00138 gr_nobidi = 2, 00140 gr_nomirror = 4 00141 }; 00142 00143 typedef struct gr_char_info gr_char_info; 00144 typedef struct gr_segment gr_segment; 00145 typedef struct gr_slot gr_slot; 00146 00151 GR2_API unsigned int gr_cinfo_unicode_char(const gr_char_info* p/*not NULL*/); 00152 00159 GR2_API int gr_cinfo_break_weight(const gr_char_info* p/*not NULL*/); 00160 00166 GR2_API int gr_cinfo_after(const gr_char_info* p/*not NULL*/); 00167 00173 GR2_API int gr_cinfo_before(const gr_char_info* p/*not NULL*/); 00174 00180 GR2_API size_t gr_cinfo_base(const gr_char_info* p/*not NULL*/); 00181 00193 GR2_API size_t gr_count_unicode_characters(enum gr_encform enc, const void* buffer_begin, const void* buffer_end, const void** pError); 00194 00220 GR2_API gr_segment* gr_make_seg(const gr_font* font, const gr_face* face, gr_uint32 script, const gr_feature_val* pFeats, enum gr_encform enc, const void* pStart, size_t nChars, int dir); 00221 00226 GR2_API void gr_seg_destroy(gr_segment* p); 00227 00232 GR2_API float gr_seg_advance_X(const gr_segment* pSeg/*not NULL*/); 00233 00235 GR2_API float gr_seg_advance_Y(const gr_segment* pSeg/*not NULL*/); 00236 00238 GR2_API unsigned int gr_seg_n_cinfo(const gr_segment* pSeg/*not NULL*/); 00239 00241 GR2_API const gr_char_info* gr_seg_cinfo(const gr_segment* pSeg/*not NULL*/, unsigned int index/*must be <number_of_CharInfo*/); 00242 00244 GR2_API unsigned int gr_seg_n_slots(const gr_segment* pSeg/*not NULL*/); //one slot per glyph 00245 00251 GR2_API const gr_slot* gr_seg_first_slot(gr_segment* pSeg/*not NULL*/); //may give a base slot or a slot which is attached to another 00252 00257 GR2_API const gr_slot* gr_seg_last_slot(gr_segment* pSeg/*not NULL*/); //may give a base slot or a slot which is attached to another 00258 00275 GR2_API void gr_seg_justify(gr_segment* pSeg/*not NULL*/, gr_slot* pStart/*not NULL*/, const gr_font *pFont, double width, enum gr_justFlags flags, gr_slot* pFirst, gr_slot* pLast); 00276 00282 GR2_API const gr_slot* gr_slot_next_in_segment(const gr_slot* p); 00283 00290 GR2_API const gr_slot* gr_slot_prev_in_segment(const gr_slot* p); 00291 00297 GR2_API const gr_slot* gr_slot_attached_to(const gr_slot* p); 00298 00307 GR2_API const gr_slot* gr_slot_first_attachment(const gr_slot* p); 00308 00318 GR2_API const gr_slot* gr_slot_next_sibling_attachment(const gr_slot* p); 00319 00320 00326 GR2_API unsigned short gr_slot_gid(const gr_slot* p); 00327 00329 GR2_API float gr_slot_origin_X(const gr_slot* p); 00330 00332 GR2_API float gr_slot_origin_Y(const gr_slot* p); 00333 00340 GR2_API float gr_slot_advance_X(const gr_slot* p, const gr_face* face, const gr_font *font); 00341 00346 GR2_API float gr_slot_advance_Y(const gr_slot* p, const gr_face* face, const gr_font *font); 00347 00353 GR2_API int gr_slot_before(const gr_slot* p/*not NULL*/); 00354 00360 GR2_API int gr_slot_after(const gr_slot* p/*not NULL*/); 00361 00367 GR2_API unsigned int gr_slot_index(const gr_slot* p/*not NULL*/); 00368 00374 GR2_API int gr_slot_attr(const gr_slot* p/*not NULL*/, const gr_segment* pSeg/*not NULL*/, enum gr_attrCode index, gr_uint8 subindex); //tbd - do we need to expose this? 00375 00377 GR2_API int gr_slot_can_insert_before(const gr_slot* p); 00378 00384 GR2_API int gr_slot_original(const gr_slot* p/*not NULL*/); 00385 00391 GR2_API void gr_slot_linebreak_before(gr_slot *p/*not NULL*/); 00392 00393 #ifdef __cplusplus 00394 } 00395 #endif