If there is no GPOS, zero mark advances.
If there *is* GPOS and the shaper requests so, zero mark advances for
attached marks.
Fixes regression with Tibetan, where the font has GPOS, and marks a
glyph as mark where it shouldn't get zero advance.
{ return get_lookup (lookup_index).apply_string (c); }
static inline void position_start (hb_font_t *font, hb_buffer_t *buffer);
- static inline void position_finish (hb_font_t *font, hb_buffer_t *buffer);
+ static inline void position_finish (hb_font_t *font, hb_buffer_t *buffer, hb_bool_t zero_width_attahced_marks);
inline bool sanitize (hb_sanitize_context_t *c) {
TRACE_SANITIZE ();
}
static void
-fix_mark_attachment (hb_glyph_position_t *pos, unsigned int i, hb_direction_t direction)
+fix_mark_attachment (hb_glyph_position_t *pos, unsigned int i, hb_direction_t direction, hb_bool_t zero_width_attached_marks)
{
if (likely (!(pos[i].attach_lookback())))
return;
unsigned int j = i - pos[i].attach_lookback();
-// pos[i].x_advance = 0;
-// pos[i].y_advance = 0;
+ if (zero_width_attached_marks) {
+ pos[i].x_advance = 0;
+ pos[i].y_advance = 0;
+ }
pos[i].x_offset += pos[j].x_offset;
pos[i].y_offset += pos[j].y_offset;
}
void
-GPOS::position_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
+GPOS::position_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer, hb_bool_t zero_width_attached_marks)
{
unsigned int len;
hb_glyph_position_t *pos = hb_buffer_get_glyph_positions (buffer, &len);
/* Handle attachments */
for (unsigned int i = 0; i < len; i++)
- fix_mark_attachment (pos, i, direction);
+ fix_mark_attachment (pos, i, direction, zero_width_attached_marks);
HB_BUFFER_DEALLOCATE_VAR (buffer, syllable);
HB_BUFFER_DEALLOCATE_VAR (buffer, lig_props);
}
void
-hb_ot_layout_position_finish (hb_font_t *font, hb_buffer_t *buffer)
+hb_ot_layout_position_finish (hb_font_t *font, hb_buffer_t *buffer, hb_bool_t zero_width_attached_marks)
{
- GPOS::position_finish (font, buffer);
+ GPOS::position_finish (font, buffer, zero_width_attached_marks);
}
/* Should be called after all the position_lookup's are done */
void
hb_ot_layout_position_finish (hb_font_t *font,
- hb_buffer_t *buffer);
+ hb_buffer_t *buffer,
+ hb_bool_t zero_width_attached_marks);
HB_END_DECLS
NULL, /* override_features */
NULL, /* normalization_preference */
setup_masks_arabic,
- true, /* zero_width_marks */
+ true, /* zero_width_attached_marks */
};
override_features_indic,
NULL, /* normalization_preference */
setup_masks_indic,
- false, /* zero_width_marks */
+ false, /* zero_width_attached_marks */
};
NULL, /* override_features */
normalization_preference_default,
NULL, /* setup_masks */
- true, /* zero_width_marks */
+ true, /* zero_width_attached_marks */
};
NULL, /* override_features */
NULL, /* normalization_preference */
setup_masks_thai,
- true, /* zero_width_marks */
+ true, /* zero_width_attached_marks */
};
hb_buffer_t *buffer,
hb_font_t *font);
- bool zero_width_marks;
+ bool zero_width_attached_marks;
};
#define HB_COMPLEX_SHAPER_IMPLEMENT(name) extern HB_INTERNAL const hb_ot_complex_shaper_t _hb_ot_complex_shaper_##name;
}
c->applied_position_complex = true;
- }
-
- if (c->plan->shaper->zero_width_marks)
+ } else
hb_zero_mark_advances (c);
- hb_ot_layout_position_finish (c->font, c->buffer);
+ hb_ot_layout_position_finish (c->font, c->buffer, c->plan->shaper->zero_width_attached_marks);
return;
}