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

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

Issue 1580513002: Roll HarfBuzz to 1.1.3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fix Created 4 years, 11 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 © 2009,2010 Red Hat, Inc. 2 * Copyright © 2009,2010 Red Hat, Inc.
3 * Copyright © 2010,2011,2012 Google, Inc. 3 * Copyright © 2010,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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 { 655 {
656 hb_direction_t direction = c->buffer->props.direction; 656 hb_direction_t direction = c->buffer->props.direction;
657 unsigned int count = c->buffer->len; 657 unsigned int count = c->buffer->len;
658 hb_glyph_info_t *info = c->buffer->info; 658 hb_glyph_info_t *info = c->buffer->info;
659 hb_glyph_position_t *pos = c->buffer->pos; 659 hb_glyph_position_t *pos = c->buffer->pos;
660 660
661 if (HB_DIRECTION_IS_HORIZONTAL (direction)) 661 if (HB_DIRECTION_IS_HORIZONTAL (direction))
662 { 662 {
663 for (unsigned int i = 0; i < count; i++) 663 for (unsigned int i = 0; i < count; i++)
664 pos[i].x_advance = c->font->get_glyph_h_advance (info[i].codepoint); 664 pos[i].x_advance = c->font->get_glyph_h_advance (info[i].codepoint);
665 /* The nil glyph_h_origin() func returns 0, so no need to apply it. */
665 if (c->font->has_glyph_h_origin_func ()) 666 if (c->font->has_glyph_h_origin_func ())
666 for (unsigned int i = 0; i < count; i++) 667 for (unsigned int i = 0; i < count; i++)
667 c->font->subtract_glyph_h_origin (info[i].codepoint, 668 c->font->subtract_glyph_h_origin (info[i].codepoint,
668 &pos[i].x_offset, 669 &pos[i].x_offset,
669 &pos[i].y_offset); 670 &pos[i].y_offset);
670 } 671 }
671 else 672 else
672 { 673 {
673 for (unsigned int i = 0; i < count; i++) 674 for (unsigned int i = 0; i < count; i++)
675 {
674 pos[i].y_advance = c->font->get_glyph_v_advance (info[i].codepoint); 676 pos[i].y_advance = c->font->get_glyph_v_advance (info[i].codepoint);
675 if (c->font->has_glyph_v_origin_func ()) 677 c->font->subtract_glyph_v_origin (info[i].codepoint,
676 for (unsigned int i = 0; i < count; i++) 678 » » » » » &pos[i].x_offset,
677 » c->font->subtract_glyph_v_origin (info[i].codepoint, 679 » » » » » &pos[i].y_offset);
678 » » » » » &pos[i].x_offset, 680 }
679 » » » » » &pos[i].y_offset);
680 } 681 }
681 if (c->buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK) 682 if (c->buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK)
682 _hb_ot_shape_fallback_spaces (c->plan, c->font, c->buffer); 683 _hb_ot_shape_fallback_spaces (c->plan, c->font, c->buffer);
683 } 684 }
684 685
685 static inline bool 686 static inline bool
686 hb_ot_position_complex (hb_ot_shape_context_t *c) 687 hb_ot_position_complex (hb_ot_shape_context_t *c)
687 { 688 {
688 bool ret = false; 689 bool ret = false;
689 unsigned int count = c->buffer->len; 690 unsigned int count = c->buffer->len;
690 bool has_positioning = hb_ot_layout_has_positioning (c->face); 691 bool has_positioning = (bool) hb_ot_layout_has_positioning (c->face);
691 /* If the font has no GPOS, AND, no fallback positioning will 692 /* If the font has no GPOS, AND, no fallback positioning will
692 * happen, AND, direction is forward, then when zeroing mark 693 * happen, AND, direction is forward, then when zeroing mark
693 * widths, we shift the mark with it, such that the mark 694 * widths, we shift the mark with it, such that the mark
694 * is positioned hanging over the previous glyph. When 695 * is positioned hanging over the previous glyph. When
695 * direction is backward we don't shift and it will end up 696 * direction is backward we don't shift and it will end up
696 * hanging over the next glyph after the final reordering. 697 * hanging over the next glyph after the final reordering.
697 * If fallback positinoing happens or GPOS is present, we don't 698 * If fallback positinoing happens or GPOS is present, we don't
698 * care. 699 * care.
699 */ 700 */
700 bool adjust_offsets_when_zeroing = !(has_positioning || c->plan->shaper->fallb ack_position || 701 bool adjust_offsets_when_zeroing = !(has_positioning || c->plan->shaper->fallb ack_position ||
(...skipping 18 matching lines...) Expand all
719 break; 720 break;
720 } 721 }
721 722
722 if (has_positioning) 723 if (has_positioning)
723 { 724 {
724 hb_glyph_info_t *info = c->buffer->info; 725 hb_glyph_info_t *info = c->buffer->info;
725 hb_glyph_position_t *pos = c->buffer->pos; 726 hb_glyph_position_t *pos = c->buffer->pos;
726 727
727 /* Change glyph origin to what GPOS expects (horizontal), apply GPOS, change it back. */ 728 /* Change glyph origin to what GPOS expects (horizontal), apply GPOS, change it back. */
728 729
730 /* The nil glyph_h_origin() func returns 0, so no need to apply it. */
729 if (c->font->has_glyph_h_origin_func ()) 731 if (c->font->has_glyph_h_origin_func ())
730 for (unsigned int i = 0; i < count; i++) 732 for (unsigned int i = 0; i < count; i++)
731 c->font->add_glyph_h_origin (info[i].codepoint, 733 c->font->add_glyph_h_origin (info[i].codepoint,
732 &pos[i].x_offset, 734 &pos[i].x_offset,
733 &pos[i].y_offset); 735 &pos[i].y_offset);
734 736
735 c->plan->position (c->font, c->buffer); 737 c->plan->position (c->font, c->buffer);
736 738
739 /* The nil glyph_h_origin() func returns 0, so no need to apply it. */
737 if (c->font->has_glyph_h_origin_func ()) 740 if (c->font->has_glyph_h_origin_func ())
738 for (unsigned int i = 0; i < count; i++) 741 for (unsigned int i = 0; i < count; i++)
739 c->font->subtract_glyph_h_origin (info[i].codepoint, 742 c->font->subtract_glyph_h_origin (info[i].codepoint,
740 &pos[i].x_offset, 743 &pos[i].x_offset,
741 &pos[i].y_offset); 744 &pos[i].y_offset);
742 745
743 ret = true; 746 ret = true;
744 } 747 }
745 748
746 switch (c->plan->shaper->zero_width_marks) 749 switch (c->plan->shaper->zero_width_marks)
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 unsigned int num_features) 848 unsigned int num_features)
846 { 849 {
847 hb_ot_shape_context_t c = {HB_SHAPER_DATA_GET (shape_plan), font, font->face, buffer, features, num_features}; 850 hb_ot_shape_context_t c = {HB_SHAPER_DATA_GET (shape_plan), font, font->face, buffer, features, num_features};
848 hb_ot_shape_internal (&c); 851 hb_ot_shape_internal (&c);
849 852
850 return true; 853 return true;
851 } 854 }
852 855
853 856
854 /** 857 /**
858 * hb_ot_shape_plan_collect_lookups:
859 *
855 * Since: 0.9.7 860 * Since: 0.9.7
856 **/ 861 **/
857 void 862 void
858 hb_ot_shape_plan_collect_lookups (hb_shape_plan_t *shape_plan, 863 hb_ot_shape_plan_collect_lookups (hb_shape_plan_t *shape_plan,
859 hb_tag_t table_tag, 864 hb_tag_t table_tag,
860 hb_set_t *lookup_indexes /* OUT */) 865 hb_set_t *lookup_indexes /* OUT */)
861 { 866 {
862 /* XXX Does the first part always succeed? */ 867 /* XXX Does the first part always succeed? */
863 HB_SHAPER_DATA_GET (shape_plan)->collect_lookups (table_tag, lookup_indexes); 868 HB_SHAPER_DATA_GET (shape_plan)->collect_lookups (table_tag, lookup_indexes);
864 } 869 }
(...skipping 13 matching lines...) Expand all
878 if (mirror) 883 if (mirror)
879 { 884 {
880 hb_codepoint_t m = unicode->mirroring (u); 885 hb_codepoint_t m = unicode->mirroring (u);
881 if (m != u && font->get_glyph (m, 0, &glyph)) 886 if (m != u && font->get_glyph (m, 0, &glyph))
882 glyphs->add (glyph); 887 glyphs->add (glyph);
883 } 888 }
884 } 889 }
885 890
886 891
887 /** 892 /**
893 * hb_ot_shape_glyphs_closure:
894 *
888 * Since: 0.9.2 895 * Since: 0.9.2
889 **/ 896 **/
890 void 897 void
891 hb_ot_shape_glyphs_closure (hb_font_t *font, 898 hb_ot_shape_glyphs_closure (hb_font_t *font,
892 hb_buffer_t *buffer, 899 hb_buffer_t *buffer,
893 const hb_feature_t *features, 900 const hb_feature_t *features,
894 unsigned int num_features, 901 unsigned int num_features,
895 hb_set_t *glyphs) 902 hb_set_t *glyphs)
896 { 903 {
897 hb_ot_shape_plan_t plan; 904 hb_ot_shape_plan_t plan;
(...skipping 17 matching lines...) Expand all
915 hb_set_t copy; 922 hb_set_t copy;
916 copy.init (); 923 copy.init ();
917 do { 924 do {
918 copy.set (glyphs); 925 copy.set (glyphs);
919 for (hb_codepoint_t lookup_index = -1; hb_set_next (&lookups, &lookup_index) ;) 926 for (hb_codepoint_t lookup_index = -1; hb_set_next (&lookups, &lookup_index) ;)
920 hb_ot_layout_lookup_substitute_closure (font->face, lookup_index, glyphs); 927 hb_ot_layout_lookup_substitute_closure (font->face, lookup_index, glyphs);
921 } while (!copy.is_equal (glyphs)); 928 } while (!copy.is_equal (glyphs));
922 929
923 hb_shape_plan_destroy (shape_plan); 930 hb_shape_plan_destroy (shape_plan);
924 } 931 }
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-ot-shape.h ('k') | third_party/harfbuzz-ng/src/hb-ot-shape-complex-arabic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698