hb-unicode.h 5.7 KB
Newer Older
B
Behdad Esfahbod 已提交
1
/*
B
Behdad Esfahbod 已提交
2
 * Copyright © 2009  Red Hat, Inc.
3
 * Copyright © 2011  Codethink Limited
B
Behdad Esfahbod 已提交
4
 * Copyright © 2011  Google, Inc.
B
Behdad Esfahbod 已提交
5
 *
B
Behdad Esfahbod 已提交
6
 *  This is part of HarfBuzz, a text shaping library.
B
Behdad Esfahbod 已提交
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
 *
 * Permission is hereby granted, without written agreement and without
 * license or royalty fees, to use, copy, modify, and distribute this
 * software and its documentation for any purpose, provided that the
 * above copyright notice and the following two paragraphs appear in
 * all copies of this software.
 *
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
 * DAMAGE.
 *
 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 *
 * Red Hat Author(s): Behdad Esfahbod
27
 * Codethink Author(s): Ryan Lortie
B
Behdad Esfahbod 已提交
28
 * Google Author(s): Behdad Esfahbod
B
Behdad Esfahbod 已提交
29 30 31 32 33 34 35 36 37
 */

#ifndef HB_UNICODE_H
#define HB_UNICODE_H

#include "hb-common.h"

HB_BEGIN_DECLS

B
Behdad Esfahbod 已提交
38

B
Behdad Esfahbod 已提交
39 40 41 42 43 44
/*
 * hb_unicode_funcs_t
 */

typedef struct _hb_unicode_funcs_t hb_unicode_funcs_t;

45 46 47 48 49 50 51 52

/*
 * just give me the best implementation you've got there.
 */
hb_unicode_funcs_t *
hb_unicode_funcs_get_default (void);


B
Behdad Esfahbod 已提交
53
hb_unicode_funcs_t *
54
hb_unicode_funcs_create (hb_unicode_funcs_t *parent);
B
Behdad Esfahbod 已提交
55

56 57 58
hb_unicode_funcs_t *
hb_unicode_funcs_get_empty (void);

B
Behdad Esfahbod 已提交
59 60 61 62 63 64
hb_unicode_funcs_t *
hb_unicode_funcs_reference (hb_unicode_funcs_t *ufuncs);

void
hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs);

65 66 67 68 69 70 71 72 73 74 75 76
hb_bool_t
hb_unicode_funcs_set_user_data (hb_unicode_funcs_t *ufuncs,
			        hb_user_data_key_t *key,
			        void *              data,
			        hb_destroy_func_t   destroy);


void *
hb_unicode_funcs_get_user_data (hb_unicode_funcs_t *ufuncs,
			        hb_user_data_key_t *key);


77 78
void
hb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs);
B
Behdad Esfahbod 已提交
79

B
Behdad Esfahbod 已提交
80 81
hb_bool_t
hb_unicode_funcs_is_immutable (hb_unicode_funcs_t *ufuncs);
B
Behdad Esfahbod 已提交
82

B
Behdad Esfahbod 已提交
83 84 85 86
hb_unicode_funcs_t *
hb_unicode_funcs_get_parent (hb_unicode_funcs_t *ufuncs);


B
Behdad Esfahbod 已提交
87 88 89 90 91
/*
 * funcs
 */

/* typedefs */
B
Behdad Esfahbod 已提交
92

93
typedef unsigned int			(*hb_unicode_combining_class_func_t)	(hb_unicode_funcs_t *ufuncs,
B
Behdad Esfahbod 已提交
94 95
										 hb_codepoint_t      unicode,
										 void               *user_data);
96
typedef unsigned int			(*hb_unicode_eastasian_width_func_t)	(hb_unicode_funcs_t *ufuncs,
B
Behdad Esfahbod 已提交
97 98
										 hb_codepoint_t      unicode,
										 void               *user_data);
99
typedef hb_unicode_general_category_t	(*hb_unicode_general_category_func_t)	(hb_unicode_funcs_t *ufuncs,
B
Behdad Esfahbod 已提交
100 101
										 hb_codepoint_t      unicode,
										 void               *user_data);
102
typedef hb_codepoint_t			(*hb_unicode_mirroring_func_t)		(hb_unicode_funcs_t *ufuncs,
B
Behdad Esfahbod 已提交
103 104
										 hb_codepoint_t      unicode,
										 void               *user_data);
105
typedef hb_script_t			(*hb_unicode_script_func_t)		(hb_unicode_funcs_t *ufuncs,
B
Behdad Esfahbod 已提交
106 107
										 hb_codepoint_t      unicode,
										 void               *user_data);
B
Behdad Esfahbod 已提交
108

109 110 111 112 113 114 115 116 117 118 119
typedef hb_bool_t			(*hb_unicode_compose_func_t)		(hb_unicode_funcs_t *ufuncs,
										 hb_codepoint_t      a,
										 hb_codepoint_t      b,
										 hb_codepoint_t     *ab,
										 void               *user_data);
typedef hb_bool_t			(*hb_unicode_decompose_func_t)		(hb_unicode_funcs_t *ufuncs,
										 hb_codepoint_t      ab,
										 hb_codepoint_t     *a,
										 hb_codepoint_t     *b,
										 void               *user_data);

B
Behdad Esfahbod 已提交
120 121
/* setters */

B
Behdad Esfahbod 已提交
122
void
123
hb_unicode_funcs_set_combining_class_func (hb_unicode_funcs_t *ufuncs,
124
					   hb_unicode_combining_class_func_t combining_class_func,
B
Behdad Esfahbod 已提交
125
					   void *user_data, hb_destroy_func_t destroy);
126 127 128

void
hb_unicode_funcs_set_eastasian_width_func (hb_unicode_funcs_t *ufuncs,
129
					   hb_unicode_eastasian_width_func_t eastasian_width_func,
B
Behdad Esfahbod 已提交
130
					   void *user_data, hb_destroy_func_t destroy);
B
Behdad Esfahbod 已提交
131 132 133

void
hb_unicode_funcs_set_general_category_func (hb_unicode_funcs_t *ufuncs,
134
					    hb_unicode_general_category_func_t general_category_func,
B
Behdad Esfahbod 已提交
135
					    void *user_data, hb_destroy_func_t destroy);
B
Behdad Esfahbod 已提交
136

137 138
void
hb_unicode_funcs_set_mirroring_func (hb_unicode_funcs_t *ufuncs,
139
				     hb_unicode_mirroring_func_t mirroring_func,
B
Behdad Esfahbod 已提交
140
				     void *user_data, hb_destroy_func_t destroy);
141

B
Behdad Esfahbod 已提交
142 143
void
hb_unicode_funcs_set_script_func (hb_unicode_funcs_t *ufuncs,
144
				  hb_unicode_script_func_t script_func,
B
Behdad Esfahbod 已提交
145
				  void *user_data, hb_destroy_func_t destroy);
B
Behdad Esfahbod 已提交
146

147 148 149 150 151 152 153 154 155
void
hb_unicode_funcs_set_compose_func (hb_unicode_funcs_t *ufuncs,
				   hb_unicode_compose_func_t compose_func,
				   void *user_data, hb_destroy_func_t destroy);

void
hb_unicode_funcs_set_decompose_func (hb_unicode_funcs_t *ufuncs,
				     hb_unicode_decompose_func_t decompose_func,
				     void *user_data, hb_destroy_func_t destroy);
B
Behdad Esfahbod 已提交
156 157 158 159


/* accessors */

160
unsigned int
161 162
hb_unicode_combining_class (hb_unicode_funcs_t *ufuncs,
			    hb_codepoint_t unicode);
163 164

unsigned int
165 166
hb_unicode_eastasian_width (hb_unicode_funcs_t *ufuncs,
			    hb_codepoint_t unicode);
B
Behdad Esfahbod 已提交
167

168
hb_unicode_general_category_t
169 170
hb_unicode_general_category (hb_unicode_funcs_t *ufuncs,
			     hb_codepoint_t unicode);
B
Behdad Esfahbod 已提交
171

172
hb_codepoint_t
173 174
hb_unicode_mirroring (hb_unicode_funcs_t *ufuncs,
		      hb_codepoint_t unicode);
175

B
Behdad Esfahbod 已提交
176
hb_script_t
177 178
hb_unicode_script (hb_unicode_funcs_t *ufuncs,
		   hb_codepoint_t unicode);
B
Behdad Esfahbod 已提交
179

180 181 182 183 184 185 186 187 188 189
hb_bool_t
hb_unicode_compose (hb_unicode_funcs_t *ufuncs,
		    hb_codepoint_t      a,
		    hb_codepoint_t      b,
		    hb_codepoint_t     *ab);
hb_bool_t
hb_unicode_decompose (hb_unicode_funcs_t *ufuncs,
		      hb_codepoint_t      ab,
		      hb_codepoint_t     *a,
		      hb_codepoint_t     *b);
B
Behdad Esfahbod 已提交
190

B
Behdad Esfahbod 已提交
191 192
HB_END_DECLS

B
Behdad Esfahbod 已提交
193
#endif /* HB_UNICODE_H */