Magellan Linux

Annotation of /trunk/icu/patches/icu.8198.revert.icu5431.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1966 - (hide annotations) (download)
Thu Nov 22 11:07:29 2012 UTC (11 years, 5 months ago) by niro
File size: 5544 byte(s)
-some fixes for icu
1 niro 1966 Index: icu/trunk/source/layout/IndicReordering.cpp
2     ===================================================================
3     --- icu/trunk/source/layout/IndicReordering.cpp (revision 25772)
4     +++ icu/trunk/source/layout/IndicReordering.cpp (revision 26090)
5     @@ -126,4 +126,8 @@
6     FeatureMask fSMFeatures;
7    
8     + LEUnicode fPreBaseConsonant;
9     + LEUnicode fPreBaseVirama;
10     + le_int32 fPBCIndex;
11     + FeatureMask fPBCFeatures;
12    
13     void saveMatra(LEUnicode matra, le_int32 matraIndex, IndicClassTable::CharClass matraClass)
14     @@ -172,5 +176,6 @@
15     fMatraFeatures(0), fMPreOutIndex(-1), fMPreFixups(mpreFixups),
16     fVMabove(0), fVMpost(0), fVMIndex(0), fVMFeatures(0),
17     - fSMabove(0), fSMbelow(0), fSMIndex(0), fSMFeatures(0)
18     + fSMabove(0), fSMbelow(0), fSMIndex(0), fSMFeatures(0),
19     + fPreBaseConsonant(0), fPreBaseVirama(0), fPBCIndex(0), fPBCFeatures(0)
20     {
21     // nothing else to do...
22     @@ -191,4 +196,6 @@
23     fVMabove = fVMpost = 0;
24     fSMabove = fSMbelow = 0;
25     +
26     + fPreBaseConsonant = fPreBaseVirama = 0;
27     }
28    
29     @@ -386,4 +393,12 @@
30     }
31    
32     + void notePreBaseConsonant(le_uint32 index,LEUnicode PBConsonant, LEUnicode PBVirama, FeatureMask features)
33     + {
34     + fPBCIndex = index;
35     + fPreBaseConsonant = PBConsonant;
36     + fPreBaseVirama = PBVirama;
37     + fPBCFeatures = features;
38     + }
39     +
40     void noteBaseConsonant()
41     {
42     @@ -465,4 +480,20 @@
43     }
44    
45     + void writePreBaseConsonant()
46     + {
47     + // The TDIL spec says that consonant + virama + RRA should produce a rakar in Malayalam. However,
48     + // it seems that almost none of the fonts for Malayalam are set up to handle this.
49     + // So, we're going to force the issue here by using the rakar as defined with RA in most fonts.
50     +
51     + if (fPreBaseConsonant == 0x0d31) { // RRA
52     + fPreBaseConsonant = 0x0d30; // RA
53     + }
54     +
55     + if (fPreBaseConsonant != 0) {
56     + writeChar(fPreBaseConsonant, fPBCIndex, fPBCFeatures);
57     + writeChar(fPreBaseVirama,fPBCIndex-1,fPBCFeatures);
58     + }
59     + }
60     +
61     le_int32 getOutputIndex()
62     {
63     @@ -723,4 +754,5 @@
64     }
65    
66     +
67     IndicClassTable::CharClass charClass = CC_RESERVED;
68     IndicClassTable::CharClass nextClass = CC_RESERVED;
69     @@ -730,7 +762,9 @@
70     le_bool seenVattu = FALSE;
71     le_bool seenBelowBaseForm = FALSE;
72     + le_bool seenPreBaseForm = FALSE;
73     le_bool hasNukta = FALSE;
74     le_bool hasBelowBaseForm = FALSE;
75     le_bool hasPostBaseForm = FALSE;
76     + le_bool hasPreBaseForm = FALSE;
77    
78     if (postBase < markStart && classTable->isNukta(chars[postBase])) {
79     @@ -746,12 +780,20 @@
80     hasBelowBaseForm = IndicClassTable::hasBelowBaseForm(charClass) && !hasNukta;
81     hasPostBaseForm = IndicClassTable::hasPostBaseForm(charClass) && !hasNukta;
82     + hasPreBaseForm = IndicClassTable::hasPreBaseForm(charClass) && !hasNukta;
83    
84     if (IndicClassTable::isConsonant(charClass)) {
85     if (postBaseLimit == 0 || seenVattu ||
86     (baseConsonant > baseLimit && !classTable->isVirama(chars[baseConsonant - 1])) ||
87     - !(hasBelowBaseForm || hasPostBaseForm)) {
88     + !(hasBelowBaseForm || hasPostBaseForm || hasPreBaseForm)) {
89     break;
90     }
91    
92     + // Note any pre-base consonants
93     + if ( baseConsonant == lastConsonant && lastConsonant > 0 &&
94     + hasPreBaseForm && classTable->isVirama(chars[baseConsonant - 1])) {
95     + output.notePreBaseConsonant(lastConsonant,chars[lastConsonant],chars[lastConsonant-1],tagArray2);
96     + seenPreBaseForm = TRUE;
97     +
98     + }
99     // consonants with nuktas are never vattus
100     seenVattu = IndicClassTable::isVattu(charClass) && !hasNukta;
101     @@ -786,10 +828,12 @@
102    
103     // write any pre-base consonants
104     + output.writePreBaseConsonant();
105     +
106     le_bool supressVattu = TRUE;
107    
108     for (i = baseLimit; i < baseConsonant; i += 1) {
109     LEUnicode ch = chars[i];
110     - // Don't put 'blwf' on first consonant.
111     - FeatureMask features = (i == baseLimit? tagArray2 : tagArray1);
112     + // Don't put 'pstf' or 'blwf' on anything before the base consonant.
113     + FeatureMask features = tagArray1 & ~( pstfFeatureMask | blwfFeatureMask );
114    
115     charClass = classTable->getCharClass(ch);
116     @@ -842,5 +886,5 @@
117    
118     // write below-base consonants
119     - if (baseConsonant != lastConsonant) {
120     + if (baseConsonant != lastConsonant && !seenPreBaseForm) {
121     for (i = bcSpan + 1; i < postBase; i += 1) {
122     output.writeChar(chars[i], i, tagArray1);
123     @@ -872,5 +916,5 @@
124     // write post-base consonants
125     // FIXME: does this put the right tags on post-base consonants?
126     - if (baseConsonant != lastConsonant) {
127     + if (baseConsonant != lastConsonant && !seenPreBaseForm) {
128     if (postBase <= lastConsonant) {
129     for (i = postBase; i <= lastConsonant; i += 1) {