Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: third_party/harfbuzz-ng/src/hb-uniscribe.cc

Issue 396393005: Roll HarfBuzz to 0.9.32 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for include order presubmit issue Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright © 2011,2012,2013 Google, Inc. 2 * Copyright © 2011,2012,2013 Google, Inc.
3 * 3 *
4 * This is part of HarfBuzz, a text shaping library. 4 * This is part of HarfBuzz, a text shaping library.
5 * 5 *
6 * Permission is hereby granted, without written agreement and without 6 * Permission is hereby granted, without written agreement and without
7 * license or royalty fees, to use, copy, modify, and distribute this 7 * license or royalty fees, to use, copy, modify, and distribute this
8 * software and its documentation for any purpose, provided that the 8 * software and its documentation for any purpose, provided that the
9 * above copyright notice and the following two paragraphs appear in 9 * above copyright notice and the following two paragraphs appear in
10 * all copies of this software. 10 * all copies of this software.
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 372
373 OT::name &name = OT::StructAtOffset<OT::name> (new_sfnt_data, name_table_offse t); 373 OT::name &name = OT::StructAtOffset<OT::name> (new_sfnt_data, name_table_offse t);
374 name.format.set (0); 374 name.format.set (0);
375 name.count.set (ARRAY_LENGTH (name_IDs)); 375 name.count.set (ARRAY_LENGTH (name_IDs));
376 name.stringOffset.set (name.get_size ()); 376 name.stringOffset.set (name.get_size ());
377 for (unsigned int i = 0; i < ARRAY_LENGTH (name_IDs); i++) 377 for (unsigned int i = 0; i < ARRAY_LENGTH (name_IDs); i++)
378 { 378 {
379 OT::NameRecord &record = name.nameRecord[i]; 379 OT::NameRecord &record = name.nameRecord[i];
380 record.platformID.set (3); 380 record.platformID.set (3);
381 record.encodingID.set (1); 381 record.encodingID.set (1);
382 record.languageID.set (0x0409); /* English */ 382 record.languageID.set (0x0409u); /* English */
383 record.nameID.set (name_IDs[i]); 383 record.nameID.set (name_IDs[i]);
384 record.length.set (name_str_len * 2); 384 record.length.set (name_str_len * 2);
385 record.offset.set (0); 385 record.offset.set (0);
386 } 386 }
387 387
388 /* Copy string data from new_name, converting wchar_t to UTF16BE. */ 388 /* Copy string data from new_name, converting wchar_t to UTF16BE. */
389 unsigned char *p = &OT::StructAfter<unsigned char> (name); 389 unsigned char *p = &OT::StructAfter<unsigned char> (name);
390 for (unsigned int i = 0; i < name_str_len; i++) 390 for (unsigned int i = 0; i < name_str_len; i++)
391 { 391 {
392 *p++ = new_name[i] >> 8; 392 *p++ = new_name[i] >> 8;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 event->start = true; 624 event->start = true;
625 event->feature = feature; 625 event->feature = feature;
626 626
627 event = feature_events.push (); 627 event = feature_events.push ();
628 if (unlikely (!event)) 628 if (unlikely (!event))
629 goto fail_features; 629 goto fail_features;
630 event->index = features[i].end; 630 event->index = features[i].end;
631 event->start = false; 631 event->start = false;
632 event->feature = feature; 632 event->feature = feature;
633 } 633 }
634 feature_events.sort (); 634 feature_events.qsort ();
635 /* Add a strategic final event. */ 635 /* Add a strategic final event. */
636 { 636 {
637 active_feature_t feature; 637 active_feature_t feature;
638 feature.rec.tagFeature = 0; 638 feature.rec.tagFeature = 0;
639 feature.rec.lParameter = 0; 639 feature.rec.lParameter = 0;
640 feature.order = num_features + 1; 640 feature.order = num_features + 1;
641 641
642 feature_event_t *event = feature_events.push (); 642 feature_event_t *event = feature_events.push ();
643 if (unlikely (!event)) 643 if (unlikely (!event))
644 goto fail_features; 644 goto fail_features;
(...skipping 11 matching lines...) Expand all
656 656
657 if (event->index != last_index) 657 if (event->index != last_index)
658 { 658 {
659 /* Save a snapshot of active features and the range. */ 659 /* Save a snapshot of active features and the range. */
660 range_record_t *range = range_records.push (); 660 range_record_t *range = range_records.push ();
661 if (unlikely (!range)) 661 if (unlikely (!range))
662 goto fail_features; 662 goto fail_features;
663 663
664 unsigned int offset = feature_records.len; 664 unsigned int offset = feature_records.len;
665 665
666 » active_features.sort (); 666 » active_features.qsort ();
667 for (unsigned int j = 0; j < active_features.len; j++) 667 for (unsigned int j = 0; j < active_features.len; j++)
668 { 668 {
669 if (!j || active_features[j].rec.tagFeature != feature_records[feature _records.len - 1].tagFeature) 669 if (!j || active_features[j].rec.tagFeature != feature_records[feature _records.len - 1].tagFeature)
670 { 670 {
671 OPENTYPE_FEATURE_RECORD *feature = feature_records.push (); 671 OPENTYPE_FEATURE_RECORD *feature = feature_records.push ();
672 if (unlikely (!feature)) 672 if (unlikely (!feature))
673 goto fail_features; 673 goto fail_features;
674 *feature = active_features[j].rec; 674 *feature = active_features[j].rec;
675 } 675 }
676 else 676 else
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 742
743 #define utf16_index() var1.u32 743 #define utf16_index() var1.u32
744 744
745 ALLOCATE_ARRAY (WCHAR, pchars, buffer->len * 2); 745 ALLOCATE_ARRAY (WCHAR, pchars, buffer->len * 2);
746 746
747 unsigned int chars_len = 0; 747 unsigned int chars_len = 0;
748 for (unsigned int i = 0; i < buffer->len; i++) 748 for (unsigned int i = 0; i < buffer->len; i++)
749 { 749 {
750 hb_codepoint_t c = buffer->info[i].codepoint; 750 hb_codepoint_t c = buffer->info[i].codepoint;
751 buffer->info[i].utf16_index() = chars_len; 751 buffer->info[i].utf16_index() = chars_len;
752 if (likely (c < 0x10000)) 752 if (likely (c <= 0xFFFFu))
753 pchars[chars_len++] = c; 753 pchars[chars_len++] = c;
754 else if (unlikely (c >= 0x110000)) 754 else if (unlikely (c > 0x10FFFFu))
755 pchars[chars_len++] = 0xFFFD; 755 pchars[chars_len++] = 0xFFFDu;
756 else { 756 else {
757 pchars[chars_len++] = 0xD800 + ((c - 0x10000) >> 10); 757 pchars[chars_len++] = 0xD800u + ((c - 0x10000u) >> 10);
758 pchars[chars_len++] = 0xDC00 + ((c - 0x10000) & ((1 << 10) - 1)); 758 pchars[chars_len++] = 0xDC00u + ((c - 0x10000u) & ((1 << 10) - 1));
759 } 759 }
760 } 760 }
761 761
762 ALLOCATE_ARRAY (WORD, log_clusters, chars_len); 762 ALLOCATE_ARRAY (WORD, log_clusters, chars_len);
763 ALLOCATE_ARRAY (SCRIPT_CHARPROP, char_props, chars_len); 763 ALLOCATE_ARRAY (SCRIPT_CHARPROP, char_props, chars_len);
764 764
765 if (num_features) 765 if (num_features)
766 { 766 {
767 /* Need log_clusters to assign features. */ 767 /* Need log_clusters to assign features. */
768 chars_len = 0; 768 chars_len = 0;
769 for (unsigned int i = 0; i < buffer->len; i++) 769 for (unsigned int i = 0; i < buffer->len; i++)
770 { 770 {
771 hb_codepoint_t c = buffer->info[i].codepoint; 771 hb_codepoint_t c = buffer->info[i].codepoint;
772 unsigned int cluster = buffer->info[i].cluster; 772 unsigned int cluster = buffer->info[i].cluster;
773 log_clusters[chars_len++] = cluster; 773 log_clusters[chars_len++] = cluster;
774 if (c >= 0x10000 && c < 0x110000) 774 if (hb_in_range (c, 0x10000u, 0x10FFFFu))
775 log_clusters[chars_len++] = cluster; /* Surrogates. */ 775 log_clusters[chars_len++] = cluster; /* Surrogates. */
776 } 776 }
777 } 777 }
778 778
779 /* The -2 in the following is to compensate for possible 779 /* The -2 in the following is to compensate for possible
780 * alignment needed after the WORD array. sizeof(WORD) == 2. */ 780 * alignment needed after the WORD array. sizeof(WORD) == 2. */
781 unsigned int glyphs_size = (scratch_size * sizeof (int) - 2) 781 unsigned int glyphs_size = (scratch_size * sizeof (int) - 2)
782 / (sizeof (WORD) + 782 / (sizeof (WORD) +
783 sizeof (SCRIPT_GLYPHPROP) + 783 sizeof (SCRIPT_GLYPHPROP) +
784 sizeof (int) + 784 sizeof (int) +
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 } 1010 }
1011 1011
1012 if (backward) 1012 if (backward)
1013 hb_buffer_reverse (buffer); 1013 hb_buffer_reverse (buffer);
1014 1014
1015 /* Wow, done! */ 1015 /* Wow, done! */
1016 return true; 1016 return true;
1017 } 1017 }
1018 1018
1019 1019
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-unicode-private.hh ('k') | third_party/harfbuzz-ng/src/hb-utf-private.hh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698