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_slatUserDefn = gr_slatJStretch + 30, 00124 00126 gr_slatMax, 00128 gr_slatNoEffect = gr_slatMax + 1 00129 }; 00130 00131 enum gr_bidirtl { 00133 gr_rtl = 1, 00136 gr_nobidi = 2, 00138 gr_nomirror = 4 00139 }; 00140 00141 typedef struct gr_char_info gr_char_info; 00142 typedef struct gr_segment gr_segment; 00143 typedef struct gr_slot gr_slot; 00144 00149 GR2_API unsigned int gr_cinfo_unicode_char(const gr_char_info* p/*not NULL*/); 00150 00157 GR2_API int gr_cinfo_break_weight(const gr_char_info* p/*not NULL*/); 00158 00164 GR2_API int gr_cinfo_after(const gr_char_info* p/*not NULL*/); 00165 00171 GR2_API int gr_cinfo_before(const gr_char_info* p/*not NULL*/); 00172 00178 GR2_API size_t gr_cinfo_base(const gr_char_info* p/*not NULL*/); 00179 00191 GR2_API size_t gr_count_unicode_characters(enum gr_encform enc, const void* buffer_begin, const void* buffer_end, const void** pError); 00192 00217 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); 00218 00223 GR2_API void gr_seg_destroy(gr_segment* p); 00224 00229 GR2_API float gr_seg_advance_X(const gr_segment* pSeg/*not NULL*/); 00230 00232 GR2_API float gr_seg_advance_Y(const gr_segment* pSeg/*not NULL*/); 00233 00235 GR2_API unsigned int gr_seg_n_cinfo(const gr_segment* pSeg/*not NULL*/); 00236 00238 GR2_API const gr_char_info* gr_seg_cinfo(const gr_segment* pSeg/*not NULL*/, unsigned int index/*must be <number_of_CharInfo*/); 00239 00241 GR2_API unsigned int gr_seg_n_slots(const gr_segment* pSeg/*not NULL*/); //one slot per glyph 00242 00248 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 00249 00254 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 00255 00272 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); 00273 00279 GR2_API const gr_slot* gr_slot_next_in_segment(const gr_slot* p); 00280 00287 GR2_API const gr_slot* gr_slot_prev_in_segment(const gr_slot* p); 00288 00294 GR2_API const gr_slot* gr_slot_attached_to(const gr_slot* p); 00295 00304 GR2_API const gr_slot* gr_slot_first_attachment(const gr_slot* p); 00305 00315 GR2_API const gr_slot* gr_slot_next_sibling_attachment(const gr_slot* p); 00316 00317 00323 GR2_API unsigned short gr_slot_gid(const gr_slot* p); 00324 00326 GR2_API float gr_slot_origin_X(const gr_slot* p); 00327 00329 GR2_API float gr_slot_origin_Y(const gr_slot* p); 00330 00337 GR2_API float gr_slot_advance_X(const gr_slot* p, const gr_face* face, const gr_font *font); 00338 00343 GR2_API float gr_slot_advance_Y(const gr_slot* p, const gr_face* face, const gr_font *font); 00344 00350 GR2_API int gr_slot_before(const gr_slot* p/*not NULL*/); 00351 00357 GR2_API int gr_slot_after(const gr_slot* p/*not NULL*/); 00358 00364 GR2_API unsigned int gr_slot_index(const gr_slot* p/*not NULL*/); 00365 00371 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? 00372 00374 GR2_API int gr_slot_can_insert_before(const gr_slot* p); 00375 00381 GR2_API int gr_slot_original(const gr_slot* p/*not NULL*/); 00382 00388 GR2_API void gr_slot_linebreak_before(gr_slot *p/*not NULL*/); 00389 00390 #ifdef __cplusplus 00391 } 00392 #endif