Massage mask setting a bit more

Still finding the exact correct way the masks should be set.
This commit is contained in:
Behdad Esfahbod 2010-10-13 18:33:16 -04:00
parent 961f9baa7b
commit bd7378b2ef
3 changed files with 29 additions and 5 deletions

View File

@ -107,6 +107,10 @@ _hb_buffer_reset_masks (hb_buffer_t *buffer,
HB_INTERNAL void
_hb_buffer_add_masks (hb_buffer_t *buffer,
hb_mask_t mask);
HB_INTERNAL void
_hb_buffer_set_masks (hb_buffer_t *buffer,
hb_mask_t value,
hb_mask_t mask,
unsigned int cluster_start,
@ -165,12 +169,21 @@ struct _hb_buffer_t {
{ _hb_buffer_add_output_glyph (this, glyph_index, component, ligID); }
inline void replace_glyph (hb_codepoint_t glyph_index) { add_output_glyph (glyph_index); }
inline void reset_masks (hb_mask_t mask) { _hb_buffer_reset_masks (this, mask); }
inline void add_masks (hb_mask_t value,
inline void reset_masks (hb_mask_t mask)
{
for (unsigned int i = 0; i < len; i++)
info[i].mask = mask;
}
inline void add_masks (hb_mask_t mask)
{
for (unsigned int i = 0; i < len; i++)
info[i].mask |= mask;
}
inline void set_masks (hb_mask_t value,
hb_mask_t mask,
unsigned int cluster_start,
unsigned int cluster_end)
{ _hb_buffer_add_masks (this, value, mask, cluster_start, cluster_end); }
{ _hb_buffer_set_masks (this, value, mask, cluster_start, cluster_end); }
};

View File

@ -470,6 +470,15 @@ _hb_buffer_reset_masks (hb_buffer_t *buffer,
void
_hb_buffer_add_masks (hb_buffer_t *buffer,
hb_mask_t mask)
{
unsigned int count = buffer->len;
for (unsigned int i = 0; i < count; i++)
buffer->info[i].mask |= mask;
}
void
_hb_buffer_set_masks (hb_buffer_t *buffer,
hb_mask_t value,
hb_mask_t mask,
unsigned int cluster_start,

View File

@ -88,13 +88,15 @@ hb_ot_shape_setup_masks (hb_ot_shape_context_t *c)
hb_ot_shape_complex_setup_masks (c);
c->buffer->reset_masks (global_mask);
for (unsigned int i = 0; i < c->num_user_features; i++)
{
const hb_feature_t *feature = &c->user_features[i];
if (!(feature->start == 0 && feature->end == (unsigned int)-1)) {
unsigned int shift;
hb_mask_t mask = c->plan->map.get_mask (feature->tag, &shift);
c->buffer->add_masks (feature->value << shift, mask, feature->start, feature->end);
c->buffer->set_masks (feature->value << shift, mask, feature->start, feature->end);
}
}
}
@ -180,7 +182,7 @@ hb_mirror_chars (hb_ot_shape_context_t *c)
for (unsigned int i = 0; i < count; i++) {
hb_codepoint_t codepoint = get_mirroring (c->buffer->info[i].codepoint);
if (likely (codepoint == c->buffer->info[i].codepoint))
c->buffer->info[i].mask |= rtlm_mask;
c->buffer->info[i].mask |= rtlm_mask; /* XXX this should be moved to before setting user-feature masks */
else
c->buffer->info[i].codepoint = codepoint;
}