hb-buffer.h revision 2f5931e404cb56e31d24b2eb7ff0a849fb077b55
1a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod/* 2a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * Copyright (C) 1998-2004 David Turner and Werner Lemberg 36c78683c042250a7b5a6fc6ebae4717b03fadf9eBehdad Esfahbod * Copyright (C) 2004,2007,2009 Red Hat, Inc. 49f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod * 5a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * This is part of HarfBuzz, an OpenType Layout engine library. 69f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod * 7a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * Permission is hereby granted, without written agreement and without 8a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * license or royalty fees, to use, copy, modify, and distribute this 9a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * software and its documentation for any purpose, provided that the 10a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * above copyright notice and the following two paragraphs appear in 11a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * all copies of this software. 129f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod * 13a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 14a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 15a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 16a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 17a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * DAMAGE. 18a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * 19a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 20a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 21a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 22a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 23a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 24a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * 25a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * Red Hat Author(s): Owen Taylor, Behdad Esfahbod 269f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod */ 27a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod 285c0adce1ccc739415c4b26ff13ffd2d77ea4bc6cBehdad Esfahbod#ifndef HB_BUFFER_H 295c0adce1ccc739415c4b26ff13ffd2d77ea4bc6cBehdad Esfahbod#define HB_BUFFER_H 309f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod 31b857b49c82782d29d6d189f1a9f4a84d39cd84eaBehdad Esfahbod#include "hb-common.h" 329f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod 33f96ffd43bce0ac6d9c897933c9be0e51d543e570Behdad EsfahbodHB_BEGIN_DECLS 349f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod 3511fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodtypedef struct _hb_buffer_t hb_buffer_t; 3611fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbod 3702a370697d25b986dbf1d5c38f46a89a4833b495Behdad Esfahbodtypedef enum _hb_direction_t { 3802a370697d25b986dbf1d5c38f46a89a4833b495Behdad Esfahbod HB_DIRECTION_LTR, 3902a370697d25b986dbf1d5c38f46a89a4833b495Behdad Esfahbod HB_DIRECTION_RTL, 4002a370697d25b986dbf1d5c38f46a89a4833b495Behdad Esfahbod HB_DIRECTION_TTB, 4102a370697d25b986dbf1d5c38f46a89a4833b495Behdad Esfahbod HB_DIRECTION_BTT 4202a370697d25b986dbf1d5c38f46a89a4833b495Behdad Esfahbod} hb_direction_t; 4302a370697d25b986dbf1d5c38f46a89a4833b495Behdad Esfahbod 44c968fc2dc87cf85b53f60a40db59d5ee7b992edfBehdad Esfahbodtypedef struct _hb_glyph_info_t { 45f1322e52d557726baa010be8d35a594748e8fa1aBehdad Esfahbod hb_codepoint_t codepoint; 46468769b8f5332940278244e744ec2bd5a5dc5ee9Behdad Esfahbod hb_mask_t mask; 47f1322e52d557726baa010be8d35a594748e8fa1aBehdad Esfahbod uint32_t cluster; 482f5931e404cb56e31d24b2eb7ff0a849fb077b55Behdad Esfahbod uint32_t internal1; 492f5931e404cb56e31d24b2eb7ff0a849fb077b55Behdad Esfahbod uint32_t internal2; 50c968fc2dc87cf85b53f60a40db59d5ee7b992edfBehdad Esfahbod} hb_glyph_info_t; 519f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod 52c968fc2dc87cf85b53f60a40db59d5ee7b992edfBehdad Esfahbodtypedef struct _hb_glyph_position_t { 53b857b49c82782d29d6d189f1a9f4a84d39cd84eaBehdad Esfahbod hb_position_t x_pos; 54b857b49c82782d29d6d189f1a9f4a84d39cd84eaBehdad Esfahbod hb_position_t y_pos; 55b857b49c82782d29d6d189f1a9f4a84d39cd84eaBehdad Esfahbod hb_position_t x_advance; 56b857b49c82782d29d6d189f1a9f4a84d39cd84eaBehdad Esfahbod hb_position_t y_advance; 57f1322e52d557726baa010be8d35a594748e8fa1aBehdad Esfahbod /* XXX these should all be replaced by "uint32_t internal" */ 58864e2560b627f1e73be3b0635e02f00844cb67c3Behdad Esfahbod uint32_t new_advance :1; /* if set, the advance width values are 59f1322e52d557726baa010be8d35a594748e8fa1aBehdad Esfahbod absolute, i.e., they won't be 60f1322e52d557726baa010be8d35a594748e8fa1aBehdad Esfahbod added to the original glyph's value 61f1322e52d557726baa010be8d35a594748e8fa1aBehdad Esfahbod but rather replace them */ 62864e2560b627f1e73be3b0635e02f00844cb67c3Behdad Esfahbod uint32_t back : 15; /* number of glyphs to go back 63f1322e52d557726baa010be8d35a594748e8fa1aBehdad Esfahbod for drawing current glyph */ 64864e2560b627f1e73be3b0635e02f00844cb67c3Behdad Esfahbod int32_t cursive_chain : 16; /* character to which this connects, 65f1322e52d557726baa010be8d35a594748e8fa1aBehdad Esfahbod may be positive or negative; used 66f1322e52d557726baa010be8d35a594748e8fa1aBehdad Esfahbod only internally */ 67c968fc2dc87cf85b53f60a40db59d5ee7b992edfBehdad Esfahbod} hb_glyph_position_t; 689f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod 699f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod 7011fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodhb_buffer_t * 7111fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodhb_buffer_create (unsigned int pre_alloc_size); 729f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod 7311fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodhb_buffer_t * 7411fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodhb_buffer_reference (hb_buffer_t *buffer); 755c0adce1ccc739415c4b26ff13ffd2d77ea4bc6cBehdad Esfahbod 7611fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodunsigned int 7711fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodhb_buffer_get_reference_count (hb_buffer_t *buffer); 7802a370697d25b986dbf1d5c38f46a89a4833b495Behdad Esfahbod 7911fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodvoid 8011fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodhb_buffer_destroy (hb_buffer_t *buffer); 819f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod 829f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod 83a8abb8b994c3cd89808e8f7128a0c04b23eb3edeBehdad Esfahbodvoid 8411fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodhb_buffer_set_direction (hb_buffer_t *buffer, 8511fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbod hb_direction_t direction); 8611fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbod 8711fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodhb_direction_t 8811fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodhb_buffer_get_direction (hb_buffer_t *buffer); 8911fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbod 909f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod 91a8abb8b994c3cd89808e8f7128a0c04b23eb3edeBehdad Esfahbodvoid 92b857b49c82782d29d6d189f1a9f4a84d39cd84eaBehdad Esfahbodhb_buffer_clear (hb_buffer_t *buffer); 939f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod 94b857b49c82782d29d6d189f1a9f4a84d39cd84eaBehdad Esfahbodvoid 9511fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodhb_buffer_clear_positions (hb_buffer_t *buffer); 9611fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbod 9711fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodvoid 98f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbodhb_buffer_ensure (hb_buffer_t *buffer, 99f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod unsigned int size); 100f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod 101fbaf8ffa098bd2b6fb4f4bc2d04b360a319c4af5Behdad Esfahbodvoid 102fbaf8ffa098bd2b6fb4f4bc2d04b360a319c4af5Behdad Esfahbodhb_buffer_reverse (hb_buffer_t *buffer); 103fbaf8ffa098bd2b6fb4f4bc2d04b360a319c4af5Behdad Esfahbod 104fbaf8ffa098bd2b6fb4f4bc2d04b360a319c4af5Behdad Esfahbod 105fbaf8ffa098bd2b6fb4f4bc2d04b360a319c4af5Behdad Esfahbod/* Filling the buffer in */ 10611fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbod 107f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbodvoid 108b857b49c82782d29d6d189f1a9f4a84d39cd84eaBehdad Esfahbodhb_buffer_add_glyph (hb_buffer_t *buffer, 109f1322e52d557726baa010be8d35a594748e8fa1aBehdad Esfahbod hb_codepoint_t codepoint, 110468769b8f5332940278244e744ec2bd5a5dc5ee9Behdad Esfahbod hb_mask_t mask, 111b857b49c82782d29d6d189f1a9f4a84d39cd84eaBehdad Esfahbod unsigned int cluster); 1129f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod 1131b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbodvoid 1141b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbodhb_buffer_add_utf8 (hb_buffer_t *buffer, 1151b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbod const char *text, 116299f08961ffcea27e8def4f0743d0c86ef8dadf1Behdad Esfahbod unsigned int text_length, 1171b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbod unsigned int item_offset, 118299f08961ffcea27e8def4f0743d0c86ef8dadf1Behdad Esfahbod unsigned int item_length); 1191b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbod 1201b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbodvoid 1211b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbodhb_buffer_add_utf16 (hb_buffer_t *buffer, 1221b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbod const uint16_t *text, 123299f08961ffcea27e8def4f0743d0c86ef8dadf1Behdad Esfahbod unsigned int text_length, 1241b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbod unsigned int item_offset, 125299f08961ffcea27e8def4f0743d0c86ef8dadf1Behdad Esfahbod unsigned int item_length); 1261b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbod 1271b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbodvoid 1281b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbodhb_buffer_add_utf32 (hb_buffer_t *buffer, 1291b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbod const uint32_t *text, 130299f08961ffcea27e8def4f0743d0c86ef8dadf1Behdad Esfahbod unsigned int text_length, 1311b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbod unsigned int item_offset, 132299f08961ffcea27e8def4f0743d0c86ef8dadf1Behdad Esfahbod unsigned int item_length); 1331b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbod 13411fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbod 135fbaf8ffa098bd2b6fb4f4bc2d04b360a319c4af5Behdad Esfahbod/* Getting glyphs out of the buffer */ 136fbaf8ffa098bd2b6fb4f4bc2d04b360a319c4af5Behdad Esfahbod 13711fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbod/* Return value valid as long as buffer not modified */ 13811fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodunsigned int 13911fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodhb_buffer_get_len (hb_buffer_t *buffer); 14011fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbod 14111fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbod/* Return value valid as long as buffer not modified */ 14211fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodhb_glyph_info_t * 14311fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodhb_buffer_get_glyph_infos (hb_buffer_t *buffer); 14411fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbod 14511fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbod/* Return value valid as long as buffer not modified */ 14611fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodhb_glyph_position_t * 14711fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodhb_buffer_get_glyph_positions (hb_buffer_t *buffer); 14802a370697d25b986dbf1d5c38f46a89a4833b495Behdad Esfahbod 14902a370697d25b986dbf1d5c38f46a89a4833b495Behdad Esfahbod 150f96ffd43bce0ac6d9c897933c9be0e51d543e570Behdad EsfahbodHB_END_DECLS 1519f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod 1525c0adce1ccc739415c4b26ff13ffd2d77ea4bc6cBehdad Esfahbod#endif /* HB_BUFFER_H */ 153