summaryrefslogtreecommitdiff
path: root/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc')
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc287
1 files changed, 14 insertions, 273 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc
index f1ae303adcc..4f98f748024 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc
@@ -25,6 +25,7 @@
*/
#include "hb-ot-shape-complex-indic.hh"
+#include "hb-ot-shape-complex-vowel-constraints.hh"
#include "hb-ot-layout.hh"
@@ -115,7 +116,8 @@ indic_features[] =
{HB_TAG('c','j','c','t'), F_GLOBAL_MANUAL_JOINERS},
/*
* Other features.
- * These features are applied all at once, after final_reordering.
+ * These features are applied all at once, after final_reordering
+ * but before clearing syllables.
* Default Bengali font in Windows for example has intermixed
* lookups for init,pres,abvs,blws features.
*/
@@ -250,8 +252,6 @@ struct would_substitute_feature_t
struct indic_shape_plan_t
{
- ASSERT_POD ();
-
inline bool load_virama_glyph (hb_font_t *font, hb_codepoint_t *pglyph) const
{
hb_codepoint_t glyph = virama_glyph.get_relaxed ();
@@ -331,275 +331,6 @@ data_destroy_indic (void *data)
free (data);
}
-static void
-_output_with_dotted_circle (hb_buffer_t *buffer)
-{
- hb_glyph_info_t &dottedcircle = buffer->output_glyph (0x25CCu);
- _hb_glyph_info_reset_continuation (&dottedcircle);
-
- buffer->next_glyph ();
-}
-
-static void
-preprocess_text_indic (const hb_ot_shape_plan_t *plan,
- hb_buffer_t *buffer,
- hb_font_t *font)
-{
- /* UGLY UGLY UGLY business of adding dotted-circle in the middle of
- * vowel-sequences that look like another vowel. Data for each script
- * collected from Unicode 11 book, tables named "Vowel Letters" with
- * "Use" and "Do Not Use" columns.
- *
- * https://github.com/harfbuzz/harfbuzz/issues/1019
- */
- bool processed = false;
- buffer->clear_output ();
- unsigned int count = buffer->len;
- switch ((unsigned) buffer->props.script)
- {
- case HB_SCRIPT_DEVANAGARI:
- for (buffer->idx = 0; buffer->idx + 1 < count && buffer->successful;)
- {
- bool matched = false;
- switch (buffer->cur().codepoint)
- {
- case 0x0905u:
- switch (buffer->cur(1).codepoint)
- {
- case 0x093Au: case 0x093Bu: case 0x093Eu: case 0x0945u:
- case 0x0946u: case 0x0949u: case 0x094Au: case 0x094Bu:
- case 0x094Cu: case 0x094Fu: case 0x0956u: case 0x0957u:
- matched = true;
- break;
- }
- break;
- case 0x0906u:
- switch (buffer->cur(1).codepoint)
- {
- case 0x093Au: case 0x0945u: case 0x0946u: case 0x0947u:
- case 0x0948u:
- matched = true;
- break;
- }
- break;
- case 0x0909u:
- switch (buffer->cur(1).codepoint)
- {
- case 0x0941u:
- matched = true;
- break;
- }
- break;
- case 0x090Fu:
- switch (buffer->cur(1).codepoint)
- {
- case 0x0945u: case 0x0946u: case 0x0947u:
- matched = true;
- break;
- }
- break;
- case 0x0930u:
- if (0x094Du == buffer->cur(1).codepoint &&
- buffer->idx + 2 < count &&
- 0x0907u == buffer->cur(2).codepoint)
- {
- buffer->next_glyph ();
- buffer->next_glyph ();
- buffer->output_glyph (0x25CCu);
- }
- break;
- }
- buffer->next_glyph ();
- if (matched) _output_with_dotted_circle (buffer);
- }
- processed = true;
- break;
-
- case HB_SCRIPT_BENGALI:
- for (buffer->idx = 0; buffer->idx + 1 < count && buffer->successful;)
- {
- bool matched = false;
- switch (buffer->cur().codepoint)
- {
- case 0x0985u:
- matched = 0x09BE == buffer->cur(1).codepoint;
- break;
- case 0x098Bu:
- matched = 0x09C3 == buffer->cur(1).codepoint;
- break;
- case 0x098Cu:
- matched = 0x09E2 == buffer->cur(1).codepoint;
- break;
- }
- buffer->next_glyph ();
- if (matched) _output_with_dotted_circle (buffer);
- }
- processed = true;
- break;
-
- case HB_SCRIPT_GURMUKHI:
- for (buffer->idx = 0; buffer->idx + 1 < count && buffer->successful;)
- {
- bool matched = false;
- switch (buffer->cur().codepoint)
- {
- case 0x0A05u:
- switch (buffer->cur(1).codepoint)
- {
- case 0x0A3Eu: case 0x0A48u: case 0x0A4Cu:
- matched = true;
- break;
- }
- break;
- case 0x0A72u:
- switch (buffer->cur(1).codepoint)
- {
- case 0x0A3Fu: case 0x0A40u: case 0x0A47u:
- matched = true;
- break;
- }
- break;
- case 0x0A73u:
- switch (buffer->cur(1).codepoint)
- {
- case 0x0A41u: case 0x0A42u: case 0x0A4Bu:
- matched = true;
- break;
- }
- break;
- }
- buffer->next_glyph ();
- if (matched) _output_with_dotted_circle (buffer);
- }
- processed = true;
- break;
-
- case HB_SCRIPT_GUJARATI:
- for (buffer->idx = 0; buffer->idx + 1 < count && buffer->successful;)
- {
- bool matched = false;
- switch (buffer->cur().codepoint)
- {
- case 0x0A85u:
- switch (buffer->cur(1).codepoint)
- {
- case 0x0ABEu: case 0x0AC5u: case 0x0AC7u: case 0x0AC8u:
- case 0x0AC9u: case 0x0ACBu: case 0x0ACCu:
- matched = true;
- break;
- }
- break;
- case 0x0AC5u:
- matched = 0x0ABE == buffer->cur(1).codepoint;
- break;
- }
- buffer->next_glyph ();
- if (matched) _output_with_dotted_circle (buffer);
- }
- processed = true;
- break;
-
- case HB_SCRIPT_ORIYA:
- for (buffer->idx = 0; buffer->idx + 1 < count && buffer->successful;)
- {
- bool matched = false;
- switch (buffer->cur().codepoint)
- {
- case 0x0B05u:
- matched = 0x0B3E == buffer->cur(1).codepoint;
- break;
- case 0x0B0Fu: case 0x0B13u:
- matched = 0x0B57 == buffer->cur(1).codepoint;
- break;
- }
- buffer->next_glyph ();
- if (matched) _output_with_dotted_circle (buffer);
- }
- processed = true;
- break;
-
- case HB_SCRIPT_TELUGU:
- for (buffer->idx = 0; buffer->idx + 1 < count && buffer->successful;)
- {
- bool matched = false;
- switch (buffer->cur().codepoint)
- {
- case 0x0C12u:
- switch (buffer->cur(1).codepoint)
- {
- case 0x0C4Cu: case 0x0C55u:
- matched = true;
- break;
- }
- break;
- case 0x0C3Fu: case 0x0C46u: case 0xC4Au:
- matched = 0x0C55 == buffer->cur(1).codepoint;
- break;
- }
- buffer->next_glyph ();
- if (matched) _output_with_dotted_circle (buffer);
- }
- processed = true;
- break;
-
- case HB_SCRIPT_KANNADA:
- for (buffer->idx = 0; buffer->idx + 1 < count && buffer->successful;)
- {
- bool matched = false;
- switch (buffer->cur().codepoint)
- {
- case 0x0C89u: case 0x0C8Bu:
- matched = 0x0CBE == buffer->cur(1).codepoint;
- break;
- case 0x0C92u:
- matched = 0x0CCC == buffer->cur(1).codepoint;
- break;
- }
- buffer->next_glyph ();
- if (matched) _output_with_dotted_circle (buffer);
- }
- processed = true;
- break;
-
- case HB_SCRIPT_MALAYALAM:
- for (buffer->idx = 0; buffer->idx + 1 < count && buffer->successful;)
- {
- bool matched = false;
- switch (buffer->cur().codepoint)
- {
- case 0x0D07u: case 0x0D09u:
- matched = 0x0D57 == buffer->cur(1).codepoint;
- break;
- case 0x0D0Eu:
- matched = 0x0D46 == buffer->cur(1).codepoint;
- break;
- case 0x0D12u:
- switch (buffer->cur(1).codepoint)
- {
- case 0x0D3Eu: case 0x0D57u:
- matched = true;
- break;
- }
- break;
- }
- buffer->next_glyph ();
- if (matched) _output_with_dotted_circle (buffer);
- }
- processed = true;
- break;
-
- default:
- break;
- }
- if (processed)
- {
- if (buffer->idx < count)
- buffer->next_glyph ();
- if (likely (buffer->successful))
- buffer->swap_buffers ();
- }
-}
-
static indic_position_t
consonant_position_from_face (const indic_shape_plan_t *indic_plan,
const hb_codepoint_t consonant,
@@ -1055,8 +786,10 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
*
* We could use buffer->sort() for this, if there was no special
* reordering of pre-base stuff happening later...
+ * We don't want to merge_clusters all of that, which buffer->sort()
+ * would.
*/
- if (indic_plan->is_old_spec || end - base > 127)
+ if (indic_plan->is_old_spec || end - start > 127)
buffer->merge_clusters (base, end);
else
{
@@ -1785,6 +1518,14 @@ clear_syllables (const hb_ot_shape_plan_t *plan HB_UNUSED,
}
+static void
+preprocess_text_indic (const hb_ot_shape_plan_t *plan,
+ hb_buffer_t *buffer,
+ hb_font_t *font)
+{
+ _hb_preprocess_text_vowel_constraints (plan, buffer, font);
+}
+
static bool
decompose_indic (const hb_ot_shape_normalize_context_t *c,
hb_codepoint_t ab,