OLD | NEW |
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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 } | 702 } |
703 } | 703 } |
704 | 704 |
705 if (!range_records.len) /* No active feature found. */ | 705 if (!range_records.len) /* No active feature found. */ |
706 goto fail_features; | 706 goto fail_features; |
707 | 707 |
708 /* Fixup the pointers. */ | 708 /* Fixup the pointers. */ |
709 for (unsigned int i = 0; i < range_records.len; i++) | 709 for (unsigned int i = 0; i < range_records.len; i++) |
710 { | 710 { |
711 range_record_t *range = &range_records[i]; | 711 range_record_t *range = &range_records[i]; |
712 range->props.potfRecords = feature_records.array + reinterpret_cast<unsign
ed int> (range->props.potfRecords); | 712 range->props.potfRecords = feature_records.array + reinterpret_cast<uintpt
r_t> (range->props.potfRecords); |
713 } | 713 } |
714 } | 714 } |
715 else | 715 else |
716 { | 716 { |
717 fail_features: | 717 fail_features: |
718 num_features = 0; | 718 num_features = 0; |
719 } | 719 } |
720 | 720 |
721 #define FAIL(...) \ | 721 #define FAIL(...) \ |
722 HB_STMT_START { \ | 722 HB_STMT_START { \ |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 (c >= 0x10000 && c < 0x110000) |
775 log_clusters[chars_len++] = cluster; /* Surrogates. */ | 775 log_clusters[chars_len++] = cluster; /* Surrogates. */ |
776 } | 776 } |
777 } | 777 } |
778 | 778 |
779 /* All the following types are sized in multiples of sizeof(int). */ | 779 /* The -2 in the following is to compensate for possible |
780 unsigned int glyphs_size = scratch_size / ((sizeof (WORD) + | 780 * alignment needed after the WORD array. sizeof(WORD) == 2. */ |
781 » » » » » sizeof (SCRIPT_GLYPHPROP) + | 781 unsigned int glyphs_size = (scratch_size * sizeof (int) - 2) |
782 » » » » » sizeof (int) + | 782 » » » / (sizeof (WORD) + |
783 » » » » » sizeof (GOFFSET) + | 783 » » » sizeof (SCRIPT_GLYPHPROP) + |
784 » » » » » sizeof (uint32_t)) | 784 » » » sizeof (int) + |
785 » » » » » / sizeof (int)); | 785 » » » sizeof (GOFFSET) + |
| 786 » » » sizeof (uint32_t)); |
786 | 787 |
787 ALLOCATE_ARRAY (WORD, glyphs, glyphs_size); | 788 ALLOCATE_ARRAY (WORD, glyphs, glyphs_size); |
788 ALLOCATE_ARRAY (SCRIPT_GLYPHPROP, glyph_props, glyphs_size); | 789 ALLOCATE_ARRAY (SCRIPT_GLYPHPROP, glyph_props, glyphs_size); |
789 ALLOCATE_ARRAY (int, advances, glyphs_size); | 790 ALLOCATE_ARRAY (int, advances, glyphs_size); |
790 ALLOCATE_ARRAY (GOFFSET, offsets, glyphs_size); | 791 ALLOCATE_ARRAY (GOFFSET, offsets, glyphs_size); |
791 ALLOCATE_ARRAY (uint32_t, vis_clusters, glyphs_size); | 792 ALLOCATE_ARRAY (uint32_t, vis_clusters, glyphs_size); |
792 | 793 |
793 /* Note: | 794 /* Note: |
794 * We can't touch the contents of glyph_props. Our fallback | 795 * We can't touch the contents of glyph_props. Our fallback |
795 * implementations of Shape and Place functions use that buffer | 796 * implementations of Shape and Place functions use that buffer |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 } | 1010 } |
1010 | 1011 |
1011 if (backward) | 1012 if (backward) |
1012 hb_buffer_reverse (buffer); | 1013 hb_buffer_reverse (buffer); |
1013 | 1014 |
1014 /* Wow, done! */ | 1015 /* Wow, done! */ |
1015 return true; | 1016 return true; |
1016 } | 1017 } |
1017 | 1018 |
1018 | 1019 |
OLD | NEW |