|
|
d9fa16 |
Index: icu/trunk/source/layout/IndicReordering.cpp
|
|
|
d9fa16 |
===================================================================
|
|
|
d9fa16 |
--- icu/trunk/source/layout/IndicReordering.cpp (revision 25772)
|
|
|
d9fa16 |
+++ icu/trunk/source/layout/IndicReordering.cpp (revision 26090)
|
|
|
d9fa16 |
@@ -126,4 +126,8 @@
|
|
|
d9fa16 |
FeatureMask fSMFeatures;
|
|
|
d9fa16 |
|
|
|
d9fa16 |
+ LEUnicode fPreBaseConsonant;
|
|
|
d9fa16 |
+ LEUnicode fPreBaseVirama;
|
|
|
d9fa16 |
+ le_int32 fPBCIndex;
|
|
|
d9fa16 |
+ FeatureMask fPBCFeatures;
|
|
|
d9fa16 |
|
|
|
d9fa16 |
void saveMatra(LEUnicode matra, le_int32 matraIndex, IndicClassTable::CharClass matraClass)
|
|
|
d9fa16 |
@@ -172,5 +176,6 @@
|
|
|
d9fa16 |
fMatraFeatures(0), fMPreOutIndex(-1), fMPreFixups(mpreFixups),
|
|
|
d9fa16 |
fVMabove(0), fVMpost(0), fVMIndex(0), fVMFeatures(0),
|
|
|
d9fa16 |
- fSMabove(0), fSMbelow(0), fSMIndex(0), fSMFeatures(0)
|
|
|
d9fa16 |
+ fSMabove(0), fSMbelow(0), fSMIndex(0), fSMFeatures(0),
|
|
|
d9fa16 |
+ fPreBaseConsonant(0), fPreBaseVirama(0), fPBCIndex(0), fPBCFeatures(0)
|
|
|
d9fa16 |
{
|
|
|
d9fa16 |
// nothing else to do...
|
|
|
d9fa16 |
@@ -191,4 +196,6 @@
|
|
|
d9fa16 |
fVMabove = fVMpost = 0;
|
|
|
d9fa16 |
fSMabove = fSMbelow = 0;
|
|
|
d9fa16 |
+
|
|
|
d9fa16 |
+ fPreBaseConsonant = fPreBaseVirama = 0;
|
|
|
d9fa16 |
}
|
|
|
d9fa16 |
|
|
|
d9fa16 |
@@ -386,4 +393,12 @@
|
|
|
d9fa16 |
}
|
|
|
d9fa16 |
|
|
|
d9fa16 |
+ void notePreBaseConsonant(le_uint32 index,LEUnicode PBConsonant, LEUnicode PBVirama, FeatureMask features)
|
|
|
d9fa16 |
+ {
|
|
|
d9fa16 |
+ fPBCIndex = index;
|
|
|
d9fa16 |
+ fPreBaseConsonant = PBConsonant;
|
|
|
d9fa16 |
+ fPreBaseVirama = PBVirama;
|
|
|
d9fa16 |
+ fPBCFeatures = features;
|
|
|
d9fa16 |
+ }
|
|
|
d9fa16 |
+
|
|
|
d9fa16 |
void noteBaseConsonant()
|
|
|
d9fa16 |
{
|
|
|
d9fa16 |
@@ -465,4 +480,20 @@
|
|
|
d9fa16 |
}
|
|
|
d9fa16 |
|
|
|
d9fa16 |
+ void writePreBaseConsonant()
|
|
|
d9fa16 |
+ {
|
|
|
d9fa16 |
+ // The TDIL spec says that consonant + virama + RRA should produce a rakar in Malayalam. However,
|
|
|
d9fa16 |
+ // it seems that almost none of the fonts for Malayalam are set up to handle this.
|
|
|
d9fa16 |
+ // So, we're going to force the issue here by using the rakar as defined with RA in most fonts.
|
|
|
d9fa16 |
+
|
|
|
d9fa16 |
+ if (fPreBaseConsonant == 0x0d31) { // RRA
|
|
|
d9fa16 |
+ fPreBaseConsonant = 0x0d30; // RA
|
|
|
d9fa16 |
+ }
|
|
|
d9fa16 |
+
|
|
|
d9fa16 |
+ if (fPreBaseConsonant != 0) {
|
|
|
d9fa16 |
+ writeChar(fPreBaseConsonant, fPBCIndex, fPBCFeatures);
|
|
|
d9fa16 |
+ writeChar(fPreBaseVirama,fPBCIndex-1,fPBCFeatures);
|
|
|
d9fa16 |
+ }
|
|
|
d9fa16 |
+ }
|
|
|
d9fa16 |
+
|
|
|
d9fa16 |
le_int32 getOutputIndex()
|
|
|
d9fa16 |
{
|
|
|
d9fa16 |
@@ -723,4 +754,5 @@
|
|
|
d9fa16 |
}
|
|
|
d9fa16 |
|
|
|
d9fa16 |
+
|
|
|
d9fa16 |
IndicClassTable::CharClass charClass = CC_RESERVED;
|
|
|
d9fa16 |
IndicClassTable::CharClass nextClass = CC_RESERVED;
|
|
|
d9fa16 |
@@ -730,7 +762,9 @@
|
|
|
d9fa16 |
le_bool seenVattu = FALSE;
|
|
|
d9fa16 |
le_bool seenBelowBaseForm = FALSE;
|
|
|
d9fa16 |
+ le_bool seenPreBaseForm = FALSE;
|
|
|
d9fa16 |
le_bool hasNukta = FALSE;
|
|
|
d9fa16 |
le_bool hasBelowBaseForm = FALSE;
|
|
|
d9fa16 |
le_bool hasPostBaseForm = FALSE;
|
|
|
d9fa16 |
+ le_bool hasPreBaseForm = FALSE;
|
|
|
d9fa16 |
|
|
|
d9fa16 |
if (postBase < markStart && classTable->isNukta(chars[postBase])) {
|
|
|
d9fa16 |
@@ -746,12 +780,20 @@
|
|
|
d9fa16 |
hasBelowBaseForm = IndicClassTable::hasBelowBaseForm(charClass) && !hasNukta;
|
|
|
d9fa16 |
hasPostBaseForm = IndicClassTable::hasPostBaseForm(charClass) && !hasNukta;
|
|
|
d9fa16 |
+ hasPreBaseForm = IndicClassTable::hasPreBaseForm(charClass) && !hasNukta;
|
|
|
d9fa16 |
|
|
|
d9fa16 |
if (IndicClassTable::isConsonant(charClass)) {
|
|
|
d9fa16 |
if (postBaseLimit == 0 || seenVattu ||
|
|
|
d9fa16 |
(baseConsonant > baseLimit && !classTable->isVirama(chars[baseConsonant - 1])) ||
|
|
|
d9fa16 |
- !(hasBelowBaseForm || hasPostBaseForm)) {
|
|
|
d9fa16 |
+ !(hasBelowBaseForm || hasPostBaseForm || hasPreBaseForm)) {
|
|
|
d9fa16 |
break;
|
|
|
d9fa16 |
}
|
|
|
d9fa16 |
|
|
|
d9fa16 |
+ // Note any pre-base consonants
|
|
|
d9fa16 |
+ if ( baseConsonant == lastConsonant && lastConsonant > 0 &&
|
|
|
d9fa16 |
+ hasPreBaseForm && classTable->isVirama(chars[baseConsonant - 1])) {
|
|
|
d9fa16 |
+ output.notePreBaseConsonant(lastConsonant,chars[lastConsonant],chars[lastConsonant-1],tagArray2);
|
|
|
d9fa16 |
+ seenPreBaseForm = TRUE;
|
|
|
d9fa16 |
+
|
|
|
d9fa16 |
+ }
|
|
|
d9fa16 |
// consonants with nuktas are never vattus
|
|
|
d9fa16 |
seenVattu = IndicClassTable::isVattu(charClass) && !hasNukta;
|
|
|
d9fa16 |
@@ -786,10 +828,12 @@
|
|
|
d9fa16 |
|
|
|
d9fa16 |
// write any pre-base consonants
|
|
|
d9fa16 |
+ output.writePreBaseConsonant();
|
|
|
d9fa16 |
+
|
|
|
d9fa16 |
le_bool supressVattu = TRUE;
|
|
|
d9fa16 |
|
|
|
d9fa16 |
for (i = baseLimit; i < baseConsonant; i += 1) {
|
|
|
d9fa16 |
LEUnicode ch = chars[i];
|
|
|
d9fa16 |
- // Don't put 'blwf' on first consonant.
|
|
|
d9fa16 |
- FeatureMask features = (i == baseLimit? tagArray2 : tagArray1);
|
|
|
d9fa16 |
+ // Don't put 'pstf' or 'blwf' on anything before the base consonant.
|
|
|
d9fa16 |
+ FeatureMask features = tagArray1 & ~( pstfFeatureMask | blwfFeatureMask );
|
|
|
d9fa16 |
|
|
|
d9fa16 |
charClass = classTable->getCharClass(ch);
|
|
|
d9fa16 |
@@ -842,5 +886,5 @@
|
|
|
d9fa16 |
|
|
|
d9fa16 |
// write below-base consonants
|
|
|
d9fa16 |
- if (baseConsonant != lastConsonant) {
|
|
|
d9fa16 |
+ if (baseConsonant != lastConsonant && !seenPreBaseForm) {
|
|
|
d9fa16 |
for (i = bcSpan + 1; i < postBase; i += 1) {
|
|
|
d9fa16 |
output.writeChar(chars[i], i, tagArray1);
|
|
|
d9fa16 |
@@ -872,5 +916,5 @@
|
|
|
d9fa16 |
// write post-base consonants
|
|
|
d9fa16 |
// FIXME: does this put the right tags on post-base consonants?
|
|
|
d9fa16 |
- if (baseConsonant != lastConsonant) {
|
|
|
d9fa16 |
+ if (baseConsonant != lastConsonant && !seenPreBaseForm) {
|
|
|
d9fa16 |
if (postBase <= lastConsonant) {
|
|
|
d9fa16 |
for (i = postBase; i <= lastConsonant; i += 1) {
|