Enforce Regional_Indicators native direction to LTR
And undo the morx direction reversal change introduced in
https://github.com/harfbuzz/harfbuzz/pull/3315
23159084b4
This fixes original bug https://github.com/harfbuzz/harfbuzz/issues/3314
And the reversion in morx code fixes regressions:
https://github.com/harfbuzz/harfbuzz/issues/3528
https://github.com/harfbuzz/harfbuzz/issues/3535
Supersedes:
https://github.com/harfbuzz/harfbuzz/pull/3529
This commit is contained in:
parent
a85461b9b6
commit
4d48fae4f2
|
@ -1038,12 +1038,12 @@ struct Chain
|
|||
goto skip;
|
||||
|
||||
if (reverse)
|
||||
_hb_ot_layout_reverse_graphemes (c->buffer);
|
||||
c->buffer->reverse ();
|
||||
|
||||
subtable->apply (c);
|
||||
|
||||
if (reverse)
|
||||
_hb_ot_layout_reverse_graphemes (c->buffer);
|
||||
c->buffer->reverse ();
|
||||
|
||||
(void) c->buffer->message (c->font, "end chainsubtable %d", c->lookup_index);
|
||||
|
||||
|
|
|
@ -598,24 +598,33 @@ hb_ensure_native_direction (hb_buffer_t *buffer)
|
|||
* direction, so that features like ligatures will work as intended.
|
||||
*
|
||||
* https://github.com/harfbuzz/harfbuzz/issues/501
|
||||
*
|
||||
* Similar thing about Regional_Indicators; They are bidi=L, but Script=Common.
|
||||
* If they are presentin a run of natively-RTL text, they get assigned a script
|
||||
* with natively RTL direction, which would result in wrong shaping if we
|
||||
* assign such native RTL direction to them then. Detect that as well.
|
||||
*
|
||||
* https://github.com/harfbuzz/harfbuzz/issues/3314
|
||||
*/
|
||||
if (unlikely (horiz_dir == HB_DIRECTION_RTL && direction == HB_DIRECTION_LTR))
|
||||
{
|
||||
bool found_number = false, found_letter = false;
|
||||
bool found_number = false, found_letter = false, found_ri = false;
|
||||
const auto* info = buffer->info;
|
||||
const auto count = buffer->len;
|
||||
for (unsigned i = 0; i < count; i++)
|
||||
{
|
||||
auto gc = _hb_glyph_info_get_general_category (&info[i]);
|
||||
if (gc == HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER)
|
||||
found_number = true;
|
||||
found_number = true;
|
||||
else if (HB_UNICODE_GENERAL_CATEGORY_IS_LETTER (gc))
|
||||
{
|
||||
found_letter = true;
|
||||
break;
|
||||
found_letter = true;
|
||||
break;
|
||||
}
|
||||
else if (hb_in_range<hb_codepoint_t> (info[i].codepoint, 0x1F1E6u, 0x1F1FFu))
|
||||
found_ri = true;
|
||||
}
|
||||
if (found_number && !found_letter)
|
||||
if ((found_number || found_ri) && !found_letter)
|
||||
horiz_dir = HB_DIRECTION_LTR;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
# 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]
|
||||
/System/Library/Fonts/Apple\ Color\ Emoji.ttc;--script=hebrew --direction ltr;U+1F1FA,U+1F1F8,U+1F1EE,U+1F1F1;[u1F1FA_u1F1F8=0+800|u1F1EE_u1F1F1=2+800]
|
||||
|
||||
# https://github.com/harfbuzz/harfbuzz/issues/3528
|
||||
/System/Library/Fonts/Supplemental/Bangla MN.ttc;;U+09AC,U+09BF;[bn_ikaar=0+474|bn_ba=0+998]
|
||||
|
||||
# https://github.com/harfbuzz/harfbuzz/issues/3535
|
||||
/System/Library/Fonts/LucidaGrande.ttc;;U+20DD,U+1F174,U+1F175;[circlecmb=0+0|.notdef=1+1536|.notdef=2+1536]
|
||||
|
||||
# https;//github.com/harfbuzz/harfbuzz/issues/3008
|
||||
/System/Library/Fonts/ヒラギノ丸ゴ\ ProN\ W4.ttc;--features=palt;U+FF11;[gid781=0@-78,0+842]
|
||||
|
|
Loading…
Reference in New Issue