Imported Upstream version 2.3.1
[platform/upstream/harfbuzz.git] / src / hb-deprecated.h
1 /*
2  * Copyright © 2013  Google, Inc.
3  *
4  *  This is part of HarfBuzz, a text shaping library.
5  *
6  * Permission is hereby granted, without written agreement and without
7  * license or royalty fees, to use, copy, modify, and distribute this
8  * software and its documentation for any purpose, provided that the
9  * above copyright notice and the following two paragraphs appear in
10  * all copies of this software.
11  *
12  * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15  * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
16  * DAMAGE.
17  *
18  * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
21  * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23  *
24  * Google Author(s): Behdad Esfahbod
25  */
26
27 #ifndef HB_H_IN
28 #error "Include <hb.h> instead."
29 #endif
30
31 #ifndef HB_DEPRECATED_H
32 #define HB_DEPRECATED_H
33
34 #include "hb-common.h"
35 #include "hb-unicode.h"
36 #include "hb-font.h"
37 #include "hb-set.h"
38
39
40 /**
41  * SECTION:hb-deprecated
42  * @title: hb-deprecated
43  * @short_description: Deprecated API
44  * @include: hb.h
45  *
46  * These API have been deprecated in favor of newer API, or because they
47  * were deemed unnecessary.
48  **/
49
50
51 HB_BEGIN_DECLS
52
53 #ifndef HB_DISABLE_DEPRECATED
54
55
56 #define HB_SCRIPT_CANADIAN_ABORIGINAL           HB_SCRIPT_CANADIAN_SYLLABICS
57
58 #define HB_BUFFER_FLAGS_DEFAULT                 HB_BUFFER_FLAG_DEFAULT
59 #define HB_BUFFER_SERIALIZE_FLAGS_DEFAULT       HB_BUFFER_SERIALIZE_FLAG_DEFAULT
60
61 typedef hb_bool_t (*hb_font_get_glyph_func_t) (hb_font_t *font, void *font_data,
62                                                hb_codepoint_t unicode, hb_codepoint_t variation_selector,
63                                                hb_codepoint_t *glyph,
64                                                void *user_data);
65
66 HB_EXTERN HB_DEPRECATED_FOR(hb_font_funcs_set_nominal_glyph_func or hb_font_funcs_set_variation_glyph_func) void
67 hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
68                               hb_font_get_glyph_func_t func,
69                               void *user_data, hb_destroy_func_t destroy);
70
71 HB_EXTERN HB_DEPRECATED void
72 hb_set_invert (hb_set_t *set);
73
74 /**
75  * hb_unicode_eastasian_width_func_t:
76  *
77  * Deprecated: 2.0.0
78  */
79 typedef unsigned int                    (*hb_unicode_eastasian_width_func_t)    (hb_unicode_funcs_t *ufuncs,
80                                                                                  hb_codepoint_t      unicode,
81                                                                                  void               *user_data);
82
83 /**
84  * hb_unicode_funcs_set_eastasian_width_func:
85  * @ufuncs: a Unicode function structure
86  * @func: (closure user_data) (destroy destroy) (scope notified):
87  * @user_data:
88  * @destroy:
89  *
90  * 
91  *
92  * Since: 0.9.2
93  * Deprecated: 2.0.0
94  **/
95 HB_EXTERN HB_DEPRECATED void
96 hb_unicode_funcs_set_eastasian_width_func (hb_unicode_funcs_t *ufuncs,
97                                            hb_unicode_eastasian_width_func_t func,
98                                            void *user_data, hb_destroy_func_t destroy);
99
100 /**
101  * hb_unicode_eastasian_width:
102  *
103  * Since: 0.9.2
104  * Deprecated: 2.0.0
105  **/
106 HB_EXTERN HB_DEPRECATED unsigned int
107 hb_unicode_eastasian_width (hb_unicode_funcs_t *ufuncs,
108                             hb_codepoint_t unicode);
109
110
111 /**
112  * hb_unicode_decompose_compatibility_func_t:
113  * @ufuncs: a Unicode function structure
114  * @u: codepoint to decompose
115  * @decomposed: address of codepoint array (of length %HB_UNICODE_MAX_DECOMPOSITION_LEN) to write decomposition into
116  * @user_data: user data pointer as passed to hb_unicode_funcs_set_decompose_compatibility_func()
117  *
118  * Fully decompose @u to its Unicode compatibility decomposition. The codepoints of the decomposition will be written to @decomposed.
119  * The complete length of the decomposition will be returned.
120  *
121  * If @u has no compatibility decomposition, zero should be returned.
122  *
123  * The Unicode standard guarantees that a buffer of length %HB_UNICODE_MAX_DECOMPOSITION_LEN codepoints will always be sufficient for any
124  * compatibility decomposition plus an terminating value of 0.  Consequently, @decompose must be allocated by the caller to be at least this length.  Implementations
125  * of this function type must ensure that they do not write past the provided array.
126  *
127  * Return value: number of codepoints in the full compatibility decomposition of @u, or 0 if no decomposition available.
128  *
129  * Deprecated: 2.0.0
130  */
131 typedef unsigned int                    (*hb_unicode_decompose_compatibility_func_t)    (hb_unicode_funcs_t *ufuncs,
132                                                                                          hb_codepoint_t      u,
133                                                                                          hb_codepoint_t     *decomposed,
134                                                                                          void               *user_data);
135
136 /**
137  * HB_UNICODE_MAX_DECOMPOSITION_LEN:
138  *
139  * See Unicode 6.1 for details on the maximum decomposition length.
140  *
141  * Deprecated: 2.0.0
142  */
143 #define HB_UNICODE_MAX_DECOMPOSITION_LEN (18+1) /* codepoints */
144
145 /**
146  * hb_unicode_funcs_set_decompose_compatibility_func:
147  * @ufuncs: a Unicode function structure
148  * @func: (closure user_data) (destroy destroy) (scope notified):
149  * @user_data:
150  * @destroy:
151  *
152  * 
153  *
154  * Since: 0.9.2
155  * Deprecated: 2.0.0
156  **/
157 HB_EXTERN HB_DEPRECATED void
158 hb_unicode_funcs_set_decompose_compatibility_func (hb_unicode_funcs_t *ufuncs,
159                                                    hb_unicode_decompose_compatibility_func_t func,
160                                                    void *user_data, hb_destroy_func_t destroy);
161
162 HB_EXTERN HB_DEPRECATED unsigned int
163 hb_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs,
164                                     hb_codepoint_t      u,
165                                     hb_codepoint_t     *decomposed);
166
167
168 typedef hb_position_t (*hb_font_get_glyph_kerning_func_t) (hb_font_t *font, void *font_data,
169                                                            hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
170                                                            void *user_data);
171 typedef hb_font_get_glyph_kerning_func_t hb_font_get_glyph_h_kerning_func_t;
172 typedef hb_font_get_glyph_kerning_func_t hb_font_get_glyph_v_kerning_func_t;
173
174 /**
175  * hb_font_funcs_set_glyph_h_kerning_func:
176  * @ffuncs: font functions.
177  * @func: (closure user_data) (destroy destroy) (scope notified):
178  * @user_data:
179  * @destroy:
180  *
181  * 
182  *
183  * Since: 0.9.2
184  * Deprecated: 2.0.0
185  **/
186 HB_EXTERN void
187 hb_font_funcs_set_glyph_h_kerning_func (hb_font_funcs_t *ffuncs,
188                                         hb_font_get_glyph_h_kerning_func_t func,
189                                         void *user_data, hb_destroy_func_t destroy);
190
191 /**
192  * hb_font_funcs_set_glyph_v_kerning_func:
193  * @ffuncs: font functions.
194  * @func: (closure user_data) (destroy destroy) (scope notified):
195  * @user_data:
196  * @destroy:
197  *
198  * 
199  *
200  * Since: 0.9.2
201  * Deprecated: 2.0.0
202  **/
203 HB_EXTERN void
204 hb_font_funcs_set_glyph_v_kerning_func (hb_font_funcs_t *ffuncs,
205                                         hb_font_get_glyph_v_kerning_func_t func,
206                                         void *user_data, hb_destroy_func_t destroy);
207
208 HB_EXTERN hb_position_t
209 hb_font_get_glyph_h_kerning (hb_font_t *font,
210                              hb_codepoint_t left_glyph, hb_codepoint_t right_glyph);
211 HB_EXTERN hb_position_t
212 hb_font_get_glyph_v_kerning (hb_font_t *font,
213                              hb_codepoint_t top_glyph, hb_codepoint_t bottom_glyph);
214
215 HB_EXTERN void
216 hb_font_get_glyph_kerning_for_direction (hb_font_t *font,
217                                          hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
218                                          hb_direction_t direction,
219                                          hb_position_t *x, hb_position_t *y);
220
221
222 #endif
223
224 HB_END_DECLS
225
226 #endif /* HB_DEPRECATED_H */