Behdad Esfahbod | 5c44188 | 2009-08-10 20:05:16 -0400 | [diff] [blame] | 1 | /* |
Behdad Esfahbod | 2409d5f | 2011-04-21 17:14:28 -0400 | [diff] [blame] | 2 | * Copyright © 2009 Red Hat, Inc. |
Behdad Esfahbod | 6af9cff | 2011-04-29 12:00:38 -0400 | [diff] [blame] | 3 | * Copyright © 2011 Codethink Limited |
Behdad Esfahbod | 2409d5f | 2011-04-21 17:14:28 -0400 | [diff] [blame] | 4 | * Copyright © 2011 Google, Inc. |
Behdad Esfahbod | 5c44188 | 2009-08-10 20:05:16 -0400 | [diff] [blame] | 5 | * |
Behdad Esfahbod | c755cb3 | 2010-04-22 00:11:43 -0400 | [diff] [blame] | 6 | * This is part of HarfBuzz, a text shaping library. |
Behdad Esfahbod | 5c44188 | 2009-08-10 20:05:16 -0400 | [diff] [blame] | 7 | * |
| 8 | * Permission is hereby granted, without written agreement and without |
| 9 | * license or royalty fees, to use, copy, modify, and distribute this |
| 10 | * software and its documentation for any purpose, provided that the |
| 11 | * above copyright notice and the following two paragraphs appear in |
| 12 | * all copies of this software. |
| 13 | * |
| 14 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR |
| 15 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
| 16 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN |
| 17 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
| 18 | * DAMAGE. |
| 19 | * |
| 20 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
| 21 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
| 22 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
| 23 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO |
| 24 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 25 | * |
| 26 | * Red Hat Author(s): Behdad Esfahbod |
Ryan Lortie | 2fd0c57 | 2011-04-20 00:19:20 -0400 | [diff] [blame] | 27 | * Codethink Author(s): Ryan Lortie |
Behdad Esfahbod | 2409d5f | 2011-04-21 17:14:28 -0400 | [diff] [blame] | 28 | * Google Author(s): Behdad Esfahbod |
Behdad Esfahbod | 5c44188 | 2009-08-10 20:05:16 -0400 | [diff] [blame] | 29 | */ |
| 30 | |
Behdad Esfahbod | d1c9eb4 | 2012-04-12 13:17:44 -0400 | [diff] [blame] | 31 | #ifndef HB_H_IN |
| 32 | #error "Include <hb.h> instead." |
| 33 | #endif |
| 34 | |
Behdad Esfahbod | 5c44188 | 2009-08-10 20:05:16 -0400 | [diff] [blame] | 35 | #ifndef HB_UNICODE_H |
| 36 | #define HB_UNICODE_H |
| 37 | |
| 38 | #include "hb-common.h" |
| 39 | |
| 40 | HB_BEGIN_DECLS |
| 41 | |
Behdad Esfahbod | acdba3f | 2010-07-23 15:11:18 -0400 | [diff] [blame] | 42 | |
Behdad Esfahbod | 5c44188 | 2009-08-10 20:05:16 -0400 | [diff] [blame] | 43 | /* |
| 44 | * hb_unicode_funcs_t |
| 45 | */ |
| 46 | |
| 47 | typedef struct _hb_unicode_funcs_t hb_unicode_funcs_t; |
| 48 | |
Behdad Esfahbod | d4bee9f | 2011-04-27 09:24:37 -0400 | [diff] [blame] | 49 | |
| 50 | /* |
| 51 | * just give me the best implementation you've got there. |
| 52 | */ |
| 53 | hb_unicode_funcs_t * |
| 54 | hb_unicode_funcs_get_default (void); |
| 55 | |
| 56 | |
Behdad Esfahbod | 5c44188 | 2009-08-10 20:05:16 -0400 | [diff] [blame] | 57 | hb_unicode_funcs_t * |
Behdad Esfahbod | defc45b | 2011-05-10 20:02:49 -0400 | [diff] [blame] | 58 | hb_unicode_funcs_create (hb_unicode_funcs_t *parent); |
Behdad Esfahbod | 5c44188 | 2009-08-10 20:05:16 -0400 | [diff] [blame] | 59 | |
| 60 | hb_unicode_funcs_t * |
Behdad Esfahbod | 80a6833 | 2011-05-11 18:14:44 -0400 | [diff] [blame] | 61 | hb_unicode_funcs_get_empty (void); |
| 62 | |
| 63 | hb_unicode_funcs_t * |
Behdad Esfahbod | 5c44188 | 2009-08-10 20:05:16 -0400 | [diff] [blame] | 64 | hb_unicode_funcs_reference (hb_unicode_funcs_t *ufuncs); |
| 65 | |
Behdad Esfahbod | 5c44188 | 2009-08-10 20:05:16 -0400 | [diff] [blame] | 66 | void |
| 67 | hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs); |
| 68 | |
Behdad Esfahbod | 5fa849b | 2011-04-27 21:46:01 -0400 | [diff] [blame] | 69 | hb_bool_t |
| 70 | hb_unicode_funcs_set_user_data (hb_unicode_funcs_t *ufuncs, |
| 71 | hb_user_data_key_t *key, |
| 72 | void * data, |
Behdad Esfahbod | 33ccc77 | 2011-08-09 00:43:24 +0200 | [diff] [blame] | 73 | hb_destroy_func_t destroy, |
| 74 | hb_bool_t replace); |
Behdad Esfahbod | 5fa849b | 2011-04-27 21:46:01 -0400 | [diff] [blame] | 75 | |
| 76 | |
| 77 | void * |
| 78 | hb_unicode_funcs_get_user_data (hb_unicode_funcs_t *ufuncs, |
| 79 | hb_user_data_key_t *key); |
| 80 | |
| 81 | |
Behdad Esfahbod | eb27ec0 | 2009-08-10 23:25:28 -0400 | [diff] [blame] | 82 | void |
| 83 | hb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs); |
Behdad Esfahbod | 5c44188 | 2009-08-10 20:05:16 -0400 | [diff] [blame] | 84 | |
Behdad Esfahbod | 645f6f2 | 2010-10-04 17:01:01 -0400 | [diff] [blame] | 85 | hb_bool_t |
| 86 | hb_unicode_funcs_is_immutable (hb_unicode_funcs_t *ufuncs); |
Behdad Esfahbod | 5c44188 | 2009-08-10 20:05:16 -0400 | [diff] [blame] | 87 | |
Behdad Esfahbod | ecfb773 | 2011-04-20 01:34:51 -0400 | [diff] [blame] | 88 | hb_unicode_funcs_t * |
| 89 | hb_unicode_funcs_get_parent (hb_unicode_funcs_t *ufuncs); |
| 90 | |
| 91 | |
Behdad Esfahbod | 19c0eab | 2010-10-04 16:45:21 -0400 | [diff] [blame] | 92 | /* |
| 93 | * funcs |
| 94 | */ |
| 95 | |
Behdad Esfahbod | 19c0eab | 2010-10-04 16:45:21 -0400 | [diff] [blame] | 96 | /* typedefs */ |
Behdad Esfahbod | 5c44188 | 2009-08-10 20:05:16 -0400 | [diff] [blame] | 97 | |
Behdad Esfahbod | c464172 | 2011-07-07 23:47:19 -0400 | [diff] [blame] | 98 | typedef unsigned int (*hb_unicode_combining_class_func_t) (hb_unicode_funcs_t *ufuncs, |
Behdad Esfahbod | 446df9c | 2011-05-10 20:14:44 -0400 | [diff] [blame] | 99 | hb_codepoint_t unicode, |
| 100 | void *user_data); |
Behdad Esfahbod | c464172 | 2011-07-07 23:47:19 -0400 | [diff] [blame] | 101 | typedef unsigned int (*hb_unicode_eastasian_width_func_t) (hb_unicode_funcs_t *ufuncs, |
Behdad Esfahbod | 446df9c | 2011-05-10 20:14:44 -0400 | [diff] [blame] | 102 | hb_codepoint_t unicode, |
| 103 | void *user_data); |
Behdad Esfahbod | c464172 | 2011-07-07 23:47:19 -0400 | [diff] [blame] | 104 | typedef hb_unicode_general_category_t (*hb_unicode_general_category_func_t) (hb_unicode_funcs_t *ufuncs, |
Behdad Esfahbod | 446df9c | 2011-05-10 20:14:44 -0400 | [diff] [blame] | 105 | hb_codepoint_t unicode, |
| 106 | void *user_data); |
Behdad Esfahbod | c464172 | 2011-07-07 23:47:19 -0400 | [diff] [blame] | 107 | typedef hb_codepoint_t (*hb_unicode_mirroring_func_t) (hb_unicode_funcs_t *ufuncs, |
Behdad Esfahbod | 446df9c | 2011-05-10 20:14:44 -0400 | [diff] [blame] | 108 | hb_codepoint_t unicode, |
| 109 | void *user_data); |
Behdad Esfahbod | c464172 | 2011-07-07 23:47:19 -0400 | [diff] [blame] | 110 | typedef hb_script_t (*hb_unicode_script_func_t) (hb_unicode_funcs_t *ufuncs, |
Behdad Esfahbod | 446df9c | 2011-05-10 20:14:44 -0400 | [diff] [blame] | 111 | hb_codepoint_t unicode, |
| 112 | void *user_data); |
Behdad Esfahbod | 5c44188 | 2009-08-10 20:05:16 -0400 | [diff] [blame] | 113 | |
Behdad Esfahbod | c464172 | 2011-07-07 23:47:19 -0400 | [diff] [blame] | 114 | typedef hb_bool_t (*hb_unicode_compose_func_t) (hb_unicode_funcs_t *ufuncs, |
| 115 | hb_codepoint_t a, |
| 116 | hb_codepoint_t b, |
| 117 | hb_codepoint_t *ab, |
| 118 | void *user_data); |
| 119 | typedef hb_bool_t (*hb_unicode_decompose_func_t) (hb_unicode_funcs_t *ufuncs, |
| 120 | hb_codepoint_t ab, |
| 121 | hb_codepoint_t *a, |
| 122 | hb_codepoint_t *b, |
| 123 | void *user_data); |
| 124 | |
Behdad Esfahbod | 19c0eab | 2010-10-04 16:45:21 -0400 | [diff] [blame] | 125 | /* setters */ |
| 126 | |
Behdad Esfahbod | 5c44188 | 2009-08-10 20:05:16 -0400 | [diff] [blame] | 127 | void |
Behdad Esfahbod | 5c44188 | 2009-08-10 20:05:16 -0400 | [diff] [blame] | 128 | hb_unicode_funcs_set_combining_class_func (hb_unicode_funcs_t *ufuncs, |
Behdad Esfahbod | c464172 | 2011-07-07 23:47:19 -0400 | [diff] [blame] | 129 | hb_unicode_combining_class_func_t combining_class_func, |
Behdad Esfahbod | 446df9c | 2011-05-10 20:14:44 -0400 | [diff] [blame] | 130 | void *user_data, hb_destroy_func_t destroy); |
Behdad Esfahbod | 5c44188 | 2009-08-10 20:05:16 -0400 | [diff] [blame] | 131 | |
| 132 | void |
| 133 | hb_unicode_funcs_set_eastasian_width_func (hb_unicode_funcs_t *ufuncs, |
Behdad Esfahbod | c464172 | 2011-07-07 23:47:19 -0400 | [diff] [blame] | 134 | hb_unicode_eastasian_width_func_t eastasian_width_func, |
Behdad Esfahbod | 446df9c | 2011-05-10 20:14:44 -0400 | [diff] [blame] | 135 | void *user_data, hb_destroy_func_t destroy); |
Behdad Esfahbod | 19c0eab | 2010-10-04 16:45:21 -0400 | [diff] [blame] | 136 | |
Behdad Esfahbod | fb194b8 | 2011-04-20 02:00:47 -0400 | [diff] [blame] | 137 | void |
| 138 | hb_unicode_funcs_set_general_category_func (hb_unicode_funcs_t *ufuncs, |
Behdad Esfahbod | c464172 | 2011-07-07 23:47:19 -0400 | [diff] [blame] | 139 | hb_unicode_general_category_func_t general_category_func, |
Behdad Esfahbod | 446df9c | 2011-05-10 20:14:44 -0400 | [diff] [blame] | 140 | void *user_data, hb_destroy_func_t destroy); |
Behdad Esfahbod | fb194b8 | 2011-04-20 02:00:47 -0400 | [diff] [blame] | 141 | |
| 142 | void |
| 143 | hb_unicode_funcs_set_mirroring_func (hb_unicode_funcs_t *ufuncs, |
Behdad Esfahbod | c464172 | 2011-07-07 23:47:19 -0400 | [diff] [blame] | 144 | hb_unicode_mirroring_func_t mirroring_func, |
Behdad Esfahbod | 446df9c | 2011-05-10 20:14:44 -0400 | [diff] [blame] | 145 | void *user_data, hb_destroy_func_t destroy); |
Behdad Esfahbod | fb194b8 | 2011-04-20 02:00:47 -0400 | [diff] [blame] | 146 | |
| 147 | void |
| 148 | hb_unicode_funcs_set_script_func (hb_unicode_funcs_t *ufuncs, |
Behdad Esfahbod | c464172 | 2011-07-07 23:47:19 -0400 | [diff] [blame] | 149 | hb_unicode_script_func_t script_func, |
Behdad Esfahbod | 446df9c | 2011-05-10 20:14:44 -0400 | [diff] [blame] | 150 | void *user_data, hb_destroy_func_t destroy); |
Behdad Esfahbod | fb194b8 | 2011-04-20 02:00:47 -0400 | [diff] [blame] | 151 | |
Behdad Esfahbod | c464172 | 2011-07-07 23:47:19 -0400 | [diff] [blame] | 152 | void |
| 153 | hb_unicode_funcs_set_compose_func (hb_unicode_funcs_t *ufuncs, |
| 154 | hb_unicode_compose_func_t compose_func, |
| 155 | void *user_data, hb_destroy_func_t destroy); |
| 156 | |
| 157 | void |
| 158 | hb_unicode_funcs_set_decompose_func (hb_unicode_funcs_t *ufuncs, |
| 159 | hb_unicode_decompose_func_t decompose_func, |
| 160 | void *user_data, hb_destroy_func_t destroy); |
Behdad Esfahbod | fb194b8 | 2011-04-20 02:00:47 -0400 | [diff] [blame] | 161 | |
Behdad Esfahbod | 19c0eab | 2010-10-04 16:45:21 -0400 | [diff] [blame] | 162 | |
| 163 | /* accessors */ |
| 164 | |
Behdad Esfahbod | 5ceefa1 | 2009-12-20 15:29:16 +0100 | [diff] [blame] | 165 | unsigned int |
Behdad Esfahbod | c464172 | 2011-07-07 23:47:19 -0400 | [diff] [blame] | 166 | hb_unicode_combining_class (hb_unicode_funcs_t *ufuncs, |
| 167 | hb_codepoint_t unicode); |
Behdad Esfahbod | 5ceefa1 | 2009-12-20 15:29:16 +0100 | [diff] [blame] | 168 | |
| 169 | unsigned int |
Behdad Esfahbod | c464172 | 2011-07-07 23:47:19 -0400 | [diff] [blame] | 170 | hb_unicode_eastasian_width (hb_unicode_funcs_t *ufuncs, |
| 171 | hb_codepoint_t unicode); |
Behdad Esfahbod | 5ceefa1 | 2009-12-20 15:29:16 +0100 | [diff] [blame] | 172 | |
Behdad Esfahbod | fb194b8 | 2011-04-20 02:00:47 -0400 | [diff] [blame] | 173 | hb_unicode_general_category_t |
Behdad Esfahbod | c464172 | 2011-07-07 23:47:19 -0400 | [diff] [blame] | 174 | hb_unicode_general_category (hb_unicode_funcs_t *ufuncs, |
| 175 | hb_codepoint_t unicode); |
Behdad Esfahbod | fb194b8 | 2011-04-20 02:00:47 -0400 | [diff] [blame] | 176 | |
| 177 | hb_codepoint_t |
Behdad Esfahbod | c464172 | 2011-07-07 23:47:19 -0400 | [diff] [blame] | 178 | hb_unicode_mirroring (hb_unicode_funcs_t *ufuncs, |
| 179 | hb_codepoint_t unicode); |
Behdad Esfahbod | fb194b8 | 2011-04-20 02:00:47 -0400 | [diff] [blame] | 180 | |
| 181 | hb_script_t |
Behdad Esfahbod | c464172 | 2011-07-07 23:47:19 -0400 | [diff] [blame] | 182 | hb_unicode_script (hb_unicode_funcs_t *ufuncs, |
| 183 | hb_codepoint_t unicode); |
Behdad Esfahbod | fb194b8 | 2011-04-20 02:00:47 -0400 | [diff] [blame] | 184 | |
Behdad Esfahbod | c464172 | 2011-07-07 23:47:19 -0400 | [diff] [blame] | 185 | hb_bool_t |
| 186 | hb_unicode_compose (hb_unicode_funcs_t *ufuncs, |
| 187 | hb_codepoint_t a, |
| 188 | hb_codepoint_t b, |
| 189 | hb_codepoint_t *ab); |
| 190 | hb_bool_t |
| 191 | hb_unicode_decompose (hb_unicode_funcs_t *ufuncs, |
| 192 | hb_codepoint_t ab, |
| 193 | hb_codepoint_t *a, |
| 194 | hb_codepoint_t *b); |
Behdad Esfahbod | 5ceefa1 | 2009-12-20 15:29:16 +0100 | [diff] [blame] | 195 | |
Behdad Esfahbod | 5c44188 | 2009-08-10 20:05:16 -0400 | [diff] [blame] | 196 | HB_END_DECLS |
| 197 | |
Behdad Esfahbod | 214ac7c | 2009-11-04 18:12:32 -0500 | [diff] [blame] | 198 | #endif /* HB_UNICODE_H */ |