Use buffer scratch_flags to remember if we had any joiners

This commit is contained in:
Behdad Esfahbod 2018-09-30 03:54:40 -04:00
parent ba0f0f156f
commit bd07d2878f
3 changed files with 15 additions and 3 deletions

View File

@ -68,7 +68,8 @@ enum hb_buffer_scratch_flags_t {
HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK = 0x00000004u,
HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT = 0x00000008u,
HB_BUFFER_SCRATCH_FLAG_HAS_UNSAFE_TO_BREAK = 0x00000010u,
HB_BUFFER_SCRATCH_FLAG_HAS_CGJ = 0x00000020u,
HB_BUFFER_SCRATCH_FLAG_HAS_JOINERS = 0x00000020u,
HB_BUFFER_SCRATCH_FLAG_HAS_CGJ = 0x00000040u,
/* Reserved for complex shapers' internal use. */
HB_BUFFER_SCRATCH_FLAG_COMPLEX0 = 0x01000000u,

View File

@ -224,8 +224,16 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer)
{
buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES;
props |= UPROPS_MASK_IGNORABLE;
if (u == 0x200Cu) props |= UPROPS_MASK_Cf_ZWNJ;
else if (u == 0x200Du) props |= UPROPS_MASK_Cf_ZWJ;
if (u == 0x200Cu)
{
props |= UPROPS_MASK_Cf_ZWNJ;
buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_JOINERS;
}
else if (u == 0x200Du)
{
props |= UPROPS_MASK_Cf_ZWJ;
buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_JOINERS;
}
/* Mongolian Free Variation Selectors need to be remembered
* because although we need to hide them like default-ignorables,
* they need to non-ignorable during shaping. This is similar to

View File

@ -399,6 +399,9 @@ flip_joiners (const hb_ot_shape_plan_t *plan HB_UNUSED,
hb_font_t *font HB_UNUSED,
hb_buffer_t *buffer)
{
if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_JOINERS))
return;
unsigned int count = buffer->len;
hb_glyph_info_t *info = buffer->info;
for (unsigned int i = 0; i < count; i++)