[morx] Reverse graphemese, not whole buffer

Fixes https://github.com/harfbuzz/harfbuzz/issues/3314
Supersedes https://github.com/harfbuzz/harfbuzz/pull/3315
This commit is contained in:
Behdad Esfahbod 2021-12-10 15:00:16 -07:00
parent 5b995526f7
commit 23159084b4
4 changed files with 12 additions and 16 deletions

View File

@ -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);

View File

@ -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)

View File

@ -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);
}
}

View File

@ -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]