[layout] Only update buffer digest if buffer changed by a pause
This commit is contained in:
parent
8b2a211123
commit
27a8fe7d58
|
@ -1986,10 +1986,11 @@ inline void hb_ot_map_t::apply (const Proxy &proxy,
|
|||
|
||||
if (stage->pause_func)
|
||||
{
|
||||
stage->pause_func (plan, font, buffer);
|
||||
/* Refresh working buffer digest since buffer content
|
||||
* might have changed. */
|
||||
c.digest = buffer->digest ();
|
||||
if (stage->pause_func (plan, font, buffer))
|
||||
{
|
||||
/* Refresh working buffer digest since buffer changed. */
|
||||
c.digest = buffer->digest ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -552,7 +552,7 @@ _hb_glyph_info_clear_substituted (hb_glyph_info_t *info)
|
|||
info->glyph_props() &= ~(HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED);
|
||||
}
|
||||
|
||||
static inline void
|
||||
static inline bool
|
||||
_hb_clear_substitution_flags (const hb_ot_shape_plan_t *plan HB_UNUSED,
|
||||
hb_font_t *font HB_UNUSED,
|
||||
hb_buffer_t *buffer)
|
||||
|
@ -561,6 +561,7 @@ _hb_clear_substitution_flags (const hb_ot_shape_plan_t *plan HB_UNUSED,
|
|||
unsigned int count = buffer->len;
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
_hb_glyph_info_clear_substituted (&info[i]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ struct hb_ot_map_t
|
|||
}
|
||||
};
|
||||
|
||||
typedef void (*pause_func_t) (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer);
|
||||
typedef bool (*pause_func_t) (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer);
|
||||
|
||||
struct stage_map_t {
|
||||
unsigned int last_lookup; /* Cumulative */
|
||||
|
|
|
@ -161,22 +161,23 @@ static const struct arabic_state_table_entry {
|
|||
};
|
||||
|
||||
|
||||
static void
|
||||
static bool
|
||||
arabic_fallback_shape (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer);
|
||||
|
||||
static void
|
||||
static bool
|
||||
record_stch (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer);
|
||||
|
||||
static void
|
||||
static bool
|
||||
deallocate_buffer_var (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer)
|
||||
{
|
||||
HB_BUFFER_DEALLOCATE_VAR (buffer, arabic_shaping_action);
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -412,19 +413,19 @@ setup_masks_arabic (const hb_ot_shape_plan_t *plan,
|
|||
setup_masks_arabic_plan (arabic_plan, buffer, plan->props.script);
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
arabic_fallback_shape (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer)
|
||||
{
|
||||
#ifdef HB_NO_OT_SHAPER_ARABIC_FALLBACK
|
||||
return;
|
||||
return false;
|
||||
#endif
|
||||
|
||||
const arabic_shape_plan_t *arabic_plan = (const arabic_shape_plan_t *) plan->data;
|
||||
|
||||
if (!arabic_plan->do_fallback)
|
||||
return;
|
||||
return false;
|
||||
|
||||
retry:
|
||||
arabic_fallback_plan_t *fallback_plan = arabic_plan->fallback_plan;
|
||||
|
@ -440,6 +441,7 @@ retry:
|
|||
}
|
||||
|
||||
arabic_fallback_plan_shape (fallback_plan, font, buffer);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -450,14 +452,14 @@ retry:
|
|||
* marks can use it as well.
|
||||
*/
|
||||
|
||||
static void
|
||||
static bool
|
||||
record_stch (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font HB_UNUSED,
|
||||
hb_buffer_t *buffer)
|
||||
{
|
||||
const arabic_shape_plan_t *arabic_plan = (const arabic_shape_plan_t *) plan->data;
|
||||
if (!arabic_plan->has_stch)
|
||||
return;
|
||||
return false;
|
||||
|
||||
/* 'stch' feature was just applied. Look for anything that multiplied,
|
||||
* and record it for stch treatment later. Note that rtlm, frac, etc
|
||||
|
@ -473,6 +475,7 @@ record_stch (const hb_ot_shape_plan_t *plan,
|
|||
info[i].arabic_shaping_action() = comp % 2 ? STCH_REPEATING : STCH_FIXED;
|
||||
buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_ARABIC_HAS_STCH;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -223,15 +223,15 @@ enum {
|
|||
INDIC_BASIC_FEATURES = INDIC_INIT, /* Don't forget to update this! */
|
||||
};
|
||||
|
||||
static void
|
||||
static bool
|
||||
setup_syllables_indic (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer);
|
||||
static void
|
||||
static bool
|
||||
initial_reordering_indic (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer);
|
||||
static void
|
||||
static bool
|
||||
final_reordering_indic (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer);
|
||||
|
@ -413,7 +413,7 @@ setup_masks_indic (const hb_ot_shape_plan_t *plan HB_UNUSED,
|
|||
set_indic_properties (info[i]);
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
setup_syllables_indic (const hb_ot_shape_plan_t *plan HB_UNUSED,
|
||||
hb_font_t *font HB_UNUSED,
|
||||
hb_buffer_t *buffer)
|
||||
|
@ -422,6 +422,7 @@ setup_syllables_indic (const hb_ot_shape_plan_t *plan HB_UNUSED,
|
|||
find_syllables_indic (buffer);
|
||||
foreach_syllable (buffer, start, end)
|
||||
buffer->unsafe_to_break (start, end);
|
||||
return false;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -981,25 +982,29 @@ initial_reordering_syllable_indic (const hb_ot_shape_plan_t *plan,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
initial_reordering_indic (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer)
|
||||
{
|
||||
bool ret = false;
|
||||
if (!buffer->message (font, "start reordering indic initial"))
|
||||
return;
|
||||
return ret;
|
||||
|
||||
update_consonant_positions_indic (plan, font, buffer);
|
||||
hb_syllabic_insert_dotted_circles (font, buffer,
|
||||
indic_broken_cluster,
|
||||
I_Cat(DOTTEDCIRCLE),
|
||||
I_Cat(Repha),
|
||||
POS_END);
|
||||
if (hb_syllabic_insert_dotted_circles (font, buffer,
|
||||
indic_broken_cluster,
|
||||
I_Cat(DOTTEDCIRCLE),
|
||||
I_Cat(Repha),
|
||||
POS_END))
|
||||
ret = true;
|
||||
|
||||
foreach_syllable (buffer, start, end)
|
||||
initial_reordering_syllable_indic (plan, font->face, buffer, start, end);
|
||||
|
||||
(void) buffer->message (font, "end reordering indic initial");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1465,13 +1470,13 @@ final_reordering_syllable_indic (const hb_ot_shape_plan_t *plan,
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
static bool
|
||||
final_reordering_indic (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font HB_UNUSED,
|
||||
hb_buffer_t *buffer)
|
||||
{
|
||||
unsigned int count = buffer->len;
|
||||
if (unlikely (!count)) return;
|
||||
if (unlikely (!count)) return false;
|
||||
|
||||
if (buffer->message (font, "start reordering indic final")) {
|
||||
foreach_syllable (buffer, start, end)
|
||||
|
@ -1481,6 +1486,8 @@ final_reordering_indic (const hb_ot_shape_plan_t *plan,
|
|||
|
||||
HB_BUFFER_DEALLOCATE_VAR (buffer, indic_category);
|
||||
HB_BUFFER_DEALLOCATE_VAR (buffer, indic_position);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -89,11 +89,11 @@ set_khmer_properties (hb_glyph_info_t &info)
|
|||
info.khmer_category() = (khmer_category_t) (type & 0xFFu);
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
setup_syllables_khmer (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer);
|
||||
static void
|
||||
static bool
|
||||
reorder_khmer (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer);
|
||||
|
@ -192,7 +192,7 @@ setup_masks_khmer (const hb_ot_shape_plan_t *plan HB_UNUSED,
|
|||
set_khmer_properties (info[i]);
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
setup_syllables_khmer (const hb_ot_shape_plan_t *plan HB_UNUSED,
|
||||
hb_font_t *font HB_UNUSED,
|
||||
hb_buffer_t *buffer)
|
||||
|
@ -201,6 +201,7 @@ setup_syllables_khmer (const hb_ot_shape_plan_t *plan HB_UNUSED,
|
|||
find_syllables_khmer (buffer);
|
||||
foreach_syllable (buffer, start, end)
|
||||
buffer->unsafe_to_break (start, end);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -303,23 +304,27 @@ reorder_syllable_khmer (const hb_ot_shape_plan_t *plan,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
reorder_khmer (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer)
|
||||
{
|
||||
bool ret = false;
|
||||
if (buffer->message (font, "start reordering khmer"))
|
||||
{
|
||||
hb_syllabic_insert_dotted_circles (font, buffer,
|
||||
khmer_broken_cluster,
|
||||
K_Cat(DOTTEDCIRCLE),
|
||||
(unsigned) -1);
|
||||
if (hb_syllabic_insert_dotted_circles (font, buffer,
|
||||
khmer_broken_cluster,
|
||||
K_Cat(DOTTEDCIRCLE),
|
||||
(unsigned) -1))
|
||||
ret = true;
|
||||
|
||||
foreach_syllable (buffer, start, end)
|
||||
reorder_syllable_khmer (plan, font->face, buffer, start, end);
|
||||
(void) buffer->message (font, "end reordering khmer");
|
||||
}
|
||||
HB_BUFFER_DEALLOCATE_VAR (buffer, khmer_category);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -98,11 +98,11 @@ is_consonant_myanmar (const hb_glyph_info_t &info)
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
static bool
|
||||
setup_syllables_myanmar (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer);
|
||||
static void
|
||||
static bool
|
||||
reorder_myanmar (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer);
|
||||
|
@ -150,7 +150,7 @@ setup_masks_myanmar (const hb_ot_shape_plan_t *plan HB_UNUSED,
|
|||
set_myanmar_properties (info[i]);
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
setup_syllables_myanmar (const hb_ot_shape_plan_t *plan HB_UNUSED,
|
||||
hb_font_t *font HB_UNUSED,
|
||||
hb_buffer_t *buffer)
|
||||
|
@ -159,6 +159,7 @@ setup_syllables_myanmar (const hb_ot_shape_plan_t *plan HB_UNUSED,
|
|||
find_syllables_myanmar (buffer);
|
||||
foreach_syllable (buffer, start, end)
|
||||
buffer->unsafe_to_break (start, end);
|
||||
return false;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -318,16 +319,18 @@ reorder_syllable_myanmar (const hb_ot_shape_plan_t *plan HB_UNUSED,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
reorder_myanmar (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer)
|
||||
{
|
||||
bool ret = false;
|
||||
if (buffer->message (font, "start reordering myanmar"))
|
||||
{
|
||||
hb_syllabic_insert_dotted_circles (font, buffer,
|
||||
myanmar_broken_cluster,
|
||||
M_Cat(DOTTEDCIRCLE));
|
||||
if (hb_syllabic_insert_dotted_circles (font, buffer,
|
||||
myanmar_broken_cluster,
|
||||
M_Cat(DOTTEDCIRCLE)))
|
||||
ret = true;
|
||||
|
||||
foreach_syllable (buffer, start, end)
|
||||
reorder_syllable_myanmar (plan, font->face, buffer, start, end);
|
||||
|
@ -336,6 +339,8 @@ reorder_myanmar (const hb_ot_shape_plan_t *plan,
|
|||
|
||||
HB_BUFFER_DEALLOCATE_VAR (buffer, myanmar_category);
|
||||
HB_BUFFER_DEALLOCATE_VAR (buffer, myanmar_position);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "hb-ot-shaper-syllabic.hh"
|
||||
|
||||
|
||||
void
|
||||
bool
|
||||
hb_syllabic_insert_dotted_circles (hb_font_t *font,
|
||||
hb_buffer_t *buffer,
|
||||
unsigned int broken_syllable_type,
|
||||
|
@ -38,13 +38,13 @@ hb_syllabic_insert_dotted_circles (hb_font_t *font,
|
|||
int dottedcircle_position)
|
||||
{
|
||||
if (unlikely (buffer->flags & HB_BUFFER_FLAG_DO_NOT_INSERT_DOTTED_CIRCLE))
|
||||
return;
|
||||
return false;
|
||||
if (likely (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE)))
|
||||
return;
|
||||
return false;
|
||||
|
||||
hb_codepoint_t dottedcircle_glyph;
|
||||
if (!font->get_nominal_glyph (0x25CCu, &dottedcircle_glyph))
|
||||
return;
|
||||
return false;
|
||||
|
||||
hb_glyph_info_t dottedcircle = {0};
|
||||
dottedcircle.codepoint = 0x25CCu;
|
||||
|
@ -84,14 +84,16 @@ hb_syllabic_insert_dotted_circles (hb_font_t *font,
|
|||
(void) buffer->next_glyph ();
|
||||
}
|
||||
buffer->sync ();
|
||||
return true;
|
||||
}
|
||||
|
||||
HB_INTERNAL void
|
||||
HB_INTERNAL bool
|
||||
hb_syllabic_clear_var (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer)
|
||||
{
|
||||
HB_BUFFER_DEALLOCATE_VAR (buffer, syllable);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "hb-ot-shaper.hh"
|
||||
|
||||
|
||||
HB_INTERNAL void
|
||||
HB_INTERNAL bool
|
||||
hb_syllabic_insert_dotted_circles (hb_font_t *font,
|
||||
hb_buffer_t *buffer,
|
||||
unsigned int broken_syllable_type,
|
||||
|
@ -38,7 +38,7 @@ hb_syllabic_insert_dotted_circles (hb_font_t *font,
|
|||
int repha_category = -1,
|
||||
int dottedcircle_position = -1);
|
||||
|
||||
HB_INTERNAL void
|
||||
HB_INTERNAL bool
|
||||
hb_syllabic_clear_var (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer);
|
||||
|
|
|
@ -89,19 +89,19 @@ use_other_features[] =
|
|||
HB_TAG('p','s','t','s'),
|
||||
};
|
||||
|
||||
static void
|
||||
static bool
|
||||
setup_syllables_use (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer);
|
||||
static void
|
||||
static bool
|
||||
record_rphf_use (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer);
|
||||
static void
|
||||
static bool
|
||||
record_pref_use (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer);
|
||||
static void
|
||||
static bool
|
||||
reorder_use (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer);
|
||||
|
@ -293,7 +293,7 @@ setup_topographical_masks (const hb_ot_shape_plan_t *plan,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
setup_syllables_use (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font HB_UNUSED,
|
||||
hb_buffer_t *buffer)
|
||||
|
@ -304,9 +304,10 @@ setup_syllables_use (const hb_ot_shape_plan_t *plan,
|
|||
buffer->unsafe_to_break (start, end);
|
||||
setup_rphf_mask (plan, buffer);
|
||||
setup_topographical_masks (plan, buffer);
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
record_rphf_use (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font HB_UNUSED,
|
||||
hb_buffer_t *buffer)
|
||||
|
@ -314,7 +315,7 @@ record_rphf_use (const hb_ot_shape_plan_t *plan,
|
|||
const use_shape_plan_t *use_plan = (const use_shape_plan_t *) plan->data;
|
||||
|
||||
hb_mask_t mask = use_plan->rphf_mask;
|
||||
if (!mask) return;
|
||||
if (!mask) return false;
|
||||
hb_glyph_info_t *info = buffer->info;
|
||||
|
||||
foreach_syllable (buffer, start, end)
|
||||
|
@ -327,9 +328,10 @@ record_rphf_use (const hb_ot_shape_plan_t *plan,
|
|||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
record_pref_use (const hb_ot_shape_plan_t *plan HB_UNUSED,
|
||||
hb_font_t *font HB_UNUSED,
|
||||
hb_buffer_t *buffer)
|
||||
|
@ -346,6 +348,7 @@ record_pref_use (const hb_ot_shape_plan_t *plan HB_UNUSED,
|
|||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
|
@ -438,17 +441,19 @@ reorder_syllable_use (hb_buffer_t *buffer, unsigned int start, unsigned int end)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
reorder_use (const hb_ot_shape_plan_t *plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer)
|
||||
{
|
||||
bool ret = false;
|
||||
if (buffer->message (font, "start reordering USE"))
|
||||
{
|
||||
hb_syllabic_insert_dotted_circles (font, buffer,
|
||||
use_broken_cluster,
|
||||
USE(B),
|
||||
USE(R));
|
||||
if (hb_syllabic_insert_dotted_circles (font, buffer,
|
||||
use_broken_cluster,
|
||||
USE(B),
|
||||
USE(R)))
|
||||
ret = true;
|
||||
|
||||
foreach_syllable (buffer, start, end)
|
||||
reorder_syllable_use (buffer, start, end);
|
||||
|
@ -457,6 +462,8 @@ reorder_use (const hb_ot_shape_plan_t *plan,
|
|||
}
|
||||
|
||||
HB_BUFFER_DEALLOCATE_VAR (buffer, use_category);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue