[syllabic] Use a buffer scratch-flag for has-broken-syllable
This commit is contained in:
parent
6997d10bc0
commit
148283d0e0
|
@ -70,6 +70,7 @@ enum hb_buffer_scratch_flags_t {
|
|||
HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT = 0x00000008u,
|
||||
HB_BUFFER_SCRATCH_FLAG_HAS_CGJ = 0x00000010u,
|
||||
HB_BUFFER_SCRATCH_FLAG_HAS_GLYPH_FLAGS = 0x00000020u,
|
||||
HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE = 0x00000040u,
|
||||
|
||||
/* Reserved for shapers' internal use. */
|
||||
HB_BUFFER_SCRATCH_FLAG_SHAPER0 = 0x01000000u,
|
||||
|
|
|
@ -498,7 +498,7 @@ _eof_trans:
|
|||
break;
|
||||
case 15:
|
||||
#line 98 "hb-ot-shaper-indic-machine.rl"
|
||||
{te = p;p--;{ found_syllable (indic_broken_cluster); }}
|
||||
{te = p;p--;{ found_syllable (indic_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; }}
|
||||
break;
|
||||
case 16:
|
||||
#line 99 "hb-ot-shaper-indic-machine.rl"
|
||||
|
@ -522,7 +522,7 @@ _eof_trans:
|
|||
break;
|
||||
case 4:
|
||||
#line 98 "hb-ot-shaper-indic-machine.rl"
|
||||
{{p = ((te))-1;}{ found_syllable (indic_broken_cluster); }}
|
||||
{{p = ((te))-1;}{ found_syllable (indic_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; }}
|
||||
break;
|
||||
case 6:
|
||||
#line 1 "NONE"
|
||||
|
@ -531,7 +531,7 @@ _eof_trans:
|
|||
{{p = ((te))-1;} found_syllable (indic_consonant_syllable); }
|
||||
break;
|
||||
case 5:
|
||||
{{p = ((te))-1;} found_syllable (indic_broken_cluster); }
|
||||
{{p = ((te))-1;} found_syllable (indic_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; }
|
||||
break;
|
||||
case 6:
|
||||
{{p = ((te))-1;} found_syllable (indic_non_indic_cluster); }
|
||||
|
|
|
@ -95,7 +95,7 @@ main := |*
|
|||
vowel_syllable => { found_syllable (indic_vowel_syllable); };
|
||||
standalone_cluster => { found_syllable (indic_standalone_cluster); };
|
||||
symbol_cluster => { found_syllable (indic_symbol_cluster); };
|
||||
broken_cluster => { found_syllable (indic_broken_cluster); };
|
||||
broken_cluster => { found_syllable (indic_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; };
|
||||
other => { found_syllable (indic_non_indic_cluster); };
|
||||
*|;
|
||||
|
||||
|
|
|
@ -324,7 +324,7 @@ _eof_trans:
|
|||
break;
|
||||
case 12:
|
||||
#line 81 "hb-ot-shaper-khmer-machine.rl"
|
||||
{te = p;p--;{ found_syllable (khmer_broken_cluster); }}
|
||||
{te = p;p--;{ found_syllable (khmer_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; }}
|
||||
break;
|
||||
case 11:
|
||||
#line 82 "hb-ot-shaper-khmer-machine.rl"
|
||||
|
@ -336,13 +336,13 @@ _eof_trans:
|
|||
break;
|
||||
case 5:
|
||||
#line 81 "hb-ot-shaper-khmer-machine.rl"
|
||||
{{p = ((te))-1;}{ found_syllable (khmer_broken_cluster); }}
|
||||
{{p = ((te))-1;}{ found_syllable (khmer_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; }}
|
||||
break;
|
||||
case 3:
|
||||
#line 1 "NONE"
|
||||
{ switch( act ) {
|
||||
case 2:
|
||||
{{p = ((te))-1;} found_syllable (khmer_broken_cluster); }
|
||||
{{p = ((te))-1;} found_syllable (khmer_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; }
|
||||
break;
|
||||
case 3:
|
||||
{{p = ((te))-1;} found_syllable (khmer_non_khmer_cluster); }
|
||||
|
|
|
@ -78,7 +78,7 @@ other = any;
|
|||
|
||||
main := |*
|
||||
consonant_syllable => { found_syllable (khmer_consonant_syllable); };
|
||||
broken_cluster => { found_syllable (khmer_broken_cluster); };
|
||||
broken_cluster => { found_syllable (khmer_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; };
|
||||
other => { found_syllable (khmer_non_khmer_cluster); };
|
||||
*|;
|
||||
|
||||
|
|
|
@ -435,7 +435,7 @@ _eof_trans:
|
|||
break;
|
||||
case 8:
|
||||
#line 97 "hb-ot-shaper-myanmar-machine.rl"
|
||||
{te = p+1;{ found_syllable (myanmar_broken_cluster); }}
|
||||
{te = p+1;{ found_syllable (myanmar_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; }}
|
||||
break;
|
||||
case 3:
|
||||
#line 98 "hb-ot-shaper-myanmar-machine.rl"
|
||||
|
@ -447,7 +447,7 @@ _eof_trans:
|
|||
break;
|
||||
case 7:
|
||||
#line 97 "hb-ot-shaper-myanmar-machine.rl"
|
||||
{te = p;p--;{ found_syllable (myanmar_broken_cluster); }}
|
||||
{te = p;p--;{ found_syllable (myanmar_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; }}
|
||||
break;
|
||||
case 9:
|
||||
#line 98 "hb-ot-shaper-myanmar-machine.rl"
|
||||
|
|
|
@ -94,7 +94,7 @@ main := |*
|
|||
consonant_syllable => { found_syllable (myanmar_consonant_syllable); };
|
||||
j => { found_syllable (myanmar_non_myanmar_cluster); };
|
||||
punctuation_cluster => { found_syllable (myanmar_punctuation_cluster); };
|
||||
broken_cluster => { found_syllable (myanmar_broken_cluster); };
|
||||
broken_cluster => { found_syllable (myanmar_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; };
|
||||
other => { found_syllable (myanmar_non_myanmar_cluster); };
|
||||
*|;
|
||||
|
||||
|
|
|
@ -39,22 +39,9 @@ hb_syllabic_insert_dotted_circles (hb_font_t *font,
|
|||
{
|
||||
if (unlikely (buffer->flags & HB_BUFFER_FLAG_DO_NOT_INSERT_DOTTED_CIRCLE))
|
||||
return;
|
||||
|
||||
/* Note: This loop is extra overhead, but should not be measurable.
|
||||
* TODO Use a buffer scratch flag to remove the loop. */
|
||||
bool has_broken_syllables = false;
|
||||
unsigned int count = buffer->len;
|
||||
hb_glyph_info_t *info = buffer->info;
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
if ((info[i].syllable() & 0x0F) == broken_syllable_type)
|
||||
{
|
||||
has_broken_syllables = true;
|
||||
break;
|
||||
}
|
||||
if (likely (!has_broken_syllables))
|
||||
if (likely (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE)))
|
||||
return;
|
||||
|
||||
|
||||
hb_codepoint_t dottedcircle_glyph;
|
||||
if (!font->get_nominal_glyph (0x25CCu, &dottedcircle_glyph))
|
||||
return;
|
||||
|
|
|
@ -753,7 +753,7 @@ _eof_trans:
|
|||
break;
|
||||
case 4:
|
||||
#line 176 "hb-ot-shaper-use-machine.rl"
|
||||
{te = p+1;{ found_syllable (use_broken_cluster); }}
|
||||
{te = p+1;{ found_syllable (use_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; }}
|
||||
break;
|
||||
case 3:
|
||||
#line 177 "hb-ot-shaper-use-machine.rl"
|
||||
|
@ -785,7 +785,7 @@ _eof_trans:
|
|||
break;
|
||||
case 15:
|
||||
#line 176 "hb-ot-shaper-use-machine.rl"
|
||||
{te = p;p--;{ found_syllable (use_broken_cluster); }}
|
||||
{te = p;p--;{ found_syllable (use_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; }}
|
||||
break;
|
||||
case 16:
|
||||
#line 177 "hb-ot-shaper-use-machine.rl"
|
||||
|
|
|
@ -173,7 +173,7 @@ main := |*
|
|||
numeral_cluster => { found_syllable (use_numeral_cluster); };
|
||||
symbol_cluster => { found_syllable (use_symbol_cluster); };
|
||||
hieroglyph_cluster => { found_syllable (use_hieroglyph_cluster); };
|
||||
broken_cluster => { found_syllable (use_broken_cluster); };
|
||||
broken_cluster => { found_syllable (use_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; };
|
||||
other => { found_syllable (use_non_cluster); };
|
||||
*|;
|
||||
|
||||
|
|
Loading…
Reference in New Issue