| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright © 2009 Red Hat, Inc. | 2 * Copyright © 2009 Red Hat, Inc. |
| 3 * Copyright © 2011 Codethink Limited | 3 * Copyright © 2011 Codethink Limited |
| 4 * Copyright © 2010,2011,2012 Google, Inc. | 4 * Copyright © 2010,2011,2012 Google, Inc. |
| 5 * | 5 * |
| 6 * This is part of HarfBuzz, a text shaping library. | 6 * This is part of HarfBuzz, a text shaping library. |
| 7 * | 7 * |
| 8 * Permission is hereby granted, without written agreement and without | 8 * Permission is hereby granted, without written agreement and without |
| 9 * license or royalty fees, to use, copy, modify, and distribute this | 9 * license or royalty fees, to use, copy, modify, and distribute this |
| 10 * software and its documentation for any purpose, provided that the | 10 * software and its documentation for any purpose, provided that the |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 #endif | 143 #endif |
| 144 | 144 |
| 145 #undef HB_UNICODE_FUNCS_IMPLEMENT | 145 #undef HB_UNICODE_FUNCS_IMPLEMENT |
| 146 } | 146 } |
| 147 | 147 |
| 148 #if !defined(HB_NO_UNICODE_FUNCS) && defined(HB_UNICODE_FUNCS_NIL) | 148 #if !defined(HB_NO_UNICODE_FUNCS) && defined(HB_UNICODE_FUNCS_NIL) |
| 149 #pragma message("Could not find any Unicode functions implementation, you have t
o provide your own.") | 149 #pragma message("Could not find any Unicode functions implementation, you have t
o provide your own.") |
| 150 #pragma message("To suppress this warnings, define HB_NO_UNICODE_FUNCS.") | 150 #pragma message("To suppress this warnings, define HB_NO_UNICODE_FUNCS.") |
| 151 #endif | 151 #endif |
| 152 | 152 |
| 153 /** |
| 154 * hb_unicode_funcs_create: (Xconstructor) |
| 155 * @parent: (allow-none): |
| 156 * |
| 157 * |
| 158 * |
| 159 * Return value: (transfer full): |
| 160 * |
| 161 * Since: 1.0 |
| 162 **/ |
| 153 hb_unicode_funcs_t * | 163 hb_unicode_funcs_t * |
| 154 hb_unicode_funcs_create (hb_unicode_funcs_t *parent) | 164 hb_unicode_funcs_create (hb_unicode_funcs_t *parent) |
| 155 { | 165 { |
| 156 hb_unicode_funcs_t *ufuncs; | 166 hb_unicode_funcs_t *ufuncs; |
| 157 | 167 |
| 158 if (!(ufuncs = hb_object_create<hb_unicode_funcs_t> ())) | 168 if (!(ufuncs = hb_object_create<hb_unicode_funcs_t> ())) |
| 159 return hb_unicode_funcs_get_empty (); | 169 return hb_unicode_funcs_get_empty (); |
| 160 | 170 |
| 161 if (!parent) | 171 if (!parent) |
| 162 parent = hb_unicode_funcs_get_empty (); | 172 parent = hb_unicode_funcs_get_empty (); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 180 | 190 |
| 181 NULL, /* parent */ | 191 NULL, /* parent */ |
| 182 true, /* immutable */ | 192 true, /* immutable */ |
| 183 { | 193 { |
| 184 #define HB_UNICODE_FUNC_IMPLEMENT(name) hb_unicode_##name##_nil, | 194 #define HB_UNICODE_FUNC_IMPLEMENT(name) hb_unicode_##name##_nil, |
| 185 HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS | 195 HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS |
| 186 #undef HB_UNICODE_FUNC_IMPLEMENT | 196 #undef HB_UNICODE_FUNC_IMPLEMENT |
| 187 } | 197 } |
| 188 }; | 198 }; |
| 189 | 199 |
| 200 /** |
| 201 * hb_unicode_funcs_get_empty: |
| 202 * |
| 203 * |
| 204 * |
| 205 * Return value: (transfer full): |
| 206 * |
| 207 * Since: 1.0 |
| 208 **/ |
| 190 hb_unicode_funcs_t * | 209 hb_unicode_funcs_t * |
| 191 hb_unicode_funcs_get_empty (void) | 210 hb_unicode_funcs_get_empty (void) |
| 192 { | 211 { |
| 193 return const_cast<hb_unicode_funcs_t *> (&_hb_unicode_funcs_nil); | 212 return const_cast<hb_unicode_funcs_t *> (&_hb_unicode_funcs_nil); |
| 194 } | 213 } |
| 195 | 214 |
| 215 /** |
| 216 * hb_unicode_funcs_reference: (skip) |
| 217 * @ufuncs: Unicode functions. |
| 218 * |
| 219 * |
| 220 * |
| 221 * Return value: (transfer full): |
| 222 * |
| 223 * Since: 1.0 |
| 224 **/ |
| 196 hb_unicode_funcs_t * | 225 hb_unicode_funcs_t * |
| 197 hb_unicode_funcs_reference (hb_unicode_funcs_t *ufuncs) | 226 hb_unicode_funcs_reference (hb_unicode_funcs_t *ufuncs) |
| 198 { | 227 { |
| 199 return hb_object_reference (ufuncs); | 228 return hb_object_reference (ufuncs); |
| 200 } | 229 } |
| 201 | 230 |
| 231 /** |
| 232 * hb_unicode_funcs_destroy: (skip) |
| 233 * @ufuncs: Unicode functions. |
| 234 * |
| 235 * |
| 236 * |
| 237 * Since: 1.0 |
| 238 **/ |
| 202 void | 239 void |
| 203 hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs) | 240 hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs) |
| 204 { | 241 { |
| 205 if (!hb_object_destroy (ufuncs)) return; | 242 if (!hb_object_destroy (ufuncs)) return; |
| 206 | 243 |
| 207 #define HB_UNICODE_FUNC_IMPLEMENT(name) \ | 244 #define HB_UNICODE_FUNC_IMPLEMENT(name) \ |
| 208 if (ufuncs->destroy.name) ufuncs->destroy.name (ufuncs->user_data.name); | 245 if (ufuncs->destroy.name) ufuncs->destroy.name (ufuncs->user_data.name); |
| 209 HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS | 246 HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS |
| 210 #undef HB_UNICODE_FUNC_IMPLEMENT | 247 #undef HB_UNICODE_FUNC_IMPLEMENT |
| 211 | 248 |
| 212 hb_unicode_funcs_destroy (ufuncs->parent); | 249 hb_unicode_funcs_destroy (ufuncs->parent); |
| 213 | 250 |
| 214 free (ufuncs); | 251 free (ufuncs); |
| 215 } | 252 } |
| 216 | 253 |
| 254 /** |
| 255 * hb_unicode_funcs_set_user_data: (skip) |
| 256 * @ufuncs: Unicode functions. |
| 257 * @key: |
| 258 * @data: |
| 259 * @destroy: |
| 260 * @replace: |
| 261 * |
| 262 * |
| 263 * |
| 264 * Return value: |
| 265 * |
| 266 * Since: 1.0 |
| 267 **/ |
| 217 hb_bool_t | 268 hb_bool_t |
| 218 hb_unicode_funcs_set_user_data (hb_unicode_funcs_t *ufuncs, | 269 hb_unicode_funcs_set_user_data (hb_unicode_funcs_t *ufuncs, |
| 219 hb_user_data_key_t *key, | 270 hb_user_data_key_t *key, |
| 220 void * data, | 271 void * data, |
| 221 hb_destroy_func_t destroy, | 272 hb_destroy_func_t destroy, |
| 222 hb_bool_t replace) | 273 hb_bool_t replace) |
| 223 { | 274 { |
| 224 return hb_object_set_user_data (ufuncs, key, data, destroy, replace); | 275 return hb_object_set_user_data (ufuncs, key, data, destroy, replace); |
| 225 } | 276 } |
| 226 | 277 |
| 278 /** |
| 279 * hb_unicode_funcs_get_user_data: (skip) |
| 280 * @ufuncs: Unicode functions. |
| 281 * @key: |
| 282 * |
| 283 * |
| 284 * |
| 285 * Return value: (transfer none): |
| 286 * |
| 287 * Since: 1.0 |
| 288 **/ |
| 227 void * | 289 void * |
| 228 hb_unicode_funcs_get_user_data (hb_unicode_funcs_t *ufuncs, | 290 hb_unicode_funcs_get_user_data (hb_unicode_funcs_t *ufuncs, |
| 229 hb_user_data_key_t *key) | 291 hb_user_data_key_t *key) |
| 230 { | 292 { |
| 231 return hb_object_get_user_data (ufuncs, key); | 293 return hb_object_get_user_data (ufuncs, key); |
| 232 } | 294 } |
| 233 | 295 |
| 234 | 296 |
| 297 /** |
| 298 * hb_unicode_funcs_make_immutable: |
| 299 * @ufuncs: Unicode functions. |
| 300 * |
| 301 * |
| 302 * |
| 303 * Since: 1.0 |
| 304 **/ |
| 235 void | 305 void |
| 236 hb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs) | 306 hb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs) |
| 237 { | 307 { |
| 238 if (hb_object_is_inert (ufuncs)) | 308 if (hb_object_is_inert (ufuncs)) |
| 239 return; | 309 return; |
| 240 | 310 |
| 241 ufuncs->immutable = true; | 311 ufuncs->immutable = true; |
| 242 } | 312 } |
| 243 | 313 |
| 314 /** |
| 315 * hb_unicode_funcs_is_immutable: |
| 316 * @ufuncs: Unicode functions. |
| 317 * |
| 318 * |
| 319 * |
| 320 * Return value: |
| 321 * |
| 322 * Since: 1.0 |
| 323 **/ |
| 244 hb_bool_t | 324 hb_bool_t |
| 245 hb_unicode_funcs_is_immutable (hb_unicode_funcs_t *ufuncs) | 325 hb_unicode_funcs_is_immutable (hb_unicode_funcs_t *ufuncs) |
| 246 { | 326 { |
| 247 return ufuncs->immutable; | 327 return ufuncs->immutable; |
| 248 } | 328 } |
| 249 | 329 |
| 330 /** |
| 331 * hb_unicode_funcs_get_parent: |
| 332 * @ufuncs: Unicode functions. |
| 333 * |
| 334 * |
| 335 * |
| 336 * Return value: |
| 337 * |
| 338 * Since: 1.0 |
| 339 **/ |
| 250 hb_unicode_funcs_t * | 340 hb_unicode_funcs_t * |
| 251 hb_unicode_funcs_get_parent (hb_unicode_funcs_t *ufuncs) | 341 hb_unicode_funcs_get_parent (hb_unicode_funcs_t *ufuncs) |
| 252 { | 342 { |
| 253 return ufuncs->parent ? ufuncs->parent : hb_unicode_funcs_get_empty (); | 343 return ufuncs->parent ? ufuncs->parent : hb_unicode_funcs_get_empty (); |
| 254 } | 344 } |
| 255 | 345 |
| 256 | 346 |
| 257 #define HB_UNICODE_FUNC_IMPLEMENT(name)
\ | 347 #define HB_UNICODE_FUNC_IMPLEMENT(name)
\ |
| 258
\ | 348
\ |
| 259 void
\ | 349 void
\ |
| (...skipping 27 matching lines...) Expand all Loading... |
| 287
\ | 377
\ |
| 288 return_type
\ | 378 return_type
\ |
| 289 hb_unicode_##name (hb_unicode_funcs_t *ufuncs,
\ | 379 hb_unicode_##name (hb_unicode_funcs_t *ufuncs,
\ |
| 290 hb_codepoint_t unicode)
\ | 380 hb_codepoint_t unicode)
\ |
| 291 {
\ | 381 {
\ |
| 292 return ufuncs->name (unicode);
\ | 382 return ufuncs->name (unicode);
\ |
| 293 } | 383 } |
| 294 HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE | 384 HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE |
| 295 #undef HB_UNICODE_FUNC_IMPLEMENT | 385 #undef HB_UNICODE_FUNC_IMPLEMENT |
| 296 | 386 |
| 387 /** |
| 388 * hb_unicode_compose: |
| 389 * @ufuncs: Unicode functions. |
| 390 * @a: |
| 391 * @b: |
| 392 * @ab: (out): |
| 393 * |
| 394 * |
| 395 * |
| 396 * Return value: |
| 397 * |
| 398 * Since: 1.0 |
| 399 **/ |
| 297 hb_bool_t | 400 hb_bool_t |
| 298 hb_unicode_compose (hb_unicode_funcs_t *ufuncs, | 401 hb_unicode_compose (hb_unicode_funcs_t *ufuncs, |
| 299 hb_codepoint_t a, | 402 hb_codepoint_t a, |
| 300 hb_codepoint_t b, | 403 hb_codepoint_t b, |
| 301 hb_codepoint_t *ab) | 404 hb_codepoint_t *ab) |
| 302 { | 405 { |
| 303 return ufuncs->compose (a, b, ab); | 406 return ufuncs->compose (a, b, ab); |
| 304 } | 407 } |
| 305 | 408 |
| 409 /** |
| 410 * hb_unicode_decompose: |
| 411 * @ufuncs: Unicode functions. |
| 412 * @ab: |
| 413 * @a: (out): |
| 414 * @b: (out): |
| 415 * |
| 416 * |
| 417 * |
| 418 * Return value: |
| 419 * |
| 420 * Since: 1.0 |
| 421 **/ |
| 306 hb_bool_t | 422 hb_bool_t |
| 307 hb_unicode_decompose (hb_unicode_funcs_t *ufuncs, | 423 hb_unicode_decompose (hb_unicode_funcs_t *ufuncs, |
| 308 hb_codepoint_t ab, | 424 hb_codepoint_t ab, |
| 309 hb_codepoint_t *a, | 425 hb_codepoint_t *a, |
| 310 hb_codepoint_t *b) | 426 hb_codepoint_t *b) |
| 311 { | 427 { |
| 312 return ufuncs->decompose (ab, a, b); | 428 return ufuncs->decompose (ab, a, b); |
| 313 } | 429 } |
| 314 | 430 |
| 431 /** |
| 432 * hb_unicode_decompose_compatibility: |
| 433 * @ufuncs: Unicode functions. |
| 434 * @u: |
| 435 * @decomposed: (out): |
| 436 * |
| 437 * |
| 438 * |
| 439 * Return value: |
| 440 * |
| 441 * Since: 1.0 |
| 442 **/ |
| 315 unsigned int | 443 unsigned int |
| 316 hb_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs, | 444 hb_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs, |
| 317 hb_codepoint_t u, | 445 hb_codepoint_t u, |
| 318 hb_codepoint_t *decomposed) | 446 hb_codepoint_t *decomposed) |
| 319 { | 447 { |
| 320 return ufuncs->decompose_compatibility (u, decomposed); | 448 return ufuncs->decompose_compatibility (u, decomposed); |
| 321 } | 449 } |
| 322 | 450 |
| 323 | 451 |
| 324 /* See hb-unicode-private.hh for details. */ | 452 /* See hb-unicode-private.hh for details. */ |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 230, /* HB_UNICODE_COMBINING_CLASS_ABOVE */ | 554 230, /* HB_UNICODE_COMBINING_CLASS_ABOVE */ |
| 427 231, | 555 231, |
| 428 232, /* HB_UNICODE_COMBINING_CLASS_ABOVE_RIGHT */ | 556 232, /* HB_UNICODE_COMBINING_CLASS_ABOVE_RIGHT */ |
| 429 233, /* HB_UNICODE_COMBINING_CLASS_DOUBLE_BELOW */ | 557 233, /* HB_UNICODE_COMBINING_CLASS_DOUBLE_BELOW */ |
| 430 234, /* HB_UNICODE_COMBINING_CLASS_DOUBLE_ABOVE */ | 558 234, /* HB_UNICODE_COMBINING_CLASS_DOUBLE_ABOVE */ |
| 431 235, 236, 237, 238, 239, | 559 235, 236, 237, 238, 239, |
| 432 240, /* HB_UNICODE_COMBINING_CLASS_IOTA_SUBSCRIPT */ | 560 240, /* HB_UNICODE_COMBINING_CLASS_IOTA_SUBSCRIPT */ |
| 433 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, | 561 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, |
| 434 255, /* HB_UNICODE_COMBINING_CLASS_INVALID */ | 562 255, /* HB_UNICODE_COMBINING_CLASS_INVALID */ |
| 435 }; | 563 }; |
| OLD | NEW |