Behdad: <ping> re this issue .... any thoughts?
It would be really helpful to us if we could do a change like this; do
you think it's likely to be a problem in any way?
-------- Forwarded Message --------
Subject: adjustment to merge_clusters?
Date: Mon, 30 Nov 2015 07:30:17 +0000
From: Jonathan Kew <[email protected]>
To: Behdad Esfahbod <[email protected]>
CC: Harfbuzz <[email protected]>
Hey Behdad,
I'm wondering if we can make merge_clusters a little more conservative....?
Here's the scenario:
Assume we start with two independent base glyphs with distinct cluster
numbers:
<glyphA.0, glyphB.1>
Then a MultipleSubst lookup expands glyphB to two parts, which both
inherit glyphB's cluster value:
<glyphA.0, glyphB1.1, glyphB2.1>
Next, a LigatureSubst lookup combines glyphA with glyphB1. Currently,
because merge_clusters extends its target range to include any following
glyphs that share the same cluster value as the last one in the range,
we'll get:
<glyphAB1.0, glyphB2.0>
which ISTM is less than ideal. It's not clear to me that there's any
totally "right" result here, but what would seem more useful to me, at
least, would be to leave glyphB2's cluster untouched:
<glyphAB1.0, glyphB2.1>
(In particular, this would resolve
https://bugzilla.mozilla.org/show_bug.cgi?id=1212668.)
I assume we'd still want to extend the end in merge_clusters when the
following glyph(s) are marks, so could we do something like the attached?
JK
diff --git a/gfx/harfbuzz/src/hb-buffer.cc b/gfx/harfbuzz/src/hb-buffer.cc
--- a/gfx/harfbuzz/src/hb-buffer.cc
+++ b/gfx/harfbuzz/src/hb-buffer.cc
@@ -24,16 +24,17 @@
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Red Hat Author(s): Owen Taylor, Behdad Esfahbod
* Google Author(s): Behdad Esfahbod
*/
#include "hb-buffer-private.hh"
#include "hb-utf-private.hh"
+#include "hb-ot-layout-private.hh"
#ifndef HB_DEBUG_BUFFER
#define HB_DEBUG_BUFFER (HB_DEBUG+0)
#endif
/**
@@ -531,18 +532,19 @@ hb_buffer_t::merge_clusters_impl (unsign
if (cluster_level == HB_BUFFER_CLUSTER_LEVEL_CHARACTERS)
return;
unsigned int cluster = info[start].cluster;
for (unsigned int i = start + 1; i < end; i++)
cluster = MIN (cluster, info[i].cluster);
- /* Extend end */
- while (end < len && info[end - 1].cluster == info[end].cluster)
+ /* Extend end to include any trailing mark glyphs */
+ while (end < len && info[end - 1].cluster == info[end].cluster &&
+ (_hb_glyph_info_get_glyph_props (&info[end]) & HB_OT_LAYOUT_GLYPH_PROPS_MARK))
end++;
/* Extend start */
while (idx < start && info[start - 1].cluster == info[start].cluster)
start--;
/* If we hit the start of buffer, continue in out-buffer. */
if (idx == start)
_______________________________________________
HarfBuzz mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/harfbuzz