Index: third_party/harfbuzz-ng/src/hb-ot-shape.cc |
diff --git a/third_party/harfbuzz-ng/src/hb-ot-shape.cc b/third_party/harfbuzz-ng/src/hb-ot-shape.cc |
index 1d9783e33bfedde5f2d8ee61727123adf25e7ec9..c13d94bfd633a172a7e04b18b82ec0e69c275659 100644 |
--- a/third_party/harfbuzz-ng/src/hb-ot-shape.cc |
+++ b/third_party/harfbuzz-ng/src/hb-ot-shape.cc |
@@ -145,7 +145,7 @@ _hb_ot_shaper_face_data_destroy (hb_ot_shaper_face_data_t *data) |
struct hb_ot_shaper_font_data_t {}; |
hb_ot_shaper_font_data_t * |
-_hb_ot_shaper_font_data_create (hb_font_t *font) |
+_hb_ot_shaper_font_data_create (hb_font_t *font HB_UNUSED) |
{ |
return (hb_ot_shaper_font_data_t *) HB_SHAPER_DATA_SUCCEEDED; |
} |
@@ -267,13 +267,14 @@ hb_form_clusters (hb_buffer_t *buffer) |
buffer->cluster_level != HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES) |
return; |
- /* Loop duplicated in hb_ensure_native_direction(). */ |
+ /* Loop duplicated in hb_ensure_native_direction(), and in _hb-coretext.cc */ |
unsigned int base = 0; |
unsigned int count = buffer->len; |
hb_glyph_info_t *info = buffer->info; |
for (unsigned int i = 1; i < count; i++) |
{ |
- if (likely (!HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&info[i])))) |
+ if (likely (!HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&info[i])) && |
+ !_hb_glyph_info_is_joiner (&info[i]))) |
{ |
buffer->merge_clusters (base, i); |
base = i; |
@@ -584,8 +585,6 @@ hb_ot_substitute_complex (hb_ot_shape_context_t *c) |
c->plan->substitute (c->font, buffer); |
- hb_ot_layout_substitute_finish (c->font, buffer); |
- |
return; |
} |
@@ -635,10 +634,6 @@ zero_mark_widths_by_unicode (hb_buffer_t *buffer, bool adjust_offsets) |
static inline void |
zero_mark_widths_by_gdef (hb_buffer_t *buffer, bool adjust_offsets) |
{ |
- /* This one is a hack; Technically GDEF can mark ASCII glyphs as marks, but we don't listen. */ |
- if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII)) |
- return; |
- |
unsigned int count = buffer->len; |
hb_glyph_info_t *info = buffer->info; |
for (unsigned int i = 0; i < count; i++) |
@@ -686,9 +681,12 @@ hb_ot_position_default (hb_ot_shape_context_t *c) |
static inline bool |
hb_ot_position_complex (hb_ot_shape_context_t *c) |
{ |
+ hb_ot_layout_position_start (c->font, c->buffer); |
+ |
bool ret = false; |
unsigned int count = c->buffer->len; |
bool has_positioning = (bool) hb_ot_layout_has_positioning (c->face); |
+ |
/* If the font has no GPOS, AND, no fallback positioning will |
* happen, AND, direction is forward, then when zeroing mark |
* widths, we shift the mark with it, such that the mark |
@@ -763,22 +761,23 @@ hb_ot_position_complex (hb_ot_shape_context_t *c) |
break; |
} |
+ /* Finishing off GPOS has to follow a certain order. */ |
+ hb_ot_layout_position_finish_advances (c->font, c->buffer); |
+ hb_ot_zero_width_default_ignorables (c); |
+ hb_ot_layout_position_finish_offsets (c->font, c->buffer); |
+ |
return ret; |
} |
static inline void |
hb_ot_position (hb_ot_shape_context_t *c) |
{ |
- hb_ot_layout_position_start (c->font, c->buffer); |
+ c->buffer->clear_positions (); |
hb_ot_position_default (c); |
hb_bool_t fallback = !hb_ot_position_complex (c); |
- hb_ot_zero_width_default_ignorables (c); |
- |
- hb_ot_layout_position_finish (c->font, c->buffer); |
- |
if (fallback && c->plan->shaper->fallback_position) |
_hb_ot_shape_fallback_position (c->plan, c->font, c->buffer); |