summaryrefslogtreecommitdiffstats
path: root/icu.icu5431.malayam.patch
blob: 48a549d6ebac12bdb4781e2b89f239e6e425be59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
--- icu.orig/source/layout/IndicReordering.cpp	2006-12-21 09:24:42.000000000 +0000
+++ icu/source/layout/IndicReordering.cpp	2006-12-21 09:16:15.000000000 +0000
@@ -50,6 +50,14 @@
 #define distFeatureMask 0x00010000UL
 #define initFeatureMask 0x00008000UL
 
+// TODO: Find better names for these!
+#define tagArray4 (loclFeatureMask | nuktFeatureMask | akhnFeatureMask | vatuFeatureMask | presFeatureMask | blwsFeatureMask | abvsFeatureMask | pstsFeatureMask | halnFeatureMask | blwmFeatureMask | abvmFeatureMask | distFeatureMask)
+#define tagArray3 (pstfFeatureMask | tagArray4)
+#define tagArray2 (halfFeatureMask | tagArray3)
+#define tagArray1 (blwfFeatureMask | tagArray2)
+#define tagArray0 (rphfFeatureMask | tagArray1)
+
+
 class IndicReorderingOutput : public UMemory {
 private:
     le_int32   fOutIndex;
@@ -154,6 +162,27 @@
         fSMabove = fSMbelow = 0;
     }
 
+    void swapChars(int a, int b)
+    {
+	LEErrorCode success = LE_NO_ERROR;
+        LEUnicode temp_char;
+        le_uint32 temp_index;
+        FeatureMask temp_tag;
+
+        temp_char = fOutChars[fOutIndex + b];
+	temp_index = fGlyphStorage.getCharIndex(fOutIndex + b, success);
+        temp_tag = fGlyphStorage.getAuxData(fOutIndex + b, success);
+
+        fOutChars[fOutIndex + b] = fOutChars[fOutIndex + a];
+        le_uint32 toswap = fGlyphStorage.getCharIndex(fOutIndex + a, success);
+        fGlyphStorage.setCharIndex(fOutIndex + b,  toswap, success);
+        fGlyphStorage.setAuxData(fOutIndex + b, tagArray3, success);
+
+        fOutChars[fOutIndex + a] = temp_char;
+        fGlyphStorage.setCharIndex(fOutIndex + a, temp_index, success);
+        fGlyphStorage.setAuxData(fOutIndex + a, temp_tag, success);
+    }
+
     void writeChar(LEUnicode ch, le_uint32 charIndex, FeatureMask charFeatures)
     {
         LEErrorCode success = LE_NO_ERROR;
@@ -335,13 +364,6 @@
     C_DOTTED_CIRCLE = 0x25CC
 };
 
-// TODO: Find better names for these!
-#define tagArray4 (loclFeatureMask | nuktFeatureMask | akhnFeatureMask | vatuFeatureMask | presFeatureMask | blwsFeatureMask | abvsFeatureMask | pstsFeatureMask | halnFeatureMask | blwmFeatureMask | abvmFeatureMask | distFeatureMask)
-#define tagArray3 (pstfFeatureMask | tagArray4)
-#define tagArray2 (halfFeatureMask | tagArray3)
-#define tagArray1 (blwfFeatureMask | tagArray2)
-#define tagArray0 (rphfFeatureMask | tagArray1)
-
 static const FeatureMap featureMap[] =
 {
     {loclFeatureTag, loclFeatureMask},
@@ -629,6 +651,21 @@
                 output.writeChar(chars[i], i, tagArray4);
             }
 
+            /* for the special conjuction of Cons+0x0d4d+0x0d31 or Cons+0x0d4d+0x0d30 of Malayalam */
+            if ((baseConsonant - 2 >= 0) &&
+                (chars[baseConsonant - 1] == 0x0d4d) &&
+		((chars[baseConsonant] == 0x0d31) || 
+		 (chars[baseConsonant] == 0x0d30)) &&
+                ((chars[baseConsonant - 2] >= 0x0d15) &&
+                 (chars[baseConsonant - 2] <= 0x0d39)))  {
+               if (baseConsonant < 3 || chars[baseConsonant - 3] != 0x0d4d) {
+                    output.swapChars(-1, -3);
+
+		    if (mpreFixups)
+		        mpreFixups->reduce();
+		}
+            }
+
             if ((classTable->scriptFlags & SF_MATRAS_AFTER_BASE) != 0) {
                 output.writeMbelow();
                 output.writeSMbelow(); // FIXME: there are no SMs in these scripts...
--- icu.orig/source/layout/MPreFixups.h	2006-11-10 09:42:47.000000000 +0000
+++ icu/source/layout/MPreFixups.h	2006-12-21 09:13:47.000000000 +0000
@@ -31,6 +31,8 @@
     
     void apply(LEGlyphStorage &glyphStorage);
 
+    void reduce();
+
 private:
     FixupData *fFixupData;
     le_int32   fFixupCount;
--- icu.orig/source/layout/MPreFixups.cpp	2006-11-10 09:42:47.000000000 +0000
+++ icu/source/layout/MPreFixups.cpp	2006-12-21 09:16:33.000000000 +0000
@@ -40,6 +40,12 @@
     }
 }
 
+void MPreFixups::reduce()
+{
+    if (fFixupCount > 0)
+        fFixupCount--;
+}
+
 void MPreFixups::apply(LEGlyphStorage &glyphStorage)
 {
     for (le_int32 fixup = 0; fixup < fFixupCount; fixup += 1) {