summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-normalize.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/harfbuzz-ng/src/hb-ot-shape-normalize.cc')
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-normalize.cc50
1 files changed, 7 insertions, 43 deletions
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-normalize.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-normalize.cc
index 8cc64af014..0a4d40499f 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-normalize.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-normalize.cc
@@ -62,24 +62,12 @@
* with previous base, use that. This needs the itemizer to have this
* knowledge too. We need to provide assistance to the itemizer.
*
- * - When a font does not support a character but supports its decomposition,
- * well, use the decomposition (preferring the canonical decomposition, but
- * falling back to the compatibility decomposition if necessary). The
- * compatibility decomposition is really nice to have, for characters like
- * ellipsis, or various-sized space characters.
+ * - When a font does not support a character but supports its canonical
+ * decomposition, well, use the decomposition.
*
* - The complex shapers can customize the compose and decompose functions to
* offload some of their requirements to the normalizer. For example, the
* Indic shaper may want to disallow recomposing of two matras.
- *
- * - We try compatibility decomposition if decomposing through canonical
- * decomposition alone failed to find a sequence that the font supports.
- * We don't try compatibility decomposition recursively during the canonical
- * decomposition phase. This has minimal impact. There are only a handful
- * of Greek letter that have canonical decompositions that include characters
- * with compatibility decomposition. Those can be found using this command:
- *
- * egrep "`echo -n ';('; grep ';<' UnicodeData.txt | cut -d';' -f1 | tr '\n' '|'; echo ') '`" UnicodeData.txt
*/
static bool
@@ -171,28 +159,6 @@ decompose (const hb_ot_shape_normalize_context_t *c, bool shortest, hb_codepoint
return 0;
}
-/* Returns 0 if didn't decompose, number of resulting characters otherwise. */
-static inline unsigned int
-decompose_compatibility (const hb_ot_shape_normalize_context_t *c, hb_codepoint_t u)
-{
- unsigned int len, i;
- hb_codepoint_t decomposed[HB_UNICODE_MAX_DECOMPOSITION_LEN];
- hb_codepoint_t glyphs[HB_UNICODE_MAX_DECOMPOSITION_LEN];
-
- len = c->buffer->unicode->decompose_compatibility (u, decomposed);
- if (!len)
- return 0;
-
- for (i = 0; i < len; i++)
- if (!c->font->get_glyph (decomposed[i], 0, &glyphs[i]))
- return 0;
-
- for (i = 0; i < len; i++)
- output_char (c->buffer, decomposed[i], glyphs[i]);
-
- return len;
-}
-
static inline void
decompose_current_character (const hb_ot_shape_normalize_context_t *c, bool shortest)
{
@@ -207,8 +173,6 @@ decompose_current_character (const hb_ot_shape_normalize_context_t *c, bool shor
skip_char (buffer);
else if (!shortest && c->font->get_glyph (u, 0, &glyph))
next_char (buffer, glyph);
- else if (decompose_compatibility (c, u))
- skip_char (buffer);
else
next_char (buffer, glyph); /* glyph is initialized in earlier branches. */
}
@@ -290,6 +254,8 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer,
hb_font_t *font)
{
+ if (unlikely (!buffer->len)) return;
+
_hb_buffer_assert_unicode_vars (buffer);
hb_ot_shape_normalization_mode_t mode = plan->shaper->normalization_preference;
@@ -323,7 +289,7 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
{
unsigned int end;
for (end = buffer->idx + 1; end < count; end++)
- if (buffer->cur().cluster != buffer->info[end].cluster)
+ if (likely (!HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&buffer->info[end]))))
break;
decompose_cluster (&c, end, might_short_circuit, always_short_circuit);
@@ -344,15 +310,13 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
if (_hb_glyph_info_get_modified_combining_class (&buffer->info[end]) == 0)
break;
- /* We are going to do a bubble-sort. Only do this if the
- * sequence is short. Doing it on long sequences can result
- * in an O(n^2) DoS. */
+ /* We are going to do a O(n^2). Only do this if the sequence is short. */
if (end - i > 10) {
i = end;
continue;
}
- hb_bubble_sort (buffer->info + i, end - i, compare_combining_class);
+ buffer->sort (i, end, compare_combining_class);
i = end;
}