Index: third_party/harfbuzz-ng/src/hb-ot-layout-private.hh |
diff --git a/third_party/harfbuzz-ng/src/hb-ot-layout-private.hh b/third_party/harfbuzz-ng/src/hb-ot-layout-private.hh |
index f48184fd394da9b9f25c916465ed05852205a536..b5c670f694df50158ff01de09a392d4de5726b10 100644 |
--- a/third_party/harfbuzz-ng/src/hb-ot-layout-private.hh |
+++ b/third_party/harfbuzz-ng/src/hb-ot-layout-private.hh |
@@ -99,21 +99,20 @@ hb_ot_layout_substitute_lookup (OT::hb_apply_context_t *c, |
const hb_ot_layout_lookup_accelerator_t &accel); |
-/* Should be called after all the substitute_lookup's are done */ |
-HB_INTERNAL void |
-hb_ot_layout_substitute_finish (hb_font_t *font, |
- hb_buffer_t *buffer); |
- |
- |
-/* Should be called before all the position_lookup's are done. Resets positions to zero. */ |
+/* Should be called before all the position_lookup's are done. */ |
HB_INTERNAL void |
hb_ot_layout_position_start (hb_font_t *font, |
hb_buffer_t *buffer); |
-/* Should be called after all the position_lookup's are done */ |
+/* Should be called after all the position_lookup's are done, to finish advances. */ |
HB_INTERNAL void |
-hb_ot_layout_position_finish (hb_font_t *font, |
- hb_buffer_t *buffer); |
+hb_ot_layout_position_finish_advances (hb_font_t *font, |
+ hb_buffer_t *buffer); |
+ |
+/* Should be called after hb_ot_layout_position_finish_advances, to finish offsets. */ |
+HB_INTERNAL void |
+hb_ot_layout_position_finish_offsets (hb_font_t *font, |
+ hb_buffer_t *buffer); |
@@ -257,8 +256,11 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer) |
if (u == 0x200Cu) props |= UPROPS_MASK_ZWNJ; |
if (u == 0x200Du) props |= UPROPS_MASK_ZWJ; |
} |
- else if (unlikely (HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK (gen_cat))) |
+ else if (unlikely (HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK_OR_MODIFIER_SYMBOL (gen_cat))) |
{ |
+ /* The above check is just an optimization to let in only things we need further |
+ * processing on. */ |
+ |
/* Only Mn and Mc can have non-zero ccc: |
* http://www.unicode.org/policies/stability_policy.html#Property_Value |
* """ |
@@ -273,6 +275,16 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer) |
* the "else if". |
*/ |
props |= unicode->modified_combining_class (info->codepoint)<<8; |
+ |
+ /* Recategorize emoji skin-tone modifiers as Unicode mark, so they |
+ * behave correctly in non-native directionality. They originally |
+ * are MODIFIER_SYMBOL. Fixes: |
+ * https://github.com/behdad/harfbuzz/issues/169 |
+ */ |
+ if (unlikely (hb_in_range (u, 0x1F3FBu, 0x1F3FFu))) |
+ { |
+ props = gen_cat = HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK; |
+ } |
} |
} |
@@ -353,6 +365,12 @@ _hb_glyph_info_is_zwj (const hb_glyph_info_t *info) |
return !!(info->unicode_props() & UPROPS_MASK_ZWJ); |
} |
+static inline hb_bool_t |
+_hb_glyph_info_is_joiner (const hb_glyph_info_t *info) |
+{ |
+ return !!(info->unicode_props() & (UPROPS_MASK_ZWNJ | UPROPS_MASK_ZWJ)); |
+} |
+ |
static inline void |
_hb_glyph_info_flip_joiners (hb_glyph_info_t *info) |
{ |