Index: third_party/harfbuzz-ng/src/hb-ot-layout-gsub-table.hh |
diff --git a/third_party/harfbuzz-ng/src/hb-ot-layout-gsub-table.hh b/third_party/harfbuzz-ng/src/hb-ot-layout-gsub-table.hh |
index 7de56cf2a2bbe6af77c6a9c7bc002d96f2dae738..22031f43ced21099fcd44f44dea427d1399d5dbc 100644 |
--- a/third_party/harfbuzz-ng/src/hb-ot-layout-gsub-table.hh |
+++ b/third_party/harfbuzz-ng/src/hb-ot-layout-gsub-table.hh |
@@ -265,16 +265,6 @@ struct Sequence |
TRACE_APPLY (this); |
unsigned int count = substitute.len; |
- /* TODO: |
- * Testing shows that Uniscribe actually allows zero-len susbstitute, |
- * which essentially deletes a glyph. We don't allow for now. It |
- * can be confusing to the client since the cluster from the deleted |
- * glyph won't be merged with any output cluster... Also, currently |
- * buffer->move_to() makes assumptions about this too. Perhaps fix |
- * in the future after figuring out what to do with the clusters. |
- */ |
- if (unlikely (!count)) return_trace (false); |
- |
/* Special-case to make it in-place and not consider this |
* as a "multiplied" substitution. */ |
if (unlikely (count == 1)) |
@@ -282,6 +272,13 @@ struct Sequence |
c->replace_glyph (substitute.array[0]); |
return_trace (true); |
} |
+ /* Spec disallows this, but Uniscribe allows it. |
+ * https://github.com/behdad/harfbuzz/issues/253 */ |
+ else if (unlikely (count == 0)) |
+ { |
+ c->buffer->delete_glyph (); |
+ return_trace (true); |
+ } |
unsigned int klass = _hb_glyph_info_is_ligature (&c->buffer->cur()) ? |
HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH : 0; |