From 2f2cdd3958fa09b97b74cfd72ec5dd154aa2534e Mon Sep 17 00:00:00 2001 From: kakwani Date: Thu, 3 Mar 2011 16:30:26 +0530 Subject: [PATCH] Harfbuzz Malayalam text rendering bug fix --- src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp | 67 +++++++++++++++++++------- 1 files changed, 50 insertions(+), 17 deletions(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp index 237c9ae..3f1ba9d 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp @@ -833,7 +833,7 @@ static const unsigned char indicPosition[0xe00-0x900] = { None, None, None, None, None, None, None, Post, - Pre, None, Below, None, + Post, None, Below, None, None, Post, None, None, None, None, None, None, None, None, Post, Post, @@ -1664,6 +1664,39 @@ static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool inv } } + // Move the combined glyph for Ra + H before the base + // glyph for Malayalam script + if((script == HB_Script_Malayalam)) + { + for(i = 0; i < len; i++) + { + if(form(reordered[i]) == Consonant) + { + if(i+2 < len) + { + if(reordered[i+1] == ra && reordered[i+2] == halant) + { + // Find the base glyph in the shaped string + int basePos = 0; + while (basePos < newLen && (int)otl_glyphs[basePos].cluster <= base) + basePos++; + --basePos; + + // If there has been a ligature substitution, then there is + // no need to reposition Ra+H glyph before the base glyph + if((int)otl_glyphs[basePos].ligID != 0) + break; + HB_GlyphItemRec m = otl_glyphs[basePos]; + otl_glyphs[basePos] = otl_glyphs[basePos+1]; + otl_glyphs[basePos+1] = m; + } + } + else + break; + } + } + } + HB_Bool positioned = HB_OpenTypePosition(item, availableGlyphs, false); HB_FREE_STACKARRAY(clusters); -- 1.7.3.1.msysgit.0