equal
deleted
inserted
replaced
38 |
38 |
39 #include "hb-ot-layout-private.hh" |
39 #include "hb-ot-layout-private.hh" |
40 #include "hb-unicode-private.hh" |
40 #include "hb-unicode-private.hh" |
41 #include "hb-set-private.hh" |
41 #include "hb-set-private.hh" |
42 |
42 |
|
43 #include "hb-ot-layout-gsubgpos-private.hh" |
|
44 //#include "hb-aat-layout-private.hh" |
43 |
45 |
44 static hb_tag_t common_features[] = { |
46 static hb_tag_t common_features[] = { |
45 HB_TAG('c','c','m','p'), |
47 HB_TAG('c','c','m','p'), |
46 HB_TAG('l','o','c','l'), |
48 HB_TAG('l','o','c','l'), |
47 HB_TAG('m','a','r','k'), |
49 HB_TAG('m','a','r','k'), |
106 else |
108 else |
107 { |
109 { |
108 /* We really want to find a 'vert' feature if there's any in the font, no |
110 /* We really want to find a 'vert' feature if there's any in the font, no |
109 * matter which script/langsys it is listed (or not) under. |
111 * matter which script/langsys it is listed (or not) under. |
110 * See various bugs referenced from: |
112 * See various bugs referenced from: |
111 * https://github.com/behdad/harfbuzz/issues/63 */ |
113 * https://github.com/harfbuzz/harfbuzz/issues/63 */ |
112 map->add_feature (HB_TAG ('v','e','r','t'), 1, F_GLOBAL | F_GLOBAL_SEARCH); |
114 map->add_feature (HB_TAG ('v','e','r','t'), 1, F_GLOBAL | F_GLOBAL_SEARCH); |
113 } |
115 } |
114 |
116 |
115 if (planner->shaper->override_features) |
117 if (planner->shaper->override_features) |
116 planner->shaper->override_features (planner); |
118 planner->shaper->override_features (planner); |
448 hb_ot_zero_width_default_ignorables (hb_ot_shape_context_t *c) |
450 hb_ot_zero_width_default_ignorables (hb_ot_shape_context_t *c) |
449 { |
451 { |
450 hb_buffer_t *buffer = c->buffer; |
452 hb_buffer_t *buffer = c->buffer; |
451 |
453 |
452 if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES) || |
454 if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES) || |
453 (buffer->flags & HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES)) |
455 (buffer->flags & HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES) || |
|
456 (buffer->flags & HB_BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES)) |
454 return; |
457 return; |
455 |
458 |
456 unsigned int count = buffer->len; |
459 unsigned int count = buffer->len; |
457 hb_glyph_info_t *info = buffer->info; |
460 hb_glyph_info_t *info = buffer->info; |
458 hb_glyph_position_t *pos = buffer->pos; |
461 hb_glyph_position_t *pos = buffer->pos; |
484 /* No default-ignorables found; return. */ |
487 /* No default-ignorables found; return. */ |
485 if (i == count) |
488 if (i == count) |
486 return; |
489 return; |
487 |
490 |
488 hb_codepoint_t space; |
491 hb_codepoint_t space; |
489 if (c->font->get_nominal_glyph (' ', &space)) |
492 if (!(buffer->flags & HB_BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES) && |
|
493 c->font->get_nominal_glyph (' ', &space)) |
490 { |
494 { |
491 /* Replace default-ignorables with a zero-advance space glyph. */ |
495 /* Replace default-ignorables with a zero-advance space glyph. */ |
492 for (/*continue*/; i < count; i++) |
496 for (/*continue*/; i < count; i++) |
493 { |
497 { |
494 if (_hb_glyph_info_is_default_ignorable (&info[i])) |
498 if (_hb_glyph_info_is_default_ignorable (&info[i])) |
612 if (!hb_ot_layout_has_glyph_classes (c->face)) |
616 if (!hb_ot_layout_has_glyph_classes (c->face)) |
613 hb_synthesize_glyph_classes (c); |
617 hb_synthesize_glyph_classes (c); |
614 |
618 |
615 c->plan->substitute (c->font, buffer); |
619 c->plan->substitute (c->font, buffer); |
616 |
620 |
617 return; |
621 /* XXX Call morx instead. */ |
|
622 //hb_aat_layout_substitute (c->font, c->buffer); |
618 } |
623 } |
619 |
624 |
620 static inline void |
625 static inline void |
621 hb_ot_substitute (hb_ot_shape_context_t *c) |
626 hb_ot_substitute (hb_ot_shape_context_t *c) |
622 { |
627 { |
780 |
785 |
781 if (c->fallback_positioning) |
786 if (c->fallback_positioning) |
782 _hb_ot_shape_fallback_kern (c->plan, c->font, c->buffer); |
787 _hb_ot_shape_fallback_kern (c->plan, c->font, c->buffer); |
783 |
788 |
784 _hb_buffer_deallocate_gsubgpos_vars (c->buffer); |
789 _hb_buffer_deallocate_gsubgpos_vars (c->buffer); |
|
790 |
|
791 //hb_aat_layout_position (c->font, c->buffer); |
785 } |
792 } |
786 |
793 |
787 static inline void |
794 static inline void |
788 hb_propagate_flags (hb_buffer_t *buffer) |
795 hb_propagate_flags (hb_buffer_t *buffer) |
789 { |
796 { |
815 static void |
822 static void |
816 hb_ot_shape_internal (hb_ot_shape_context_t *c) |
823 hb_ot_shape_internal (hb_ot_shape_context_t *c) |
817 { |
824 { |
818 c->buffer->deallocate_var_all (); |
825 c->buffer->deallocate_var_all (); |
819 c->buffer->scratch_flags = HB_BUFFER_SCRATCH_FLAG_DEFAULT; |
826 c->buffer->scratch_flags = HB_BUFFER_SCRATCH_FLAG_DEFAULT; |
820 if (likely (!_hb_unsigned_int_mul_overflows (c->buffer->len, HB_BUFFER_MAX_EXPANSION_FACTOR))) |
827 if (likely (!_hb_unsigned_int_mul_overflows (c->buffer->len, HB_BUFFER_MAX_LEN_FACTOR))) |
821 { |
828 { |
822 c->buffer->max_len = MAX (c->buffer->len * HB_BUFFER_MAX_EXPANSION_FACTOR, |
829 c->buffer->max_len = MAX (c->buffer->len * HB_BUFFER_MAX_LEN_FACTOR, |
823 (unsigned) HB_BUFFER_MAX_LEN_MIN); |
830 (unsigned) HB_BUFFER_MAX_LEN_MIN); |
|
831 } |
|
832 if (likely (!_hb_unsigned_int_mul_overflows (c->buffer->len, HB_BUFFER_MAX_OPS_FACTOR))) |
|
833 { |
|
834 c->buffer->max_ops = MAX (c->buffer->len * HB_BUFFER_MAX_OPS_FACTOR, |
|
835 (unsigned) HB_BUFFER_MAX_OPS_MIN); |
824 } |
836 } |
825 |
837 |
826 bool disable_otl = c->plan->shaper->disable_otl && c->plan->shaper->disable_otl (c->plan); |
838 bool disable_otl = c->plan->shaper->disable_otl && c->plan->shaper->disable_otl (c->plan); |
827 //c->fallback_substitute = disable_otl || !hb_ot_layout_has_substitution (c->face); |
839 //c->fallback_substitute = disable_otl || !hb_ot_layout_has_substitution (c->face); |
828 c->fallback_positioning = disable_otl || !hb_ot_layout_has_positioning (c->face); |
840 c->fallback_positioning = disable_otl || !hb_ot_layout_has_positioning (c->face); |
859 _hb_buffer_deallocate_unicode_vars (c->buffer); |
871 _hb_buffer_deallocate_unicode_vars (c->buffer); |
860 |
872 |
861 c->buffer->props.direction = c->target_direction; |
873 c->buffer->props.direction = c->target_direction; |
862 |
874 |
863 c->buffer->max_len = HB_BUFFER_MAX_LEN_DEFAULT; |
875 c->buffer->max_len = HB_BUFFER_MAX_LEN_DEFAULT; |
|
876 c->buffer->max_ops = HB_BUFFER_MAX_OPS_DEFAULT; |
864 c->buffer->deallocate_var_all (); |
877 c->buffer->deallocate_var_all (); |
865 } |
878 } |
866 |
879 |
867 |
880 |
868 hb_bool_t |
881 hb_bool_t |
944 |
957 |
945 /* And find transitive closure. */ |
958 /* And find transitive closure. */ |
946 hb_set_t *copy = hb_set_create (); |
959 hb_set_t *copy = hb_set_create (); |
947 do { |
960 do { |
948 copy->set (glyphs); |
961 copy->set (glyphs); |
949 for (hb_codepoint_t lookup_index = -1; hb_set_next (lookups, &lookup_index);) |
962 for (hb_codepoint_t lookup_index = HB_SET_VALUE_INVALID; hb_set_next (lookups, &lookup_index);) |
950 hb_ot_layout_lookup_substitute_closure (font->face, lookup_index, glyphs); |
963 hb_ot_layout_lookup_substitute_closure (font->face, lookup_index, glyphs); |
951 } while (!copy->is_equal (glyphs)); |
964 } while (!copy->is_equal (glyphs)); |
952 hb_set_destroy (copy); |
965 hb_set_destroy (copy); |
953 |
966 |
954 hb_set_destroy (lookups); |
967 hb_set_destroy (lookups); |