OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2009 Red Hat, Inc. | 2 * Copyright © 2009 Red Hat, Inc. |
3 * Copyright © 2009 Keith Stribley | 3 * Copyright © 2009 Keith Stribley |
4 * Copyright © 2011 Google, Inc. | 4 * Copyright © 2011 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 void *user_data HB_UNUSED) | 316 void *user_data HB_UNUSED) |
317 { | 317 { |
318 UChar utf16[2], normalized[2 * HB_UNICODE_MAX_DECOMPOSITION_LEN + 1]; | 318 UChar utf16[2], normalized[2 * HB_UNICODE_MAX_DECOMPOSITION_LEN + 1]; |
319 unsigned int len; | 319 unsigned int len; |
320 int32_t utf32_len; | 320 int32_t utf32_len; |
321 hb_bool_t err; | 321 hb_bool_t err; |
322 UErrorCode icu_err; | 322 UErrorCode icu_err; |
323 | 323 |
324 /* Copy @u into a UTF-16 array to be passed to ICU. */ | 324 /* Copy @u into a UTF-16 array to be passed to ICU. */ |
325 len = 0; | 325 len = 0; |
326 err = FALSE; | 326 err = false; |
327 U16_APPEND (utf16, len, ARRAY_LENGTH (utf16), u, err); | 327 U16_APPEND (utf16, len, ARRAY_LENGTH (utf16), u, err); |
328 if (err) | 328 if (err) |
329 return 0; | 329 return 0; |
330 | 330 |
331 /* Normalise the codepoint using NFKD mode. */ | 331 /* Normalise the codepoint using NFKD mode. */ |
332 icu_err = U_ZERO_ERROR; | 332 icu_err = U_ZERO_ERROR; |
333 len = unorm_normalize (utf16, len, UNORM_NFKD, 0, normalized, ARRAY_LENGTH (no
rmalized), &icu_err); | 333 len = unorm_normalize (utf16, len, UNORM_NFKD, 0, normalized, ARRAY_LENGTH (no
rmalized), &icu_err); |
334 if (icu_err) | 334 if (icu_err) |
335 return 0; | 335 return 0; |
336 | 336 |
(...skipping 26 matching lines...) Expand all Loading... |
363 if (!hb_atomic_ptr_get (&normalizer)) { | 363 if (!hb_atomic_ptr_get (&normalizer)) { |
364 UErrorCode icu_err = U_ZERO_ERROR; | 364 UErrorCode icu_err = U_ZERO_ERROR; |
365 /* We ignore failure in getNFCInstace(). */ | 365 /* We ignore failure in getNFCInstace(). */ |
366 hb_atomic_ptr_cmpexch (&normalizer, NULL, unorm2_getNFCInstance (&icu_err)); | 366 hb_atomic_ptr_cmpexch (&normalizer, NULL, unorm2_getNFCInstance (&icu_err)); |
367 } | 367 } |
368 #endif | 368 #endif |
369 return const_cast<hb_unicode_funcs_t *> (&_hb_icu_unicode_funcs); | 369 return const_cast<hb_unicode_funcs_t *> (&_hb_icu_unicode_funcs); |
370 } | 370 } |
371 | 371 |
372 | 372 |
OLD | NEW |