1a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod/*
22409d5f8d7dd8b535ce5ea29e933f7db27d33793Behdad Esfahbod * Copyright © 1998-2004  David Turner and Werner Lemberg
32409d5f8d7dd8b535ce5ea29e933f7db27d33793Behdad Esfahbod * Copyright © 2004,2007,2009  Red Hat, Inc.
405207a79e0ae1769c5feaebe3fd99bdf9cfcf834Behdad Esfahbod * Copyright © 2011,2012  Google, Inc.
59f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod *
68f0d7e0c3fd4b05c43ac449be4f374dc2dc56127Behdad Esfahbod *  This is part of HarfBuzz, a text shaping library.
79f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod *
8a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * Permission is hereby granted, without written agreement and without
9a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * license or royalty fees, to use, copy, modify, and distribute this
10a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * software and its documentation for any purpose, provided that the
11a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * above copyright notice and the following two paragraphs appear in
12a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * all copies of this software.
139f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod *
14a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
15a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
16a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
17a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
18a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * DAMAGE.
19a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod *
20a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
21a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
22a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
23a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
24a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
25a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod *
26a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod * Red Hat Author(s): Owen Taylor, Behdad Esfahbod
27c910bec863215f918c659f58debbc7fe5264d7b6Behdad Esfahbod * Google Author(s): Behdad Esfahbod
289f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod */
29a2a9a023f6472ba262f89e5327318996b8258d25Behdad Esfahbod
30d1c9eb458c843215da8df84b596bfae51fee135bBehdad Esfahbod#ifndef HB_H_IN
31d1c9eb458c843215da8df84b596bfae51fee135bBehdad Esfahbod#error "Include <hb.h> instead."
32d1c9eb458c843215da8df84b596bfae51fee135bBehdad Esfahbod#endif
33d1c9eb458c843215da8df84b596bfae51fee135bBehdad Esfahbod
345c0adce1ccc739415c4b26ff13ffd2d77ea4bc6cBehdad Esfahbod#ifndef HB_BUFFER_H
355c0adce1ccc739415c4b26ff13ffd2d77ea4bc6cBehdad Esfahbod#define HB_BUFFER_H
369f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod
37b857b49c82782d29d6d189f1a9f4a84d39cd84eaBehdad Esfahbod#include "hb-common.h"
385ebabecef382c3e8b0a2a5657b2c01f7ff37d796Behdad Esfahbod#include "hb-unicode.h"
39f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbod#include "hb-font.h"
409f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod
41f96ffd43bce0ac6d9c897933c9be0e51d543e570Behdad EsfahbodHB_BEGIN_DECLS
429f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod
43fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny/**
44fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny * hb_glyph_info_t:
45fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny * @codepoint: either a Unicode code point (before shaping) or a glyph index
46fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny *             (after shaping).
47fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny * @mask:
48fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny * @cluster: the index of the character in the original text that corresponds
49fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny *           to this #hb_glyph_info_t, or whatever the client passes to
50fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny *           hb_buffer_add(). More than one #hb_glyph_info_t can have the same
51fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny *           @cluster value, if they resulted from the same character (e.g. one
52fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny *           to many glyph substitution), and when more than one character gets
53fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny *           merged in the same glyph (e.g. many to one glyph substitution) the
5497624d9244de0fdb9c03f60e03fe242028efa8a1Behdad Esfahbod *           #hb_glyph_info_t will have the smallest cluster value of them.
5597624d9244de0fdb9c03f60e03fe242028efa8a1Behdad Esfahbod *           By default some characters are merged into the same cluster
5697624d9244de0fdb9c03f60e03fe242028efa8a1Behdad Esfahbod *           (e.g. combining marks have the same cluster as their bases)
5797624d9244de0fdb9c03f60e03fe242028efa8a1Behdad Esfahbod *           even if they are separate glyphs, hb_buffer_set_cluster_level()
5897624d9244de0fdb9c03f60e03fe242028efa8a1Behdad Esfahbod *           allow selecting more fine-grained cluster handling.
59fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny *
609ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * The #hb_glyph_info_t is the structure that holds information about the
61fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny * glyphs and their relation to input text.
62fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny *
63fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny */
641bc1cb3603167f5da309336f7018c8b0608ac104Behdad Esfahbodtypedef struct hb_glyph_info_t {
65f1322e52d557726baa010be8d35a594748e8fa1aBehdad Esfahbod  hb_codepoint_t codepoint;
66468769b8f5332940278244e744ec2bd5a5dc5ee9Behdad Esfahbod  hb_mask_t      mask;
67f1322e52d557726baa010be8d35a594748e8fa1aBehdad Esfahbod  uint32_t       cluster;
68b54cd07b2623b68171e00179a9dc3ecbea7aa6a1Behdad Esfahbod
69b54cd07b2623b68171e00179a9dc3ecbea7aa6a1Behdad Esfahbod  /*< private >*/
706cb8c3493019e1497921666fc268cb81943f9f1fBehdad Esfahbod  hb_var_int_t   var1;
716cb8c3493019e1497921666fc268cb81943f9f1fBehdad Esfahbod  hb_var_int_t   var2;
72c968fc2dc87cf85b53f60a40db59d5ee7b992edfBehdad Esfahbod} hb_glyph_info_t;
739f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod
74fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny/**
75fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny * hb_glyph_position_t:
76fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny * @x_advance: how much the line advances after drawing this glyph when setting
77fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny *             text in horizontal direction.
78fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny * @y_advance: how much the line advances after drawing this glyph when setting
79fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny *             text in vertical direction.
80fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny * @x_offset: how much the glyph moves on the X-axis before drawing it, this
81fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny *            should not affect how much the line advances.
82fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny * @y_offset: how much the glyph moves on the Y-axis before drawing it, this
83fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny *            should not affect how much the line advances.
84fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny *
85fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny * The #hb_glyph_position_t is the structure that holds the positions of the
86fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny * glyph in both horizontal and vertical directions. All positions in
87fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny * #hb_glyph_position_t are relative to the current point.
88fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny *
89fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny */
901bc1cb3603167f5da309336f7018c8b0608ac104Behdad Esfahbodtypedef struct hb_glyph_position_t {
91b857b49c82782d29d6d189f1a9f4a84d39cd84eaBehdad Esfahbod  hb_position_t  x_advance;
92b857b49c82782d29d6d189f1a9f4a84d39cd84eaBehdad Esfahbod  hb_position_t  y_advance;
939bef3611f07b45ba8199a4a339c72f49d266216aBehdad Esfahbod  hb_position_t  x_offset;
949bef3611f07b45ba8199a4a339c72f49d266216aBehdad Esfahbod  hb_position_t  y_offset;
95b54cd07b2623b68171e00179a9dc3ecbea7aa6a1Behdad Esfahbod
96b54cd07b2623b68171e00179a9dc3ecbea7aa6a1Behdad Esfahbod  /*< private >*/
9788474c6fdaf35c56368694a5b164f4988a004d49Behdad Esfahbod  hb_var_int_t   var;
98c968fc2dc87cf85b53f60a40db59d5ee7b992edfBehdad Esfahbod} hb_glyph_position_t;
999f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod
1009ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny/**
1019ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * hb_segment_properties_t:
1029ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * @direction: the #hb_direction_t of the buffer, see hb_buffer_set_direction().
1039ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * @script: the #hb_script_t of the buffer, see hb_buffer_set_script().
1049ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * @language: the #hb_language_t of the buffer, see hb_buffer_set_language().
1059ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny *
1069ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * The structure that holds various text properties of an #hb_buffer_t. Can be
1079ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * set and retrieved using hb_buffer_set_segment_properties() and
1089ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * hb_buffer_get_segment_properties(), respectively.
1099ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny */
110f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbodtypedef struct hb_segment_properties_t {
111f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod  hb_direction_t  direction;
112f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod  hb_script_t     script;
113f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod  hb_language_t   language;
114f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod  /*< private >*/
115f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod  void           *reserved1;
116f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod  void           *reserved2;
117f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod} hb_segment_properties_t;
118f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod
119f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod#define HB_SEGMENT_PROPERTIES_DEFAULT {HB_DIRECTION_INVALID, \
120f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod				       HB_SCRIPT_INVALID, \
121f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod				       HB_LANGUAGE_INVALID, \
122f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod				       NULL, \
123f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod				       NULL}
124f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod
125835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN hb_bool_t
126f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbodhb_segment_properties_equal (const hb_segment_properties_t *a,
127f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod			     const hb_segment_properties_t *b);
128f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod
129835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN unsigned int
130f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbodhb_segment_properties_hash (const hb_segment_properties_t *p);
131f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod
132f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod
133f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod
1349ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny/**
1359ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * hb_buffer_t:
1369ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny *
1379ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * The main structure holding the input text and its properties before shaping,
1389ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * and output glyphs and their information after shaping.
139f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod */
140f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod
141f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbodtypedef struct hb_buffer_t hb_buffer_t;
142f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod
143835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN hb_buffer_t *
144e6c09cdf43201ff1b7f38e411ae1f9977e4f9271Behdad Esfahbodhb_buffer_create (void);
1459f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod
146835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN hb_buffer_t *
14780a6833b032bc63b4e8c3da6489d3767af1168f3Behdad Esfahbodhb_buffer_get_empty (void);
14880a6833b032bc63b4e8c3da6489d3767af1168f3Behdad Esfahbod
149835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN hb_buffer_t *
15011fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodhb_buffer_reference (hb_buffer_t *buffer);
1515c0adce1ccc739415c4b26ff13ffd2d77ea4bc6cBehdad Esfahbod
152835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
15311fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodhb_buffer_destroy (hb_buffer_t *buffer);
1549f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod
155835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN hb_bool_t
1565fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbodhb_buffer_set_user_data (hb_buffer_t        *buffer,
1575fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod			 hb_user_data_key_t *key,
1585fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod			 void *              data,
15933ccc77902660ed4b49184e5ec99f4fd0ef63175Behdad Esfahbod			 hb_destroy_func_t   destroy,
16033ccc77902660ed4b49184e5ec99f4fd0ef63175Behdad Esfahbod			 hb_bool_t           replace);
1615fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod
162835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void *
1635fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbodhb_buffer_get_user_data (hb_buffer_t        *buffer,
1645fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod			 hb_user_data_key_t *key);
1655fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod
1668ab797c5b86c33eab6ee024471fd3c147325d26aKhaled Hosny/**
1678ab797c5b86c33eab6ee024471fd3c147325d26aKhaled Hosny * hb_buffer_content_type_t:
1688ab797c5b86c33eab6ee024471fd3c147325d26aKhaled Hosny * @HB_BUFFER_CONTENT_TYPE_INVALID: Initial value for new buffer.
1698ab797c5b86c33eab6ee024471fd3c147325d26aKhaled Hosny * @HB_BUFFER_CONTENT_TYPE_UNICODE: The buffer contains input characters (before shaping).
1708ab797c5b86c33eab6ee024471fd3c147325d26aKhaled Hosny * @HB_BUFFER_CONTENT_TYPE_GLYPHS: The buffer contains output glyphs (after shaping).
1718ab797c5b86c33eab6ee024471fd3c147325d26aKhaled Hosny */
17292f9bfed42f720c1fd78e795845542661aaf4f8aBehdad Esfahbodtypedef enum {
17392f9bfed42f720c1fd78e795845542661aaf4f8aBehdad Esfahbod  HB_BUFFER_CONTENT_TYPE_INVALID = 0,
17492f9bfed42f720c1fd78e795845542661aaf4f8aBehdad Esfahbod  HB_BUFFER_CONTENT_TYPE_UNICODE,
17592f9bfed42f720c1fd78e795845542661aaf4f8aBehdad Esfahbod  HB_BUFFER_CONTENT_TYPE_GLYPHS
17692f9bfed42f720c1fd78e795845542661aaf4f8aBehdad Esfahbod} hb_buffer_content_type_t;
17792f9bfed42f720c1fd78e795845542661aaf4f8aBehdad Esfahbod
178835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
17996fdc04e5c6daafce3d45e7508418e4db94df44cBehdad Esfahbodhb_buffer_set_content_type (hb_buffer_t              *buffer,
18096fdc04e5c6daafce3d45e7508418e4db94df44cBehdad Esfahbod			    hb_buffer_content_type_t  content_type);
18196fdc04e5c6daafce3d45e7508418e4db94df44cBehdad Esfahbod
182835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN hb_buffer_content_type_t
18396fdc04e5c6daafce3d45e7508418e4db94df44cBehdad Esfahbodhb_buffer_get_content_type (hb_buffer_t *buffer);
18496fdc04e5c6daafce3d45e7508418e4db94df44cBehdad Esfahbod
18596fdc04e5c6daafce3d45e7508418e4db94df44cBehdad Esfahbod
186835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
1875ebabecef382c3e8b0a2a5657b2c01f7ff37d796Behdad Esfahbodhb_buffer_set_unicode_funcs (hb_buffer_t        *buffer,
1885ebabecef382c3e8b0a2a5657b2c01f7ff37d796Behdad Esfahbod			     hb_unicode_funcs_t *unicode_funcs);
1895ebabecef382c3e8b0a2a5657b2c01f7ff37d796Behdad Esfahbod
190835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN hb_unicode_funcs_t *
1915ebabecef382c3e8b0a2a5657b2c01f7ff37d796Behdad Esfahbodhb_buffer_get_unicode_funcs (hb_buffer_t        *buffer);
1925ebabecef382c3e8b0a2a5657b2c01f7ff37d796Behdad Esfahbod
193835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
19411fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodhb_buffer_set_direction (hb_buffer_t    *buffer,
19511fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbod			 hb_direction_t  direction);
19611fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbod
197835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN hb_direction_t
19811fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbodhb_buffer_get_direction (hb_buffer_t *buffer);
19911fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbod
200835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
201ae070b7d39d03bd8bc1244f687b24db505f4af3fBehdad Esfahbodhb_buffer_set_script (hb_buffer_t *buffer,
202ae070b7d39d03bd8bc1244f687b24db505f4af3fBehdad Esfahbod		      hb_script_t  script);
203ae070b7d39d03bd8bc1244f687b24db505f4af3fBehdad Esfahbod
204835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN hb_script_t
205ae070b7d39d03bd8bc1244f687b24db505f4af3fBehdad Esfahbodhb_buffer_get_script (hb_buffer_t *buffer);
206ae070b7d39d03bd8bc1244f687b24db505f4af3fBehdad Esfahbod
207835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
208ae070b7d39d03bd8bc1244f687b24db505f4af3fBehdad Esfahbodhb_buffer_set_language (hb_buffer_t   *buffer,
209ae070b7d39d03bd8bc1244f687b24db505f4af3fBehdad Esfahbod			hb_language_t  language);
210ae070b7d39d03bd8bc1244f687b24db505f4af3fBehdad Esfahbod
211f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod
212835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN hb_language_t
213ae070b7d39d03bd8bc1244f687b24db505f4af3fBehdad Esfahbodhb_buffer_get_language (hb_buffer_t *buffer);
2149f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod
215835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
216f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbodhb_buffer_set_segment_properties (hb_buffer_t *buffer,
217f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod				  const hb_segment_properties_t *props);
218f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod
219835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
220f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbodhb_buffer_get_segment_properties (hb_buffer_t *buffer,
221f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod				  hb_segment_properties_t *props);
222f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod
223835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
2243f82f8ff07a9d16a7c047129658c1bbedfdb5436Behdad Esfahbodhb_buffer_guess_segment_properties (hb_buffer_t *buffer);
225f30641038ba96e83950729b1bd9d86d2e98e46c5Behdad Esfahbod
22692f9bfed42f720c1fd78e795845542661aaf4f8aBehdad Esfahbod
227fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny/**
228fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny * hb_buffer_flags_t:
229fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny * @HB_BUFFER_FLAG_DEFAULT: the default buffer flag.
230fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny * @HB_BUFFER_FLAG_BOT: flag indicating that special handling of the beginning
23197624d9244de0fdb9c03f60e03fe242028efa8a1Behdad Esfahbod *                      of text paragraph can be applied to this buffer. Should usually
23297624d9244de0fdb9c03f60e03fe242028efa8a1Behdad Esfahbod *                      be set, unless you are passing to the buffer only part
233fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny *                      of the text without the full context.
234fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny * @HB_BUFFER_FLAG_EOT: flag indicating that special handling of the end of text
23597624d9244de0fdb9c03f60e03fe242028efa8a1Behdad Esfahbod *                      paragraph can be applied to this buffer, similar to
236fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny *                      @HB_BUFFER_FLAG_EOT.
237fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny * @HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES:
23897624d9244de0fdb9c03f60e03fe242028efa8a1Behdad Esfahbod *                      flag indication that character with Default_Ignorable
239fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny *                      Unicode property should use the corresponding glyph
24097624d9244de0fdb9c03f60e03fe242028efa8a1Behdad Esfahbod *                      from the font, instead of hiding them (currently done
24197624d9244de0fdb9c03f60e03fe242028efa8a1Behdad Esfahbod *                      by replacing them with the space glyph and zeroing the
24297624d9244de0fdb9c03f60e03fe242028efa8a1Behdad Esfahbod *                      advance width.)
243fb192c263e17081c87f4cc971274d9be42f19513Khaled Hosny *
244b8811429b6810c4f13be087b593a862c17d9d987Behdad Esfahbod * Since: 0.9.20
245b8811429b6810c4f13be087b593a862c17d9d987Behdad Esfahbod */
2464dc798de19c767b91fd3025c85593fa6809d1340Behdad Esfahbodtypedef enum { /*< flags >*/
24711fb16cb849285a178d9e80991b1d60a960326eeBehdad Esfahbod  HB_BUFFER_FLAG_DEFAULT			= 0x00000000u,
24811fb16cb849285a178d9e80991b1d60a960326eeBehdad Esfahbod  HB_BUFFER_FLAG_BOT				= 0x00000001u, /* Beginning-of-text */
24911fb16cb849285a178d9e80991b1d60a960326eeBehdad Esfahbod  HB_BUFFER_FLAG_EOT				= 0x00000002u, /* End-of-text */
25011fb16cb849285a178d9e80991b1d60a960326eeBehdad Esfahbod  HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES	= 0x00000004u
25192f9bfed42f720c1fd78e795845542661aaf4f8aBehdad Esfahbod} hb_buffer_flags_t;
25292f9bfed42f720c1fd78e795845542661aaf4f8aBehdad Esfahbod
253835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
2540c7df2222862122ebbdc8665a21d6771ef5e0252Behdad Esfahbodhb_buffer_set_flags (hb_buffer_t       *buffer,
2550c7df2222862122ebbdc8665a21d6771ef5e0252Behdad Esfahbod		     hb_buffer_flags_t  flags);
2560c7df2222862122ebbdc8665a21d6771ef5e0252Behdad Esfahbod
257835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN hb_buffer_flags_t
2580c7df2222862122ebbdc8665a21d6771ef5e0252Behdad Esfahbodhb_buffer_get_flags (hb_buffer_t *buffer);
2590c7df2222862122ebbdc8665a21d6771ef5e0252Behdad Esfahbod
260b8811429b6810c4f13be087b593a862c17d9d987Behdad Esfahbod/*
261b8811429b6810c4f13be087b593a862c17d9d987Behdad Esfahbod * Since: 0.9.42
262b8811429b6810c4f13be087b593a862c17d9d987Behdad Esfahbod */
263376d587f36b4ff10342ee6ca3bacd73532ea44c8Behdad Esfahbodtypedef enum {
264376d587f36b4ff10342ee6ca3bacd73532ea44c8Behdad Esfahbod  HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES	= 0,
265376d587f36b4ff10342ee6ca3bacd73532ea44c8Behdad Esfahbod  HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS	= 1,
266376d587f36b4ff10342ee6ca3bacd73532ea44c8Behdad Esfahbod  HB_BUFFER_CLUSTER_LEVEL_CHARACTERS		= 2,
267376d587f36b4ff10342ee6ca3bacd73532ea44c8Behdad Esfahbod  HB_BUFFER_CLUSTER_LEVEL_DEFAULT = HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES
268376d587f36b4ff10342ee6ca3bacd73532ea44c8Behdad Esfahbod} hb_buffer_cluster_level_t;
269376d587f36b4ff10342ee6ca3bacd73532ea44c8Behdad Esfahbod
270835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
271376d587f36b4ff10342ee6ca3bacd73532ea44c8Behdad Esfahbodhb_buffer_set_cluster_level (hb_buffer_t               *buffer,
272376d587f36b4ff10342ee6ca3bacd73532ea44c8Behdad Esfahbod			     hb_buffer_cluster_level_t  cluster_level);
2735ebabecef382c3e8b0a2a5657b2c01f7ff37d796Behdad Esfahbod
274835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN hb_buffer_cluster_level_t
275376d587f36b4ff10342ee6ca3bacd73532ea44c8Behdad Esfahbodhb_buffer_get_cluster_level (hb_buffer_t *buffer);
276976c8f455221eb599d1c446eafd88d51d7d2aa65Behdad Esfahbod
2779ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny/**
2789ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT:
2799ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny *
2809ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * The default code point for replacing invalid characters in a given encoding.
2819ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * Set to U+FFFD REPLACEMENT CHARACTER.
2829ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny *
2839ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * Since: 0.9.31
2849ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny */
285976c8f455221eb599d1c446eafd88d51d7d2aa65Behdad Esfahbod#define HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT 0xFFFDu
286976c8f455221eb599d1c446eafd88d51d7d2aa65Behdad Esfahbod
287835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
288976c8f455221eb599d1c446eafd88d51d7d2aa65Behdad Esfahbodhb_buffer_set_replacement_codepoint (hb_buffer_t    *buffer,
289976c8f455221eb599d1c446eafd88d51d7d2aa65Behdad Esfahbod				     hb_codepoint_t  replacement);
290976c8f455221eb599d1c446eafd88d51d7d2aa65Behdad Esfahbod
291835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN hb_codepoint_t
292976c8f455221eb599d1c446eafd88d51d7d2aa65Behdad Esfahbodhb_buffer_get_replacement_codepoint (hb_buffer_t    *buffer);
293976c8f455221eb599d1c446eafd88d51d7d2aa65Behdad Esfahbod
294976c8f455221eb599d1c446eafd88d51d7d2aa65Behdad Esfahbod
295835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
296c910bec863215f918c659f58debbc7fe5264d7b6Behdad Esfahbodhb_buffer_reset (hb_buffer_t *buffer);
297c910bec863215f918c659f58debbc7fe5264d7b6Behdad Esfahbod
298835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
2991172dc736280566426eb6dade1a886b2a0ca9aa4Behdad Esfahbodhb_buffer_clear_contents (hb_buffer_t *buffer);
30082ecaff736e245e117d70b6ec1497508c6eb08d2Behdad Esfahbod
301835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN hb_bool_t
30202a534b23f2d1e7475109563b9f61221ed020e8bRyan Lortiehb_buffer_pre_allocate (hb_buffer_t  *buffer,
30302a534b23f2d1e7475109563b9f61221ed020e8bRyan Lortie		        unsigned int  size);
304f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod
305aab0de50e23727b69fa8c3d4e05c50c114c62835Behdad Esfahbod
306835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN hb_bool_t
307aab0de50e23727b69fa8c3d4e05c50c114c62835Behdad Esfahbodhb_buffer_allocation_successful (hb_buffer_t  *buffer);
308aab0de50e23727b69fa8c3d4e05c50c114c62835Behdad Esfahbod
309835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
310fbaf8ffa098bd2b6fb4f4bc2d04b360a319c4af5Behdad Esfahbodhb_buffer_reverse (hb_buffer_t *buffer);
311fbaf8ffa098bd2b6fb4f4bc2d04b360a319c4af5Behdad Esfahbod
312835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
31381bedda58cfc15f1987aa1952290cf9d87b4d074Behdad Esfahbodhb_buffer_reverse_range (hb_buffer_t *buffer,
31481bedda58cfc15f1987aa1952290cf9d87b4d074Behdad Esfahbod			 unsigned int start, unsigned int end);
31581bedda58cfc15f1987aa1952290cf9d87b4d074Behdad Esfahbod
316835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
317ff44f88df2c46920f3ec2384ef321a4c7bb0f6efBehdad Esfahbodhb_buffer_reverse_clusters (hb_buffer_t *buffer);
318ff44f88df2c46920f3ec2384ef321a4c7bb0f6efBehdad Esfahbod
319fbaf8ffa098bd2b6fb4f4bc2d04b360a319c4af5Behdad Esfahbod
320fbaf8ffa098bd2b6fb4f4bc2d04b360a319c4af5Behdad Esfahbod/* Filling the buffer in */
32111fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbod
322835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
323f85faee9b3cb841ea977403945e2c877ab32b97aBehdad Esfahbodhb_buffer_add (hb_buffer_t    *buffer,
324f85faee9b3cb841ea977403945e2c877ab32b97aBehdad Esfahbod	       hb_codepoint_t  codepoint,
325f85faee9b3cb841ea977403945e2c877ab32b97aBehdad Esfahbod	       unsigned int    cluster);
3269f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod
327835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
3281b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbodhb_buffer_add_utf8 (hb_buffer_t  *buffer,
3291b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbod		    const char   *text,
330944b2ba1ce076385f985212bbdf2df96a8a995f0Behdad Esfahbod		    int           text_length,
3311b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbod		    unsigned int  item_offset,
332944b2ba1ce076385f985212bbdf2df96a8a995f0Behdad Esfahbod		    int           item_length);
3331b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbod
334835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
3351b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbodhb_buffer_add_utf16 (hb_buffer_t    *buffer,
3361b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbod		     const uint16_t *text,
337944b2ba1ce076385f985212bbdf2df96a8a995f0Behdad Esfahbod		     int             text_length,
3381b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbod		     unsigned int    item_offset,
339944b2ba1ce076385f985212bbdf2df96a8a995f0Behdad Esfahbod		     int             item_length);
3401b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbod
341835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
3421b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbodhb_buffer_add_utf32 (hb_buffer_t    *buffer,
3431b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbod		     const uint32_t *text,
344944b2ba1ce076385f985212bbdf2df96a8a995f0Behdad Esfahbod		     int             text_length,
3451b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbod		     unsigned int    item_offset,
346944b2ba1ce076385f985212bbdf2df96a8a995f0Behdad Esfahbod		     int             item_length);
3471b7b97f28ac192006ca5b6d1cc9fbc80fa2bdb55Behdad Esfahbod
348835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
34961820bc4ca1f02433db4be7c81f27cf97e2bd519Behdad Esfahbodhb_buffer_add_latin1 (hb_buffer_t   *buffer,
35061820bc4ca1f02433db4be7c81f27cf97e2bd519Behdad Esfahbod		      const uint8_t *text,
35161820bc4ca1f02433db4be7c81f27cf97e2bd519Behdad Esfahbod		      int            text_length,
35261820bc4ca1f02433db4be7c81f27cf97e2bd519Behdad Esfahbod		      unsigned int   item_offset,
35361820bc4ca1f02433db4be7c81f27cf97e2bd519Behdad Esfahbod		      int            item_length);
35461820bc4ca1f02433db4be7c81f27cf97e2bd519Behdad Esfahbod
355835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
356bcba8b45024e1eca8be77ca2657de1dc44dbf8fbBehdad Esfahbodhb_buffer_add_codepoints (hb_buffer_t          *buffer,
357bcba8b45024e1eca8be77ca2657de1dc44dbf8fbBehdad Esfahbod			  const hb_codepoint_t *text,
358bcba8b45024e1eca8be77ca2657de1dc44dbf8fbBehdad Esfahbod			  int                   text_length,
359bcba8b45024e1eca8be77ca2657de1dc44dbf8fbBehdad Esfahbod			  unsigned int          item_offset,
360bcba8b45024e1eca8be77ca2657de1dc44dbf8fbBehdad Esfahbod			  int                   item_length);
361bcba8b45024e1eca8be77ca2657de1dc44dbf8fbBehdad Esfahbod
36211fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbod
363835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN hb_bool_t
364c910bec863215f918c659f58debbc7fe5264d7b6Behdad Esfahbodhb_buffer_set_length (hb_buffer_t  *buffer,
365c910bec863215f918c659f58debbc7fe5264d7b6Behdad Esfahbod		      unsigned int  length);
366fbaf8ffa098bd2b6fb4f4bc2d04b360a319c4af5Behdad Esfahbod
367835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN unsigned int
3683d14528b8b2e7da425a9df7057fc9fb326d8298cBehdad Esfahbodhb_buffer_get_length (hb_buffer_t *buffer);
36911fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbod
370c910bec863215f918c659f58debbc7fe5264d7b6Behdad Esfahbod/* Getting glyphs out of the buffer */
371c910bec863215f918c659f58debbc7fe5264d7b6Behdad Esfahbod
372835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN hb_glyph_info_t *
37370566befc59cfa8b9c43ac682749c40ea783b1ddRyan Lortiehb_buffer_get_glyph_infos (hb_buffer_t  *buffer,
37470566befc59cfa8b9c43ac682749c40ea783b1ddRyan Lortie                           unsigned int *length);
37511fbb5487d9900a019440ef8235f35c9f525decbBehdad Esfahbod
376835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN hb_glyph_position_t *
37770566befc59cfa8b9c43ac682749c40ea783b1ddRyan Lortiehb_buffer_get_glyph_positions (hb_buffer_t  *buffer,
37870566befc59cfa8b9c43ac682749c40ea783b1ddRyan Lortie                               unsigned int *length);
37902a370697d25b986dbf1d5c38f46a89a4833b495Behdad Esfahbod
38002a370697d25b986dbf1d5c38f46a89a4833b495Behdad Esfahbod
381835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN void
38239b17837b4064d59c18cebb49c1c0b5b8cc0c117Behdad Esfahbodhb_buffer_normalize_glyphs (hb_buffer_t *buffer);
38339b17837b4064d59c18cebb49c1c0b5b8cc0c117Behdad Esfahbod
38439b17837b4064d59c18cebb49c1c0b5b8cc0c117Behdad Esfahbod
385c54599ad269380c7aa28d885fcfd660fc2c10a7bBehdad Esfahbod/*
386c54599ad269380c7aa28d885fcfd660fc2c10a7bBehdad Esfahbod * Serialize
387c54599ad269380c7aa28d885fcfd660fc2c10a7bBehdad Esfahbod */
38839b17837b4064d59c18cebb49c1c0b5b8cc0c117Behdad Esfahbod
3899ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny/**
3909ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * hb_buffer_serialize_flags_t:
3919ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * @HB_BUFFER_SERIALIZE_FLAG_DEFAULT: serialize glyph names, clusters and positions.
3929ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * @HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS: do not serialize glyph cluster.
3939ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * @HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS: do not serialize glyph position information.
3949ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * @HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES: do no serialize glyph name.
3959ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * @HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS: serialize glyph extents.
3969ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny *
3979ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * Flags that control what glyph information are serialized in hb_buffer_serialize_glyphs().
3989ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny *
399b8811429b6810c4f13be087b593a862c17d9d987Behdad Esfahbod * Since: 0.9.20
400b8811429b6810c4f13be087b593a862c17d9d987Behdad Esfahbod */
4014dc798de19c767b91fd3025c85593fa6809d1340Behdad Esfahbodtypedef enum { /*< flags >*/
40211fb16cb849285a178d9e80991b1d60a960326eeBehdad Esfahbod  HB_BUFFER_SERIALIZE_FLAG_DEFAULT		= 0x00000000u,
40311fb16cb849285a178d9e80991b1d60a960326eeBehdad Esfahbod  HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS		= 0x00000001u,
40411fb16cb849285a178d9e80991b1d60a960326eeBehdad Esfahbod  HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS		= 0x00000002u,
405fdd1770e006ca2d2973c049177ceda87a575e07fBehdad Esfahbod  HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES	= 0x00000004u,
406fdd1770e006ca2d2973c049177ceda87a575e07fBehdad Esfahbod  HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS	= 0x00000008u
407f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbod} hb_buffer_serialize_flags_t;
408f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbod
4099ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny/**
4109ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * hb_buffer_serialize_format_t:
4119ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * @HB_BUFFER_SERIALIZE_FORMAT_TEXT: a human-readable, plain text format.
4129ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * @HB_BUFFER_SERIALIZE_FORMAT_JSON: a machine-readable JSON format.
41397624d9244de0fdb9c03f60e03fe242028efa8a1Behdad Esfahbod * @HB_BUFFER_SERIALIZE_FORMAT_INVALID: invalid format.
4149ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny *
4159ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * The buffer serialization and de-serialization format used in
4169ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * hb_buffer_serialize_glyphs() and hb_buffer_deserialize_glyphs().
4179ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny *
4189ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny * Since: 0.9.2
4199ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny */
420f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbodtypedef enum {
421f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbod  HB_BUFFER_SERIALIZE_FORMAT_TEXT	= HB_TAG('T','E','X','T'),
422f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbod  HB_BUFFER_SERIALIZE_FORMAT_JSON	= HB_TAG('J','S','O','N'),
423f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbod  HB_BUFFER_SERIALIZE_FORMAT_INVALID	= HB_TAG_NONE
424f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbod} hb_buffer_serialize_format_t;
425f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbod
426835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN hb_buffer_serialize_format_t
427f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbodhb_buffer_serialize_format_from_string (const char *str, int len);
428f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbod
429835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN const char *
430f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbodhb_buffer_serialize_format_to_string (hb_buffer_serialize_format_t format);
431f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbod
432835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN const char **
433072ae7a982bf640804eee0b41525e7c328806bf5Behdad Esfahbodhb_buffer_serialize_list_formats (void);
434072ae7a982bf640804eee0b41525e7c328806bf5Behdad Esfahbod
435835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN unsigned int
436f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbodhb_buffer_serialize_glyphs (hb_buffer_t *buffer,
437f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbod			    unsigned int start,
438f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbod			    unsigned int end,
439f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbod			    char *buf,
440f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbod			    unsigned int buf_size,
4419ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny			    unsigned int *buf_consumed,
4429ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny			    hb_font_t *font,
443f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbod			    hb_buffer_serialize_format_t format,
444f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbod			    hb_buffer_serialize_flags_t flags);
445f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbod
446835bbdc7c92bd774ff92c42a9277ded72066d29dChun-wei FanHB_EXTERN hb_bool_t
447f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbodhb_buffer_deserialize_glyphs (hb_buffer_t *buffer,
448f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbod			      const char *buf,
4499ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny			      int buf_len,
4509ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny			      const char **end_ptr,
4519ab9f974d42e0001966e243a23a64e6aefbd4764Khaled Hosny			      hb_font_t *font,
452f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbod			      hb_buffer_serialize_format_t format);
453f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbod
454f9edf1672511c3bcc3796cc79578ffea43b2bda1Behdad Esfahbod
4550475ef2f97e3035a2eea9a0f96031331e07e8e29Behdad Esfahbod/*
4560475ef2f97e3035a2eea9a0f96031331e07e8e29Behdad Esfahbod * Debugging.
4570475ef2f97e3035a2eea9a0f96031331e07e8e29Behdad Esfahbod */
4580475ef2f97e3035a2eea9a0f96031331e07e8e29Behdad Esfahbod
4590475ef2f97e3035a2eea9a0f96031331e07e8e29Behdad Esfahbodtypedef hb_bool_t	(*hb_buffer_message_func_t)	(hb_buffer_t *buffer,
4600475ef2f97e3035a2eea9a0f96031331e07e8e29Behdad Esfahbod							 hb_font_t   *font,
4610475ef2f97e3035a2eea9a0f96031331e07e8e29Behdad Esfahbod							 const char  *message,
4620475ef2f97e3035a2eea9a0f96031331e07e8e29Behdad Esfahbod							 void        *user_data);
4630475ef2f97e3035a2eea9a0f96031331e07e8e29Behdad Esfahbod
4640475ef2f97e3035a2eea9a0f96031331e07e8e29Behdad EsfahbodHB_EXTERN void
4650475ef2f97e3035a2eea9a0f96031331e07e8e29Behdad Esfahbodhb_buffer_set_message_func (hb_buffer_t *buffer,
4660475ef2f97e3035a2eea9a0f96031331e07e8e29Behdad Esfahbod			    hb_buffer_message_func_t func,
4670475ef2f97e3035a2eea9a0f96031331e07e8e29Behdad Esfahbod			    void *user_data, hb_destroy_func_t destroy);
4680475ef2f97e3035a2eea9a0f96031331e07e8e29Behdad Esfahbod
4690475ef2f97e3035a2eea9a0f96031331e07e8e29Behdad Esfahbod
470f96ffd43bce0ac6d9c897933c9be0e51d543e570Behdad EsfahbodHB_END_DECLS
4719f8da38cd108590514b71756b752d98952a9221fBehdad Esfahbod
4725c0adce1ccc739415c4b26ff13ffd2d77ea4bc6cBehdad Esfahbod#endif /* HB_BUFFER_H */
473