diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index b77c1f4d4..2f9951092 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -1038,12 +1038,12 @@ struct Chain goto skip; if (reverse) - c->buffer->reverse (); + _hb_ot_layout_reverse_graphemes (c->buffer); subtable->apply (c); if (reverse) - c->buffer->reverse (); + _hb_ot_layout_reverse_graphemes (c->buffer); (void) c->buffer->message (c->font, "end chainsubtable %d", c->lookup_index); diff --git a/src/hb-ot-layout.hh b/src/hb-ot-layout.hh index c6cbfb7db..2c825e0c8 100644 --- a/src/hb-ot-layout.hh +++ b/src/hb-ot-layout.hh @@ -359,6 +359,12 @@ _hb_grapheme_group_func (const hb_glyph_info_t& a HB_UNUSED, #define foreach_grapheme(buffer, start, end) \ foreach_group (buffer, start, end, _hb_grapheme_group_func) +static inline void +_hb_ot_layout_reverse_graphemes (hb_buffer_t *buffer) +{ + buffer->reverse_groups (_hb_grapheme_group_func, + buffer->cluster_level == HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS); +} static inline bool _hb_glyph_info_is_unicode_format (const hb_glyph_info_t *info) diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index bbe5f79d2..4dde3520d 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -628,20 +628,7 @@ hb_ensure_native_direction (hb_buffer_t *buffer) (HB_DIRECTION_IS_VERTICAL (direction) && direction != HB_DIRECTION_TTB)) { - - if (buffer->cluster_level == HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS) - foreach_grapheme (buffer, start, end) - { - buffer->merge_clusters (start, end); - buffer->reverse_range (start, end); - } - else - foreach_grapheme (buffer, start, end) - /* form_clusters() merged clusters already, we don't merge. */ - buffer->reverse_range (start, end); - - buffer->reverse (); - + _hb_ot_layout_reverse_graphemes (buffer); buffer->props.direction = HB_DIRECTION_REVERSE (buffer->props.direction); } } diff --git a/test/shape/data/in-house/tests/macos.tests b/test/shape/data/in-house/tests/macos.tests index 7c7b806fb..2bf221a73 100644 --- a/test/shape/data/in-house/tests/macos.tests +++ b/test/shape/data/in-house/tests/macos.tests @@ -1,3 +1,6 @@ +# https://github.com/harfbuzz/harfbuzz/issues/3314 +/System/Library/Fonts/Apple\ Color\ Emoji.ttc;;U+05D0,U+1F1FA,U+1F1F8,U+1F1EE,U+1F1F1;[u1F1EE_u1F1F1=3+800|u1F1FA_u1F1F8=1+800|.notdef=0+800] + # https;//github.com/harfbuzz/harfbuzz/issues/3008 /System/Library/Fonts/ヒラギノ丸ゴ\ ProN\ W4.ttc;--features=palt;U+FF11;[gid781=0@-78,0+842]