From 0f795650f811d6f27557655c3ab8001fc20f6780 Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Wed, 8 Jun 2011 14:05:22 -0500 Subject: [PATCH] usp10: Strip dangling joiners for Sinhala. --- dlls/usp10/shape.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dlls/usp10/shape.c b/dlls/usp10/shape.c index f64dbd713e..03d97f4bc6 100644 --- a/dlls/usp10/shape.c +++ b/dlls/usp10/shape.c @@ -2036,6 +2036,7 @@ static const VowelComponents Sinhala_vowels[] = { static void ContextualShape_Sinhala(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust) { int cCount = cChars; + int i; WCHAR *input; if (*pcGlyphs != cChars) @@ -2057,7 +2058,15 @@ static void ContextualShape_Sinhala(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS * Indic_ReorderCharacters( input, cCount, sinhala_lex, Reorder_Like_Sinhala); TRACE("reordered string %s\n",debugstr_wn(input,cCount)); - /* Step 3: Get glyphs */ + /* Step 3: Strip dangling joiners */ + for (i = 0; i < cCount; i++) + { + if ((input[i] == 0x200D || input[i] == 0x200C) && + (i == 0 || input[i-1] == 0x0020 || i == cCount-1 || input[i+1] == 0x0020)) + input[i] = 0x0020; + } + + /* Step 4: Get glyphs */ GetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0); *pcGlyphs = cCount; -- 2.32.0.93.g670b81a890