{ return CastR<PosLookup> (GSUBGPOS::get_lookup (i)); }
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, hb_bool_t zero_width_attahced_marks);
+ static inline void position_finish (hb_font_t *font, hb_buffer_t *buffer);
inline bool sanitize (hb_sanitize_context_t *c) {
TRACE_SANITIZE (this);
}
static void
-fix_mark_attachment (hb_glyph_position_t *pos, unsigned int i, hb_direction_t direction, hb_bool_t zero_width_attached_marks)
+fix_mark_attachment (hb_glyph_position_t *pos, unsigned int i, hb_direction_t direction)
{
if (likely (!(pos[i].attach_lookback())))
return;
unsigned int j = i - pos[i].attach_lookback();
- 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, hb_bool_t zero_width_attached_marks)
+GPOS::position_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
{
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, zero_width_attached_marks);
+ fix_mark_attachment (pos, i, direction);
HB_BUFFER_DEALLOCATE_VAR (buffer, syllable);
HB_BUFFER_DEALLOCATE_VAR (buffer, lig_props);
/* Should be called after all the position_lookup's are done */
HB_INTERNAL void
hb_ot_layout_position_finish (hb_font_t *font,
- hb_buffer_t *buffer,
- hb_bool_t zero_width_attached_marks);
+ hb_buffer_t *buffer);
}
void
-hb_ot_layout_position_finish (hb_font_t *font, hb_buffer_t *buffer, hb_bool_t zero_width_attached_marks)
+hb_ot_layout_position_finish (hb_font_t *font, hb_buffer_t *buffer)
{
- OT::GPOS::position_finish (font, buffer, zero_width_attached_marks);
+ OT::GPOS::position_finish (font, buffer);
}
hb_bool_t
NULL, /* decompose */
NULL, /* compose */
setup_masks_arabic,
- true, /* zero_width_attached_marks */
+ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE,
true, /* fallback_position */
};
NULL, /* decompose */
compose_default,
NULL, /* setup_masks */
- true, /* zero_width_attached_marks */
+ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE,
true, /* fallback_position */
};
decompose_indic,
compose_indic,
setup_masks_indic,
- false, /* zero_width_attached_marks */
+ HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
false, /* fallback_position */
};
NULL, /* decompose */
NULL, /* compose */
setup_masks_myanmar,
- false, /* zero_width_attached_marks */
+ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF,
false, /* fallback_position */
};
#define complex_var_u8_1() var2.u8[3]
+enum hb_ot_shape_zero_width_marks_type_t {
+ HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
+ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE,
+ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF
+};
+
/* Master OT shaper list */
#define HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS \
hb_buffer_t *buffer,
hb_font_t *font);
- bool zero_width_attached_marks;
+ hb_ot_shape_zero_width_marks_type_t zero_width_marks;
+
bool fallback_position;
};
NULL, /* decompose */
NULL, /* compose */
NULL, /* setup_masks */
- true, /* zero_width_attached_marks */
+ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE,
false,/* fallback_position */
};
hb_ot_layout_position_start (c->font, c->buffer);
unsigned int count = c->buffer->len;
- for (unsigned int i = 0; i < count; i++) {
+ for (unsigned int i = 0; i < count; i++)
+ {
c->font->get_glyph_advance_for_direction (c->buffer->info[i].codepoint,
c->buffer->props.direction,
&c->buffer->pos[i].x_advance,
c->buffer->props.direction,
&c->buffer->pos[i].x_offset,
&c->buffer->pos[i].y_offset);
+
+ }
+
+ switch (c->plan->shaper->zero_width_marks)
+ {
+ case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE:
+ for (unsigned int i = 0; i < count; i++)
+ if (_hb_glyph_info_get_general_category (&c->buffer->info[i]) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
+ {
+ c->buffer->pos[i].x_advance = 0;
+ c->buffer->pos[i].y_advance = 0;
+ }
+ break;
+
+ case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF:
+ for (unsigned int i = 0; i < count; i++)
+ if ((c->buffer->info[i].glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MARK))
+ {
+ c->buffer->pos[i].x_advance = 0;
+ c->buffer->pos[i].y_advance = 0;
+ }
+ break;
+
+ default:
+ case HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE:
+ break;
}
}
ret = true;
}
- hb_ot_layout_position_finish (c->font, c->buffer, c->plan->shaper->zero_width_attached_marks);
+ hb_ot_layout_position_finish (c->font, c->buffer);
return ret;
}