Aric Stewart : usp10: Insert dotted circle (U+25CC) for invalid combining sequences in Thai.

Alexandre Julliard julliard at winehq.org
Mon Jun 4 13:27:13 CDT 2012


Module: wine
Branch: master
Commit: 28854b452e5789d0ec5d695cd097cb20fbc47e02
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=28854b452e5789d0ec5d695cd097cb20fbc47e02

Author: Aric Stewart <aric at codeweavers.com>
Date:   Mon Jun  4 07:44:12 2012 -0500

usp10: Insert dotted circle (U+25CC) for invalid combining sequences in Thai.

---

 dlls/usp10/shape.c |   52 +++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/dlls/usp10/shape.c b/dlls/usp10/shape.c
index 6592cda..67c8153 100644
--- a/dlls/usp10/shape.c
+++ b/dlls/usp10/shape.c
@@ -46,6 +46,7 @@ static void ContextualShape_Hebrew(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *p
 static void ContextualShape_Syriac(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust);
 static void ContextualShape_Thaana(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust);
 static void ContextualShape_Phags_pa(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust);
+static void ContextualShape_Thai(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust);
 static void ContextualShape_Sinhala(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust);
 static void ContextualShape_Devanagari(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust);
 static void ContextualShape_Bengali(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust);
@@ -408,8 +409,8 @@ static const ScriptShapeData ShapingData[] =
     {{ tibetan_features, 2}, NULL, 0, NULL, ShapeCharGlyphProp_Tibet},
     {{ tibetan_features, 2}, NULL, 0, NULL, ShapeCharGlyphProp_Tibet},
     {{ phags_features, 3}, NULL, 0, ContextualShape_Phags_pa, ShapeCharGlyphProp_Thai},
-    {{ thai_features, 1}, NULL, 0, NULL, ShapeCharGlyphProp_Thai},
-    {{ thai_features, 1}, NULL, 0, NULL, ShapeCharGlyphProp_Thai},
+    {{ thai_features, 1}, NULL, 0, ContextualShape_Thai, ShapeCharGlyphProp_Thai},
+    {{ thai_features, 1}, NULL, 0, ContextualShape_Thai, ShapeCharGlyphProp_Thai},
     {{ thai_features, 1}, required_lao_features, 0, NULL, ShapeCharGlyphProp_Thai},
     {{ thai_features, 1}, required_lao_features, 0, NULL, ShapeCharGlyphProp_Thai},
     {{ devanagari_features, 6}, required_devanagari_features, MS_MAKE_TAG('d','e','v','2'), ContextualShape_Devanagari, ShapeCharGlyphProp_Devanagari},
@@ -469,7 +470,7 @@ static const ScriptShapeData ShapingData[] =
     {{ NULL, 0}, NULL, 0, NULL, NULL},
     {{ hebrew_features, 1}, NULL, 0, ContextualShape_Hebrew, NULL},
     {{ latin_features, 2}, NULL, 0, NULL, NULL},
-    {{ thai_features, 1}, NULL, 0, NULL, ShapeCharGlyphProp_Thai},
+    {{ thai_features, 1}, NULL, 0, ContextualShape_Thai, ShapeCharGlyphProp_Thai},
 };
 
 extern scriptData scriptInformation[];
@@ -1365,6 +1366,51 @@ static void ContextualShape_Phags_pa(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS
     HeapFree(GetProcessHeap(),0,context_shape);
 }
 
+static int combining_lexical_Thai(WCHAR c)
+{
+    enum {Thai_Norm=0, Thai_ABOVE1, Thai_ABOVE2, Thai_ABOVE3, Thai_ABOVE4, Thai_BELOW1, Thai_BELOW2, Thai_AM};
+
+   switch(c)
+    {
+        case 0xE31:
+        case 0xE34:
+        case 0xE35:
+        case 0xE36:
+        case 0xE37: return Thai_ABOVE1; break;
+        case 0xE47:
+        case 0xE4D: return Thai_ABOVE2; break;
+        case 0xE48:
+        case 0xE49:
+        case 0xE4A:
+        case 0xE4B: return Thai_ABOVE3; break;
+        case 0xE4C:
+        case 0xE4E: return Thai_ABOVE4; break;
+        case 0xE38:
+        case 0xE39: return Thai_BELOW1; break;
+        case 0xE3A: return Thai_BELOW2; break;
+        case 0xE33: return Thai_AM; break;
+        default: return Thai_Norm;
+    }
+}
+
+static void ContextualShape_Thai(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust)
+{
+    INT dirL;
+
+    if (*pcGlyphs != cChars)
+    {
+        ERR("Number of Glyphs and Chars need to match at the beginning\n");
+        return;
+    }
+
+    if (!psa->fLogicalOrder && psa->fRTL)
+        dirL = -1;
+    else
+        dirL = 1;
+
+    mark_invalid_combinations(hdc, pwcChars, cChars, pwOutGlyphs, pcGlyphs, dirL, pwLogClust, combining_lexical_Thai);
+}
+
 static void ReplaceInsertChars(HDC hdc, INT cWalk, INT* pcChars, WCHAR *pwOutChars, const WCHAR *replacements)
 {
     int i;




More information about the wine-cvs mailing list