| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright © 2009,2010 Red Hat, Inc. | 2 * Copyright © 2009,2010 Red Hat, Inc. |
| 3 * Copyright © 2011,2012 Google, Inc. | 3 * Copyright © 2011,2012 Google, Inc. |
| 4 * | 4 * |
| 5 * This is part of HarfBuzz, a text shaping library. | 5 * This is part of HarfBuzz, a text shaping library. |
| 6 * | 6 * |
| 7 * Permission is hereby granted, without written agreement and without | 7 * Permission is hereby granted, without written agreement and without |
| 8 * license or royalty fees, to use, copy, modify, and distribute this | 8 * license or royalty fees, to use, copy, modify, and distribute this |
| 9 * software and its documentation for any purpose, provided that the | 9 * software and its documentation for any purpose, provided that the |
| 10 * above copyright notice and the following two paragraphs appear in | 10 * above copyright notice and the following two paragraphs appear in |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 hb_language_t | 292 hb_language_t |
| 293 hb_language_from_string (const char *str, int len) | 293 hb_language_from_string (const char *str, int len) |
| 294 { | 294 { |
| 295 char strbuf[64]; | 295 char strbuf[64]; |
| 296 | 296 |
| 297 if (!str || !len || !*str) | 297 if (!str || !len || !*str) |
| 298 return HB_LANGUAGE_INVALID; | 298 return HB_LANGUAGE_INVALID; |
| 299 | 299 |
| 300 if (len >= 0) | 300 if (len >= 0) |
| 301 { | 301 { |
| 302 /* NUL-terminate it. */ |
| 302 len = MIN (len, (int) sizeof (strbuf) - 1); | 303 len = MIN (len, (int) sizeof (strbuf) - 1); |
| 303 str = (char *) memcpy (strbuf, str, len); | 304 memcpy (strbuf, str, len); |
| 304 strbuf[len] = '\0'; | 305 strbuf[len] = '\0'; |
| 306 str = strbuf; |
| 305 } | 307 } |
| 306 | 308 |
| 307 hb_language_item_t *item = lang_find_or_insert (str); | 309 hb_language_item_t *item = lang_find_or_insert (str); |
| 308 | 310 |
| 309 return likely (item) ? item->lang : HB_LANGUAGE_INVALID; | 311 return likely (item) ? item->lang : HB_LANGUAGE_INVALID; |
| 310 } | 312 } |
| 311 | 313 |
| 312 /** | 314 /** |
| 313 * hb_language_to_string: | 315 * hb_language_to_string: |
| 314 * @language: | 316 * @language: |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 * | 364 * |
| 363 * Since: 1.0 | 365 * Since: 1.0 |
| 364 **/ | 366 **/ |
| 365 hb_script_t | 367 hb_script_t |
| 366 hb_script_from_iso15924_tag (hb_tag_t tag) | 368 hb_script_from_iso15924_tag (hb_tag_t tag) |
| 367 { | 369 { |
| 368 if (unlikely (tag == HB_TAG_NONE)) | 370 if (unlikely (tag == HB_TAG_NONE)) |
| 369 return HB_SCRIPT_INVALID; | 371 return HB_SCRIPT_INVALID; |
| 370 | 372 |
| 371 /* Be lenient, adjust case (one capital letter followed by three small letters
) */ | 373 /* Be lenient, adjust case (one capital letter followed by three small letters
) */ |
| 372 tag = (tag & 0xDFDFDFDF) | 0x00202020; | 374 tag = (tag & 0xDFDFDFDFu) | 0x00202020u; |
| 373 | 375 |
| 374 switch (tag) { | 376 switch (tag) { |
| 375 | 377 |
| 376 /* These graduated from the 'Q' private-area codes, but | 378 /* These graduated from the 'Q' private-area codes, but |
| 377 * the old code is still aliased by Unicode, and the Qaai | 379 * the old code is still aliased by Unicode, and the Qaai |
| 378 * one in use by ICU. */ | 380 * one in use by ICU. */ |
| 379 case HB_TAG('Q','a','a','i'): return HB_SCRIPT_INHERITED; | 381 case HB_TAG('Q','a','a','i'): return HB_SCRIPT_INHERITED; |
| 380 case HB_TAG('Q','a','a','c'): return HB_SCRIPT_COPTIC; | 382 case HB_TAG('Q','a','a','c'): return HB_SCRIPT_COPTIC; |
| 381 | 383 |
| 382 /* Script variants from http://unicode.org/iso15924/ */ | 384 /* Script variants from http://unicode.org/iso15924/ */ |
| 383 case HB_TAG('C','y','r','s'): return HB_SCRIPT_CYRILLIC; | 385 case HB_TAG('C','y','r','s'): return HB_SCRIPT_CYRILLIC; |
| 384 case HB_TAG('L','a','t','f'): return HB_SCRIPT_LATIN; | 386 case HB_TAG('L','a','t','f'): return HB_SCRIPT_LATIN; |
| 385 case HB_TAG('L','a','t','g'): return HB_SCRIPT_LATIN; | 387 case HB_TAG('L','a','t','g'): return HB_SCRIPT_LATIN; |
| 386 case HB_TAG('S','y','r','e'): return HB_SCRIPT_SYRIAC; | 388 case HB_TAG('S','y','r','e'): return HB_SCRIPT_SYRIAC; |
| 387 case HB_TAG('S','y','r','j'): return HB_SCRIPT_SYRIAC; | 389 case HB_TAG('S','y','r','j'): return HB_SCRIPT_SYRIAC; |
| 388 case HB_TAG('S','y','r','n'): return HB_SCRIPT_SYRIAC; | 390 case HB_TAG('S','y','r','n'): return HB_SCRIPT_SYRIAC; |
| 389 } | 391 } |
| 390 | 392 |
| 391 /* If it looks right, just use the tag as a script */ | 393 /* If it looks right, just use the tag as a script */ |
| 392 if (((uint32_t) tag & 0xE0E0E0E0) == 0x40606060) | 394 if (((uint32_t) tag & 0xE0E0E0E0u) == 0x40606060u) |
| 393 return (hb_script_t) tag; | 395 return (hb_script_t) tag; |
| 394 | 396 |
| 395 /* Otherwise, return unknown */ | 397 /* Otherwise, return unknown */ |
| 396 return HB_SCRIPT_UNKNOWN; | 398 return HB_SCRIPT_UNKNOWN; |
| 397 } | 399 } |
| 398 | 400 |
| 399 /** | 401 /** |
| 400 * hb_script_from_string: | 402 * hb_script_from_string: |
| 401 * @s: (array length=len): | 403 * @s: (array length=len): |
| 402 * @len: | 404 * @len: |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 case HB_SCRIPT_OLD_TURKIC: | 477 case HB_SCRIPT_OLD_TURKIC: |
| 476 case HB_SCRIPT_SAMARITAN: | 478 case HB_SCRIPT_SAMARITAN: |
| 477 | 479 |
| 478 /* Unicode-6.0 additions */ | 480 /* Unicode-6.0 additions */ |
| 479 case HB_SCRIPT_MANDAIC: | 481 case HB_SCRIPT_MANDAIC: |
| 480 | 482 |
| 481 /* Unicode-6.1 additions */ | 483 /* Unicode-6.1 additions */ |
| 482 case HB_SCRIPT_MEROITIC_CURSIVE: | 484 case HB_SCRIPT_MEROITIC_CURSIVE: |
| 483 case HB_SCRIPT_MEROITIC_HIEROGLYPHS: | 485 case HB_SCRIPT_MEROITIC_HIEROGLYPHS: |
| 484 | 486 |
| 487 /* Unicode-7.0 additions */ |
| 488 case HB_SCRIPT_MANICHAEAN: |
| 489 case HB_SCRIPT_MENDE_KIKAKUI: |
| 490 case HB_SCRIPT_NABATAEAN: |
| 491 case HB_SCRIPT_OLD_NORTH_ARABIAN: |
| 492 case HB_SCRIPT_PALMYRENE: |
| 493 case HB_SCRIPT_PSALTER_PAHLAVI: |
| 494 |
| 485 return HB_DIRECTION_RTL; | 495 return HB_DIRECTION_RTL; |
| 486 } | 496 } |
| 487 | 497 |
| 488 return HB_DIRECTION_LTR; | 498 return HB_DIRECTION_LTR; |
| 489 } | 499 } |
| 490 | 500 |
| 491 | 501 |
| 492 /* hb_user_data_array_t */ | 502 /* hb_user_data_array_t */ |
| 493 | 503 |
| 494 bool | 504 bool |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 * | 562 * |
| 553 * Since: 1.0 | 563 * Since: 1.0 |
| 554 **/ | 564 **/ |
| 555 const char * | 565 const char * |
| 556 hb_version_string (void) | 566 hb_version_string (void) |
| 557 { | 567 { |
| 558 return HB_VERSION_STRING; | 568 return HB_VERSION_STRING; |
| 559 } | 569 } |
| 560 | 570 |
| 561 /** | 571 /** |
| 562 * hb_version_check: | 572 * hb_version_atleast: |
| 563 * @major: | 573 * @major: |
| 564 * @minor: | 574 * @minor: |
| 565 * @micro: | 575 * @micro: |
| 566 * | 576 * |
| 567 * | 577 * |
| 568 * | 578 * |
| 569 * Return value: | 579 * Return value: |
| 570 * | 580 * |
| 571 * Since: 1.0 | 581 * Since: 1.0 |
| 572 **/ | 582 **/ |
| 573 hb_bool_t | 583 hb_bool_t |
| 574 hb_version_check (unsigned int major, | 584 hb_version_atleast (unsigned int major, |
| 575 » » unsigned int minor, | 585 » » unsigned int minor, |
| 576 » » unsigned int micro) | 586 » » unsigned int micro) |
| 577 { | 587 { |
| 578 return HB_VERSION_CHECK (major, minor, micro); | 588 return HB_VERSION_ATLEAST (major, minor, micro); |
| 579 } | 589 } |
| OLD | NEW |