os/textandloc/fontservices/textshaperplugin/IcuSource/layout/IndicReordering.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
 *
sl@0
     3
 * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
sl@0
     4
 *
sl@0
     5
 */
sl@0
     6
sl@0
     7
#include "LETypes.h"
sl@0
     8
#include "OpenTypeTables.h"
sl@0
     9
#include "OpenTypeUtilities.h"
sl@0
    10
#include "IndicReordering.h"
sl@0
    11
#include "LEGlyphStorage.h"
sl@0
    12
#include "MPreFixups.h"
sl@0
    13
sl@0
    14
U_NAMESPACE_BEGIN
sl@0
    15
sl@0
    16
const LEUnicode KBearURA		= 0x0A73;
sl@0
    17
const LEUnicode KDepVowelU		= 0x0A41;
sl@0
    18
const LEUnicode KDepVowelUU		= 0x0A42;
sl@0
    19
const LEUnicode KDepVowelOO		= 0x0A4B;
sl@0
    20
const LEUnicode KVowelU	    	= 0x0A09;
sl@0
    21
const LEUnicode KVowelUU		= 0x0A0A;
sl@0
    22
const LEUnicode KVowelOO		= 0x0A13;
sl@0
    23
sl@0
    24
class ReorderingOutput : public UMemory {
sl@0
    25
private:
sl@0
    26
    le_int32 fOutIndex;
sl@0
    27
    LEUnicode *fOutChars;
sl@0
    28
sl@0
    29
    LEGlyphStorage &fGlyphStorage;
sl@0
    30
sl@0
    31
    LEUnicode fMpre;
sl@0
    32
    le_int32  fMpreIndex;
sl@0
    33
sl@0
    34
    LEUnicode fMbelow;
sl@0
    35
    le_int32  fMbelowIndex;
sl@0
    36
sl@0
    37
    LEUnicode fMabove;
sl@0
    38
    le_int32  fMaboveIndex;
sl@0
    39
sl@0
    40
    LEUnicode fMpost;
sl@0
    41
    le_int32  fMpostIndex;
sl@0
    42
sl@0
    43
    LEUnicode fLengthMark;
sl@0
    44
    le_int32  fLengthMarkIndex;
sl@0
    45
sl@0
    46
    const LETag *fMatraTags;
sl@0
    47
    
sl@0
    48
    le_int32 fMPreOutIndex;
sl@0
    49
    MPreFixups *fMPreFixups;
sl@0
    50
    
sl@0
    51
    LEUnicode fVMabove;
sl@0
    52
    LEUnicode fVMpost;
sl@0
    53
    le_int32  fVMIndex;
sl@0
    54
    const LETag *fVMTags;
sl@0
    55
    
sl@0
    56
    LEUnicode fSMabove;
sl@0
    57
    LEUnicode fSMbelow;
sl@0
    58
    le_int32  fSMIndex;
sl@0
    59
    const LETag *fSMTags;
sl@0
    60
sl@0
    61
    void saveMatra(LEUnicode matra, le_int32 matraIndex, IndicClassTable::CharClass matraClass)
sl@0
    62
    {
sl@0
    63
        // FIXME: check if already set, or if not a matra...
sl@0
    64
        if (IndicClassTable::isLengthMark(matraClass)) {
sl@0
    65
            fLengthMark = matra;
sl@0
    66
            fLengthMarkIndex = matraIndex;
sl@0
    67
        } else {
sl@0
    68
            switch (matraClass & CF_POS_MASK) {
sl@0
    69
            case CF_POS_BEFORE:
sl@0
    70
                fMpre = matra;
sl@0
    71
                fMpreIndex = matraIndex;
sl@0
    72
                break;
sl@0
    73
               
sl@0
    74
            case CF_POS_BELOW:
sl@0
    75
                fMbelow = matra;
sl@0
    76
                fMbelowIndex = matraIndex;
sl@0
    77
                break;
sl@0
    78
               
sl@0
    79
            case CF_POS_ABOVE:
sl@0
    80
                fMabove = matra;
sl@0
    81
                fMaboveIndex = matraIndex;
sl@0
    82
                break;
sl@0
    83
               
sl@0
    84
            case CF_POS_AFTER:
sl@0
    85
                fMpost = matra;
sl@0
    86
                fMpostIndex = matraIndex;
sl@0
    87
                break;
sl@0
    88
               
sl@0
    89
            default:
sl@0
    90
                // can't get here...
sl@0
    91
                break;
sl@0
    92
           }
sl@0
    93
        }
sl@0
    94
        
sl@0
    95
        // 1922 mlyl : only the right part of matra AU should be displayed -->
sl@0
    96
        if (fMpre == CC_DEPENDENT_VOWEL_SIGN_MLYL_E && fLengthMark != 0) 
sl@0
    97
        {
sl@0
    98
        	fMpre = 0;
sl@0
    99
        	fMpreIndex = -1;
sl@0
   100
        } 
sl@0
   101
        // <-- 1922 mlyl
sl@0
   102
    }
sl@0
   103
sl@0
   104
public:
sl@0
   105
    ReorderingOutput(LEUnicode *outChars, LEGlyphStorage &glyphStorage, MPreFixups *mpreFixups)
sl@0
   106
        : fOutIndex(0), fOutChars(outChars), fGlyphStorage(glyphStorage),
sl@0
   107
          fMpre(0), fMpreIndex(0), fMbelow(0), fMbelowIndex(0), fMabove(0), fMaboveIndex(0),
sl@0
   108
          fMpost(0), fMpostIndex(0), fLengthMark(0), fLengthMarkIndex(0), fMatraTags(NULL),
sl@0
   109
          fMPreOutIndex(-1), fMPreFixups(mpreFixups),
sl@0
   110
          fVMabove(0), fVMpost(0), fVMIndex(0), fVMTags(NULL),
sl@0
   111
          fSMabove(0), fSMbelow(0), fSMIndex(0), fSMTags(NULL)
sl@0
   112
    {
sl@0
   113
        // nothing else to do...
sl@0
   114
    }
sl@0
   115
sl@0
   116
    ~ReorderingOutput()
sl@0
   117
    {
sl@0
   118
        // nothing to do here...
sl@0
   119
    }
sl@0
   120
sl@0
   121
    void reset()
sl@0
   122
    {
sl@0
   123
        fMpre = fMbelow = fMabove = fMpost = fLengthMark = 0;
sl@0
   124
        fMPreOutIndex = -1;
sl@0
   125
        
sl@0
   126
        fVMabove = fVMpost  = 0;
sl@0
   127
        fSMabove = fSMbelow = 0;
sl@0
   128
    }
sl@0
   129
sl@0
   130
    void writeChar(LEUnicode ch, le_uint32 charIndex, const LETag *charTags)
sl@0
   131
    {
sl@0
   132
        LEErrorCode success = LE_NO_ERROR;
sl@0
   133
sl@0
   134
        fOutChars[fOutIndex] = ch;
sl@0
   135
sl@0
   136
        fGlyphStorage.setCharIndex(fOutIndex, charIndex, success);
sl@0
   137
        fGlyphStorage.setAuxData(fOutIndex, (void *) charTags, success);
sl@0
   138
sl@0
   139
        fOutIndex += 1;
sl@0
   140
    }
sl@0
   141
sl@0
   142
    le_bool noteMatra(const IndicClassTable *classTable, LEUnicode matra, le_uint32 matraIndex, const LETag *matraTags)
sl@0
   143
    {
sl@0
   144
        IndicClassTable::CharClass matraClass = classTable->getCharClass(matra);
sl@0
   145
sl@0
   146
        fMatraTags  = matraTags;
sl@0
   147
sl@0
   148
        if (IndicClassTable::isMatra(matraClass)) {
sl@0
   149
            if (IndicClassTable::isSplitMatra(matraClass)) {
sl@0
   150
                const SplitMatra *splitMatra = classTable->getSplitMatra(matraClass);
sl@0
   151
                int i;
sl@0
   152
sl@0
   153
                for (i = 0; i < 3 && (*splitMatra)[i] != 0; i += 1) {
sl@0
   154
                    LEUnicode piece = (*splitMatra)[i];
sl@0
   155
                    IndicClassTable::CharClass pieceClass = classTable->getCharClass(piece);
sl@0
   156
sl@0
   157
                    saveMatra(piece, matraIndex, pieceClass);
sl@0
   158
                }
sl@0
   159
            } else {
sl@0
   160
                saveMatra(matra, matraIndex, matraClass);
sl@0
   161
            }
sl@0
   162
sl@0
   163
            return TRUE;
sl@0
   164
        }
sl@0
   165
sl@0
   166
        return FALSE;
sl@0
   167
    }
sl@0
   168
    
sl@0
   169
    void noteVowelModifier(const IndicClassTable *classTable, LEUnicode vowelModifier, le_uint32 vowelModifierIndex, const LETag *vowelModifierTags)
sl@0
   170
    {
sl@0
   171
        IndicClassTable::CharClass vmClass = classTable->getCharClass(vowelModifier);
sl@0
   172
        
sl@0
   173
        fVMIndex = vowelModifierIndex;
sl@0
   174
        fVMTags  = vowelModifierTags;
sl@0
   175
        
sl@0
   176
        if (IndicClassTable::isVowelModifier(vmClass)) {
sl@0
   177
           switch (vmClass & CF_POS_MASK) {
sl@0
   178
           case CF_POS_ABOVE:
sl@0
   179
               fVMabove = vowelModifier;
sl@0
   180
               break;
sl@0
   181
            
sl@0
   182
           case CF_POS_AFTER:
sl@0
   183
               fVMpost = vowelModifier;
sl@0
   184
               break;
sl@0
   185
           
sl@0
   186
           default:
sl@0
   187
               // FIXME: this is an error...
sl@0
   188
               break;
sl@0
   189
           }
sl@0
   190
        }
sl@0
   191
    }
sl@0
   192
    
sl@0
   193
    void noteStressMark(const IndicClassTable *classTable, LEUnicode stressMark, le_uint32 stressMarkIndex, const LETag *stressMarkTags)
sl@0
   194
    {
sl@0
   195
       IndicClassTable::CharClass smClass = classTable->getCharClass(stressMark);
sl@0
   196
        
sl@0
   197
        fSMIndex = stressMarkIndex;
sl@0
   198
        fSMTags  = stressMarkTags;
sl@0
   199
        
sl@0
   200
        if (IndicClassTable::isStressMark(smClass)) {
sl@0
   201
            switch (smClass & CF_POS_MASK) {
sl@0
   202
            case CF_POS_ABOVE:
sl@0
   203
                fSMabove = stressMark;
sl@0
   204
                break;
sl@0
   205
            
sl@0
   206
            case CF_POS_BELOW:
sl@0
   207
                fSMbelow = stressMark;
sl@0
   208
                break;
sl@0
   209
           
sl@0
   210
            default:
sl@0
   211
                // FIXME: this is an error...
sl@0
   212
                break;
sl@0
   213
           }
sl@0
   214
        }
sl@0
   215
    }
sl@0
   216
sl@0
   217
    void noteBaseConsonant()
sl@0
   218
    {
sl@0
   219
        if (fMPreFixups != NULL && fMPreOutIndex >= 0) {
sl@0
   220
            fMPreFixups->add(fOutIndex, fMPreOutIndex);
sl@0
   221
        }
sl@0
   222
    }
sl@0
   223
sl@0
   224
    void writeMpre()
sl@0
   225
    {
sl@0
   226
        if (fMpre != 0) {
sl@0
   227
            fMPreOutIndex = fOutIndex;
sl@0
   228
            writeChar(fMpre, fMpreIndex, fMatraTags);
sl@0
   229
        }
sl@0
   230
    }
sl@0
   231
sl@0
   232
    void writeMbelow()
sl@0
   233
    {
sl@0
   234
        if (fMbelow != 0) {
sl@0
   235
            writeChar(fMbelow, fMbelowIndex, fMatraTags);
sl@0
   236
        }
sl@0
   237
    }
sl@0
   238
sl@0
   239
    void writeMabove()
sl@0
   240
    {
sl@0
   241
        if (fMabove != 0) {
sl@0
   242
            writeChar(fMabove, fMaboveIndex, fMatraTags);
sl@0
   243
        }
sl@0
   244
    }
sl@0
   245
sl@0
   246
    void writeMpost()
sl@0
   247
    {
sl@0
   248
        if (fMpost != 0) {
sl@0
   249
            writeChar(fMpost, fMpostIndex, fMatraTags);
sl@0
   250
        }
sl@0
   251
    }
sl@0
   252
sl@0
   253
    void writeLengthMark()
sl@0
   254
    {
sl@0
   255
        if (fLengthMark != 0) {
sl@0
   256
            writeChar(fLengthMark, fLengthMarkIndex, fMatraTags);
sl@0
   257
        }
sl@0
   258
    }
sl@0
   259
    
sl@0
   260
    void writeVMabove()
sl@0
   261
    {
sl@0
   262
        if (fVMabove != 0) {
sl@0
   263
            writeChar(fVMabove, fVMIndex, fVMTags);
sl@0
   264
        }
sl@0
   265
    }
sl@0
   266
        
sl@0
   267
    void writeVMpost()
sl@0
   268
    {
sl@0
   269
        if (fVMpost != 0) {
sl@0
   270
            writeChar(fVMpost, fVMIndex, fVMTags);
sl@0
   271
        }
sl@0
   272
    }
sl@0
   273
    
sl@0
   274
    void writeSMabove()
sl@0
   275
    {
sl@0
   276
        if (fSMabove != 0) {
sl@0
   277
            writeChar(fSMabove, fSMIndex, fSMTags);
sl@0
   278
        }
sl@0
   279
    }
sl@0
   280
    
sl@0
   281
    void writeSMbelow()
sl@0
   282
    {
sl@0
   283
        if (fSMbelow != 0) {
sl@0
   284
            writeChar(fSMbelow, fSMIndex, fSMTags);
sl@0
   285
        }
sl@0
   286
    }
sl@0
   287
    
sl@0
   288
    le_int32 getOutputIndex()
sl@0
   289
    {
sl@0
   290
        return fOutIndex;
sl@0
   291
    }
sl@0
   292
};
sl@0
   293
sl@0
   294
enum
sl@0
   295
{
sl@0
   296
    C_DOTTED_CIRCLE = 0x25CC
sl@0
   297
};
sl@0
   298
sl@0
   299
static const LETag emptyTag       = 0x00000000; // ''
sl@0
   300
sl@0
   301
static const LETag nuktFeatureTag = LE_NUKT_FEATURE_TAG;
sl@0
   302
static const LETag akhnFeatureTag = LE_AKHN_FEATURE_TAG;
sl@0
   303
static const LETag rphfFeatureTag = LE_RPHF_FEATURE_TAG;
sl@0
   304
static const LETag blwfFeatureTag = LE_BLWF_FEATURE_TAG;
sl@0
   305
static const LETag halfFeatureTag = LE_HALF_FEATURE_TAG;
sl@0
   306
static const LETag pstfFeatureTag = LE_PSTF_FEATURE_TAG;
sl@0
   307
static const LETag vatuFeatureTag = LE_VATU_FEATURE_TAG;
sl@0
   308
static const LETag presFeatureTag = LE_PRES_FEATURE_TAG;
sl@0
   309
static const LETag blwsFeatureTag = LE_BLWS_FEATURE_TAG;
sl@0
   310
static const LETag abvsFeatureTag = LE_ABVS_FEATURE_TAG;
sl@0
   311
static const LETag pstsFeatureTag = LE_PSTS_FEATURE_TAG;
sl@0
   312
static const LETag halnFeatureTag = LE_HALN_FEATURE_TAG;
sl@0
   313
sl@0
   314
static const LETag blwmFeatureTag = LE_BLWM_FEATURE_TAG;
sl@0
   315
static const LETag abvmFeatureTag = LE_ABVM_FEATURE_TAG;
sl@0
   316
static const LETag distFeatureTag = LE_DIST_FEATURE_TAG;
sl@0
   317
static const LETag loclFeatureTag = LE_LOCL_FEATURE_TAG;
sl@0
   318
sl@0
   319
// These are in the order in which the features need to be applied
sl@0
   320
// for correct processing
sl@0
   321
static const LETag featureOrder[] =
sl@0
   322
{
sl@0
   323
    loclFeatureTag,
sl@0
   324
    nuktFeatureTag, akhnFeatureTag, rphfFeatureTag, blwfFeatureTag, halfFeatureTag, pstfFeatureTag,
sl@0
   325
    vatuFeatureTag, presFeatureTag, blwsFeatureTag, abvsFeatureTag, pstsFeatureTag, halnFeatureTag,
sl@0
   326
    blwmFeatureTag, abvmFeatureTag, distFeatureTag, emptyTag
sl@0
   327
};
sl@0
   328
sl@0
   329
// The order of these is determined so that the tag array of each glyph can start
sl@0
   330
// at an offset into this array 
sl@0
   331
// FIXME: do we want a seperate tag array for each kind of character??
sl@0
   332
// FIXME: are there cases where this ordering causes glyphs to get tags
sl@0
   333
// that they shouldn't?
sl@0
   334
static const LETag tagArray[] =
sl@0
   335
{
sl@0
   336
    rphfFeatureTag, blwfFeatureTag, halfFeatureTag, pstfFeatureTag, nuktFeatureTag, akhnFeatureTag,
sl@0
   337
    vatuFeatureTag, presFeatureTag, blwsFeatureTag, abvsFeatureTag, pstsFeatureTag, halnFeatureTag,
sl@0
   338
    blwmFeatureTag, abvmFeatureTag, distFeatureTag, loclFeatureTag, emptyTag
sl@0
   339
};
sl@0
   340
sl@0
   341
sl@0
   342
// Nokia: New state responses ia and de, and new states for Devanagari Independent Vowel A 
sl@0
   343
// added by Nokia to allow the special Devanagari CANDRA A formation using A + CANDRA E, and
sl@0
   344
// a new zero width joiner state specially for ZWJ's that come after the Independent Vowel A
sl@0
   345
// Also, changed the consonant response to ZWJ by allowing it to have a ZWJ straight after it.
sl@0
   346
// This allows Kannada RA to take a ZWJ after it and not make it a REPHA
sl@0
   347
// Nokia: New states for Gurmukhi bearers to support decompositions of the independent vowels 
sl@0
   348
// into a sequence of a vowel bearer and a depending vowel sign.
sl@0
   349
static const le_int8 stateTable[][CC_COUNT] =
sl@0
   350
{
sl@0
   351
//   xx  vm  sm  iv  i2  ct  cn  nu  dv  s1  s2  s3  vr  zw  ia  de  cr  to  ba  bi  bu  ga  gi  gu 
sl@0
   352
    { 1,  1,  1,  5,  8,  3,  2,  1,  1,  9,  5,  1,  1,  1, 20,  1, 25, 26, 27, 28, 29,  1,  1,  1}, //  0 - ground state
sl@0
   353
    {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, //  1 - exit state
sl@0
   354
    {-1,  6,  1, -1, -1, -1, -1, -1,  5,  9,  5,  5,  4, -1, -1,  5, -1, 26, -1, -1, -1,  5,  5,  5}, //  2 - consonant with nukta
sl@0
   355
    {-1,  6,  1, -1, -1, -1, -1,  2,  5,  9,  5,  5,  4, -1, -1,  5, -1, 26, -1, -1, -1,  5,  5,  5}, //  3 - consonant
sl@0
   356
    {-1, -1, -1, -1, -1, 12, 11, -1, -1, -1, -1, -1, -1, 22, -1, -1, 12, -1, -1, -1, -1, -1, -1, -1}, //  4 - ct vr
sl@0
   357
    {-1,  6,  1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, //  5 - dependent vowels
sl@0
   358
    {-1, -1,  1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, //  6 - vowel mark
sl@0
   359
    {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, //  7 - ZWJ, ZWNJ seen after a consonant: Modified by Nokia
sl@0
   360
    {-1,  6,  1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, //  8 - independent vowels that can take a virama
sl@0
   361
    {-1,  6,  1, -1, -1, -1, -1, -1, -1, -1, 10,  5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, //  9 - first part of split vowel
sl@0
   362
    {-1,  6,  1, -1, -1, -1, -1, -1, -1, -1, -1,  5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, // 10 - second part of split vowel
sl@0
   363
    {-1,  6,  1, -1, -1, -1, -1, -1,  5,  9,  5,  5, 13, -1, -1,  5, -1, 26, -1, -1, -1,  5,  5,  5}, // 11 - ct vr ct nu
sl@0
   364
    {-1,  6,  1, -1, -1, -1, -1, 11,  5,  9,  5,  5, 13, -1, -1,  5, -1, 26, -1, -1, -1,  5,  5,  5}, // 12 - ct vr ct
sl@0
   365
    {-1, -1, -1, -1, -1, 15, 14, -1, -1, -1, -1, -1, -1, 23, -1, -1, 15, -1, -1, -1, -1, -1, -1, -1}, // 13 - ct vr ct vr
sl@0
   366
    {-1,  6,  1, -1, -1, -1, -1, -1,  5,  9,  5,  5, 16, -1, -1,  5, -1, 26, -1, -1, -1,  5,  5,  5}, // 14 - ct vr ct vr ct nu
sl@0
   367
    {-1,  6,  1, -1, -1, -1, -1, 14,  5,  9,  5,  5, 16, -1, -1,  5, -1, 26, -1, -1, -1,  5,  5,  5}, // 15 - ct vr ct vr ct
sl@0
   368
    {-1, -1, -1, -1, -1, 18, 17, -1, -1, -1, -1, -1, -1, 24, -1, -1, 18, -1, -1, -1, -1, -1, -1, -1}, // 16 - ct vr ct vr ct vr
sl@0
   369
    {-1,  6,  1, -1, -1, -1, -1, -1,  5,  9,  5,  5, 19, -1, -1,  5, -1, 26, -1, -1, -1,  5,  5,  5}, // 17 - ct vr ct vr ct vr ct nu
sl@0
   370
    {-1,  6,  1, -1, -1, -1, -1, 17,  5,  9,  5,  5, 19, -1, -1,  5, -1, 26, -1, -1, -1,  5,  5,  5}, // 18 - ct vr ct vr ct vr ct
sl@0
   371
    {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, // 19 - ct vr ct vr ct vr ct vr
sl@0
   372
    {-1,  6,  1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, -1,  5, -1, -1, -1, -1, -1, -1, -1, -1}, // 20 - devanagari independent vowel A that can take a modifier - CANDRA E: Added by Nokia
sl@0
   373
    {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  5, -1, -1, -1, -1, -1, -1, -1, -1}, // 21 - ZWJ after independent vowel A: Added by Nokia  
sl@0
   374
    {-1,  6, -1, -1, -1, 12, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, -1, -1, -1, -1, -1, -1, -1}, // 22 - ZWJ after a virama: Added by Nokia  
sl@0
   375
    {-1,  6, -1, -1, -1, 15, 14, -1, -1, -1, -1, -1, -1, -1, -1, -1, 15, -1, -1, -1, -1, -1, -1, -1}, // 23 - ZWJ after a ct vr ct vr: Added by Nokia  
sl@0
   376
    {-1,  6, -1, -1, -1, 18, 17, -1, -1, -1, -1, -1, -1, -1, -1, -1, 18, -1, -1, -1, -1, -1, -1, -1}, // 24 - ZWJ after a ct vr ct vr ct vr: Added by Nokia  
sl@0
   377
    {-1,  6,  1, -1, -1, -1, -1,  2,  5,  9,  5,  5,  4,  7, -1,  5, -1, 26, -1, -1, -1,  5,  5,  5}, // 25 - Kannada consonant Ra: Added by Nokia
sl@0
   378
    {-1,  6,  1, -1, -1, -1, -1, -1, -1, -1, 10,  5,  4, 21, -1,  5, -1, -1, -1, -1, -1, -1, -1, -1}, // 26 - devanagari independent vowel A that can take a modifier - CANDRA E: Added by Nokia
sl@0
   379
    {-1,  6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  5, -1, -1}, // 27 - Gurmukhi bearer ARA and independent A
sl@0
   380
    {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  5, -1}, // 28 - Gurmukhi bearer IRI
sl@0
   381
    {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  5}, // 29 - Gurmukhi bearer URA
sl@0
   382
};
sl@0
   383
sl@0
   384
sl@0
   385
const LETag *IndicReordering::getFeatureOrder()
sl@0
   386
{
sl@0
   387
    return featureOrder;
sl@0
   388
}
sl@0
   389
sl@0
   390
le_int32 IndicReordering::findSyllable(const IndicClassTable *classTable, const LEUnicode *chars, le_int32 prev, le_int32 charCount)
sl@0
   391
{
sl@0
   392
    le_int32 cursor = prev;
sl@0
   393
    le_int8 state = 0;
sl@0
   394
sl@0
   395
    while (cursor < charCount) {
sl@0
   396
        IndicClassTable::CharClass charClass = classTable->getCharClass(chars[cursor]);
sl@0
   397
sl@0
   398
        state = stateTable[state][charClass & CF_CLASS_MASK];
sl@0
   399
sl@0
   400
        if (state < 0) {
sl@0
   401
            break;
sl@0
   402
        }
sl@0
   403
sl@0
   404
        cursor += 1;
sl@0
   405
    }
sl@0
   406
sl@0
   407
    return cursor;
sl@0
   408
}
sl@0
   409
sl@0
   410
le_int32 IndicReordering::reorder(const LEUnicode *chars, le_int32 charCount, le_int32 scriptCode,
sl@0
   411
                                  LEUnicode *outChars, LEGlyphStorage &glyphStorage,
sl@0
   412
                                  MPreFixups **outMPreFixups, LEErrorCode& success)
sl@0
   413
{
sl@0
   414
    MPreFixups *mpreFixups = NULL;
sl@0
   415
    const IndicClassTable *classTable = IndicClassTable::getScriptClassTable(scriptCode);
sl@0
   416
sl@0
   417
    if (classTable->scriptFlags & SF_MPRE_FIXUP) {
sl@0
   418
        mpreFixups = new MPreFixups(charCount);
sl@0
   419
        if (!mpreFixups) {
sl@0
   420
            success = LE_MEMORY_ALLOCATION_ERROR;
sl@0
   421
            return 0;
sl@0
   422
        }
sl@0
   423
    }
sl@0
   424
sl@0
   425
    ReorderingOutput output(outChars, glyphStorage, mpreFixups);
sl@0
   426
    le_int32 i, prev = 0;
sl@0
   427
sl@0
   428
    while (prev < charCount) {
sl@0
   429
        le_int32 syllable = findSyllable(classTable, chars, prev, charCount);
sl@0
   430
        le_int32 matra, markStart = syllable;
sl@0
   431
sl@0
   432
        output.reset();
sl@0
   433
        
sl@0
   434
        if (classTable->isStressMark(chars[markStart - 1])) {
sl@0
   435
            markStart -= 1;
sl@0
   436
            output.noteStressMark(classTable, chars[markStart], markStart, &tagArray[1]);
sl@0
   437
        }
sl@0
   438
        
sl@0
   439
        if (prev != markStart && classTable->isVowelModifier(chars[markStart - 1])) {
sl@0
   440
            markStart -= 1;
sl@0
   441
            output.noteVowelModifier(classTable, chars[markStart], markStart, &tagArray[1]);
sl@0
   442
        }
sl@0
   443
        
sl@0
   444
        matra = markStart - 1;
sl@0
   445
        
sl@0
   446
        // Added by Nokia. Workaround ligature substitution: Bearer URA + Dependent Vowel -> Independent Vowel
sl@0
   447
        // For these sequences, no need to write matra since it will be replaced.
sl@0
   448
        if (!(chars[prev] == KBearURA && (prev + 1 < syllable) && 
sl@0
   449
        		(chars[prev+1] == KDepVowelU || chars[prev+1] == KDepVowelUU || chars[prev+1] == KDepVowelOO ))) {
sl@0
   450
       		
sl@0
   451
        	while (prev <= matra && output.noteMatra(classTable, chars[matra], matra, &tagArray[1])) {
sl@0
   452
            	matra -= 1;
sl@0
   453
        	}
sl@0
   454
        }
sl@0
   455
sl@0
   456
        
sl@0
   457
        switch (classTable->getCharClass(chars[prev]) & CF_CLASS_MASK) {
sl@0
   458
        case CC_RESERVED:
sl@0
   459
        case CC_INDEPENDENT_VOWEL:
sl@0
   460
        case CC_ZERO_WIDTH_MARK:
sl@0
   461
        case CC_INDEPENDENT_VOWEL_A:	// Added by Nokia
sl@0
   462
        case CC_INDEPENDENT_VOWEL_TAMIL_O:	// Added by Nokia
sl@0
   463
        case CC_GUR_BEARER_U:	//Added by Nokia
sl@0
   464
        	
sl@0
   465
        	// Added by Nokia. Workaround ligature substitution: Bearer URA + Dependent Vowel -> Independent Vowel
sl@0
   466
        	if (chars[prev] == KBearURA && (prev + 1 < markStart)){
sl@0
   467
        		if (chars[prev+1] == KDepVowelU){
sl@0
   468
        	   		output.writeChar(KVowelU, prev, &tagArray[1]);
sl@0
   469
        	   		prev = prev+2;
sl@0
   470
        		}
sl@0
   471
        		else if (chars[prev+1] == KDepVowelUU){
sl@0
   472
        			output.writeChar(KVowelUU, prev, &tagArray[1]);
sl@0
   473
        			prev = prev+2;
sl@0
   474
        		}
sl@0
   475
        		else if (chars[prev+1] == KDepVowelOO){
sl@0
   476
        			output.writeChar(KVowelOO, prev, &tagArray[1]);
sl@0
   477
        			prev = prev+2;
sl@0
   478
        		}
sl@0
   479
        	}
sl@0
   480
       	
sl@0
   481
            for (i = prev; i < syllable; i += 1) {
sl@0
   482
                output.writeChar(chars[i], i, &tagArray[1]);
sl@0
   483
            }
sl@0
   484
sl@0
   485
            break;
sl@0
   486
sl@0
   487
        case CC_NUKTA:
sl@0
   488
        case CC_VIRAMA:
sl@0
   489
            output.writeChar(C_DOTTED_CIRCLE, prev, &tagArray[1]);
sl@0
   490
            output.writeChar(chars[prev], prev, &tagArray[1]);
sl@0
   491
            break;
sl@0
   492
sl@0
   493
        case CC_DEPENDENT_VOWEL:
sl@0
   494
        case CC_DEPENDENT_VOWEL_CANDRA_E:	// Added by Nokia
sl@0
   495
        case CC_SPLIT_VOWEL_PIECE_1:
sl@0
   496
        case CC_SPLIT_VOWEL_PIECE_2:
sl@0
   497
        case CC_SPLIT_VOWEL_PIECE_3:
sl@0
   498
        case CC_VOWEL_MODIFIER:
sl@0
   499
        case CC_STRESS_MARK:
sl@0
   500
        case CC_GUR_DEPENDENT_VOWEL_A:
sl@0
   501
        case CC_GUR_DEPENDENT_VOWEL_I:
sl@0
   502
        case CC_GUR_DEPENDENT_VOWEL_U:
sl@0
   503
            output.writeMpre();
sl@0
   504
sl@0
   505
            output.writeChar(C_DOTTED_CIRCLE, prev, &tagArray[1]);
sl@0
   506
sl@0
   507
            output.writeMbelow();
sl@0
   508
            output.writeSMbelow();
sl@0
   509
            output.writeMabove();
sl@0
   510
sl@0
   511
            if ((classTable->scriptFlags & SF_MATRAS_AFTER_BASE) != 0) {
sl@0
   512
                output.writeMpost();
sl@0
   513
            }
sl@0
   514
sl@0
   515
            if ((classTable->scriptFlags & SF_REPH_AFTER_BELOW) != 0) {
sl@0
   516
                output.writeVMabove();
sl@0
   517
                output.writeSMabove(); // FIXME: there are no SM's in these scripts...
sl@0
   518
            }
sl@0
   519
sl@0
   520
            if ((classTable->scriptFlags & SF_MATRAS_AFTER_BASE) == 0) {
sl@0
   521
                output.writeMpost();
sl@0
   522
            }
sl@0
   523
sl@0
   524
            output.writeLengthMark();
sl@0
   525
sl@0
   526
            if ((classTable->scriptFlags & SF_REPH_AFTER_BELOW) == 0) {
sl@0
   527
                output.writeVMabove();
sl@0
   528
                output.writeSMabove();
sl@0
   529
            }
sl@0
   530
sl@0
   531
            output.writeVMpost();
sl@0
   532
            break;
sl@0
   533
sl@0
   534
        case CC_INDEPENDENT_VOWEL_2:
sl@0
   535
        case CC_CONSONANT:
sl@0
   536
        case CC_CONSONANT_WITH_NUKTA:
sl@0
   537
        case CC_CONSONANT_KANNADA_BENGALI_RA:
sl@0
   538
        case CC_GUR_BEARER_A:				// Added by Nokia
sl@0
   539
        case CC_GUR_BEARER_I:				// Added by Nokia
sl@0
   540
        {
sl@0
   541
            le_uint32 length = markStart - prev;
sl@0
   542
            le_int32  lastConsonant = markStart - 1;
sl@0
   543
            le_int32  baseLimit = prev;
sl@0
   544
            
sl@0
   545
            // Check for REPH at front of syllable
sl@0
   546
            if (length > 2 && classTable->isReph(chars[prev]) && classTable->isVirama(chars[prev + 1])) {
sl@0
   547
                baseLimit += 2;
sl@0
   548
sl@0
   549
                // Check for eyelash RA, if the script supports it
sl@0
   550
                if ((classTable->scriptFlags & SF_EYELASH_RA) != 0 &&
sl@0
   551
                    chars[baseLimit] == C_SIGN_ZWJ) {
sl@0
   552
                    if (length > 3) {
sl@0
   553
                        baseLimit += 1;
sl@0
   554
                    } else {
sl@0
   555
                        baseLimit -= 2;
sl@0
   556
                    }
sl@0
   557
                }
sl@0
   558
            }
sl@0
   559
sl@0
   560
            while (lastConsonant > baseLimit && !classTable->isConsonant(chars[lastConsonant])) {
sl@0
   561
                lastConsonant -= 1;
sl@0
   562
            }
sl@0
   563
sl@0
   564
            le_int32 baseConsonant = lastConsonant;
sl@0
   565
            le_int32 postBase = lastConsonant + 1;
sl@0
   566
            le_int32 postBaseLimit = classTable->scriptFlags & SF_POST_BASE_LIMIT_MASK;
sl@0
   567
            le_bool  seenVattu = FALSE;
sl@0
   568
            le_bool  seenBelowBaseForm = FALSE;
sl@0
   569
sl@0
   570
            if (postBase < markStart && classTable->isNukta(chars[postBase])) {
sl@0
   571
                postBase += 1;
sl@0
   572
            }
sl@0
   573
sl@0
   574
            while (baseConsonant > baseLimit) {
sl@0
   575
                IndicClassTable::CharClass charClass = classTable->getCharClass(chars[baseConsonant]);
sl@0
   576
sl@0
   577
                if (IndicClassTable::isConsonant(charClass)) {
sl@0
   578
                    IndicClassTable::CharClass nextCharClass
sl@0
   579
                    	= classTable->getCharClass(chars[baseConsonant + 1]);
sl@0
   580
                    le_bool hasNukta = IndicClassTable::isNukta(nextCharClass);
sl@0
   581
                    // Consonants with nuktas never have post-base or below-base forms
sl@0
   582
                    le_bool hasPostBaseForm = !hasNukta
sl@0
   583
                    	&& IndicClassTable::hasPostBaseForm(charClass);
sl@0
   584
                    le_bool hasBelowBaseForm = !hasNukta
sl@0
   585
                    	&& IndicClassTable::hasBelowBaseForm(charClass);
sl@0
   586
sl@0
   587
                    // Added by Nokia -- A Bengali Ya should only have a post base form if it is the last component in a consonant cluster.
sl@0
   588
                    if (IndicClassTable::isBengaliYa(charClass) && (baseConsonant != lastConsonant))
sl@0
   589
						hasPostBaseForm = FALSE;
sl@0
   590
sl@0
   591
                    // Added by Nokia 1922 mlyl: YAKAR/VAKAR/RAKAR are not formed after LLA/LLLA/RRA, but when LLA/LLLA/RRA is one of combination ligature?-->
sl@0
   592
                    if ((chars[baseConsonant] == CC_CONSONANT_MLYL_YA || chars[baseConsonant] == CC_CONSONANT_MLYL_VA || chars[baseConsonant] == CC_CONSONANT_MLYL_RA)
sl@0
   593
                    		&& baseConsonant >=2
sl@0
   594
                    		&& (chars[baseConsonant - 2] == CC_CONSONANT_MLYL_LLA || chars[baseConsonant - 2] == CC_CONSONANT_MLYL_LLLA || chars[baseConsonant - 2] == CC_CONSONANT_MLYL_RRA))
sl@0
   595
                    	hasPostBaseForm = FALSE;
sl@0
   596
sl@0
   597
                    // D15 + D4D + D2F/D35 + D4D + D30: YAKAR/VAKAR not formed
sl@0
   598
                    if ((chars[baseConsonant] == CC_CONSONANT_MLYL_YA || chars[baseConsonant] == CC_CONSONANT_MLYL_VA)
sl@0
   599
                    		&& lastConsonant >= 4
sl@0
   600
                    		&& chars[lastConsonant] == CC_CONSONANT_MLYL_RA)
sl@0
   601
                    	hasPostBaseForm = FALSE;
sl@0
   602
                    // <-- 1922 mlyl
sl@0
   603
                    
sl@0
   604
                    if (postBaseLimit == 0 || seenVattu ||
sl@0
   605
                        (baseConsonant > baseLimit && !classTable->isVirama(chars[baseConsonant - 1])) ||
sl@0
   606
                        (!hasPostBaseForm && !hasBelowBaseForm)) {
sl@0
   607
                        break;
sl@0
   608
                    }
sl@0
   609
sl@0
   610
                    // Consonants with nuktas are never vattus
sl@0
   611
                    seenVattu = !hasNukta && IndicClassTable::isVattu(charClass);
sl@0
   612
sl@0
   613
                    if (hasPostBaseForm) {
sl@0
   614
                        if (seenBelowBaseForm) {
sl@0
   615
                            break;
sl@0
   616
                        }
sl@0
   617
sl@0
   618
                        postBase = baseConsonant;
sl@0
   619
                    } else if (hasBelowBaseForm) {
sl@0
   620
                        seenBelowBaseForm = TRUE;
sl@0
   621
                    }
sl@0
   622
sl@0
   623
                    postBaseLimit -= 1;
sl@0
   624
                }
sl@0
   625
sl@0
   626
                baseConsonant -= 1;
sl@0
   627
            }
sl@0
   628
sl@0
   629
            // Write Mpre
sl@0
   630
            output.writeMpre();
sl@0
   631
sl@0
   632
            // Write eyelash RA
sl@0
   633
            // NOTE: baseLimit == prev + 3 iff eyelash RA present...
sl@0
   634
            if (baseLimit == prev + 3) {
sl@0
   635
                output.writeChar(chars[prev], prev, &tagArray[2]);
sl@0
   636
                output.writeChar(chars[prev + 1], prev + 1, &tagArray[2]);
sl@0
   637
                output.writeChar(chars[prev + 2], prev + 2, &tagArray[2]);
sl@0
   638
            }
sl@0
   639
sl@0
   640
            // write any pre-base consonants
sl@0
   641
            le_bool supressVattu = TRUE;
sl@0
   642
sl@0
   643
            for (i = baseLimit; i < baseConsonant; i += 1) {
sl@0
   644
                LEUnicode ch = chars[i];
sl@0
   645
                // Don't put 'blwf' on first consonant.
sl@0
   646
                const LETag *tag = (i == baseLimit? &tagArray[2] : &tagArray[1]);
sl@0
   647
                IndicClassTable::CharClass charClass = classTable->getCharClass(ch);
sl@0
   648
                IndicClassTable::CharClass nextCharClass =
sl@0
   649
                	classTable->getCharClass(chars[i + 1]);
sl@0
   650
                	
sl@0
   651
                // Nokia: Added a check to see if the character that is two characters after
sl@0
   652
                // the RA is a ZWJ, which then doesn't allow the RA to become a VATTU and allows
sl@0
   653
                // the formation of an EYELASH RA
sl@0
   654
                le_bool isGenuineVattu = IndicClassTable::isVattu(charClass)
sl@0
   655
                	&& !IndicClassTable::isNukta(nextCharClass)
sl@0
   656
                	&& chars[i + 2] != C_SIGN_ZWJ;
sl@0
   657
sl@0
   658
                if (IndicClassTable::isConsonant(charClass)) {
sl@0
   659
                    if (isGenuineVattu && supressVattu) {
sl@0
   660
                        tag = &tagArray[4];
sl@0
   661
                    }
sl@0
   662
sl@0
   663
                    supressVattu = isGenuineVattu;
sl@0
   664
                } else if (IndicClassTable::isVirama(charClass) && chars[i + 1] == C_SIGN_ZWNJ)
sl@0
   665
                {
sl@0
   666
                    tag = &tagArray[4];
sl@0
   667
                }
sl@0
   668
sl@0
   669
                output.writeChar(ch, i, tag);
sl@0
   670
            }
sl@0
   671
sl@0
   672
            le_int32 bcSpan = baseConsonant + 1;
sl@0
   673
sl@0
   674
            if (bcSpan < markStart && classTable->isNukta(chars[bcSpan])) {
sl@0
   675
                bcSpan += 1;
sl@0
   676
            }
sl@0
   677
sl@0
   678
            if (baseConsonant == lastConsonant && bcSpan < markStart && classTable->isVirama(chars[bcSpan])) {
sl@0
   679
                bcSpan += 1;
sl@0
   680
sl@0
   681
                if (bcSpan < markStart && chars[bcSpan] == C_SIGN_ZWNJ) {
sl@0
   682
                    bcSpan += 1;
sl@0
   683
                }
sl@0
   684
            }
sl@0
   685
sl@0
   686
            // note the base consonant for post-GSUB fixups
sl@0
   687
            output.noteBaseConsonant();
sl@0
   688
sl@0
   689
            // write base consonant
sl@0
   690
            for (i = baseConsonant; i < bcSpan; i += 1) {
sl@0
   691
	        	// 1922 mlyl -->
sl@0
   692
	        	if (i >= 2 && chars[i] == C_SIGN_ZWJ && classTable->isMlylChillu(chars[i-2]))
sl@0
   693
	        		output.writeChar(chars[i], i, &tagArray[2]);
sl@0
   694
	        	else
sl@0
   695
	        	// <-- 1922 mlyl
sl@0
   696
	                output.writeChar(chars[i], i, &tagArray[4]);
sl@0
   697
            }
sl@0
   698
sl@0
   699
            //write Mbelow, SMbelow, Mabove, Mpost after base consonant with flag SF_MATRAS_AFTER_BASE setting
sl@0
   700
            if ((classTable->scriptFlags & SF_MATRAS_AFTER_BASE) != 0) {
sl@0
   701
                output.writeMbelow();
sl@0
   702
                output.writeSMbelow(); // FIXME: there are no SMs in these scripts...
sl@0
   703
                output.writeMabove();
sl@0
   704
                output.writeMpost();
sl@0
   705
            }
sl@0
   706
sl@0
   707
            // write below-base consonants
sl@0
   708
            if (baseConsonant != lastConsonant) {
sl@0
   709
                for (i = bcSpan + 1; i < postBase; i += 1) {
sl@0
   710
                    output.writeChar(chars[i], i, &tagArray[1]);
sl@0
   711
                }
sl@0
   712
sl@0
   713
                if (postBase > lastConsonant) {
sl@0
   714
                    // write halant that was after base consonant
sl@0
   715
                    output.writeChar(chars[bcSpan], bcSpan, &tagArray[1]);
sl@0
   716
                }
sl@0
   717
            }
sl@0
   718
sl@0
   719
            // Added by Nokia: write Mbelow, SMbelow, Mabove after below-base consonants without flag SF_MATRAS_AFTER_BASE or SF_MATRAS_AFTER_POSTBASE
sl@0
   720
            if (((classTable->scriptFlags & SF_MATRAS_AFTER_BASE) == 0) &&
sl@0
   721
            	((classTable->scriptFlags & SF_MATRAS_AFTER_POSTBASE) == 0)) {
sl@0
   722
            	output.writeMbelow();
sl@0
   723
                output.writeSMbelow();
sl@0
   724
                output.writeMabove();
sl@0
   725
            }
sl@0
   726
sl@0
   727
            if ((classTable->scriptFlags & SF_REPH_AFTER_BELOW) != 0) {
sl@0
   728
                if (baseLimit == prev + 2) {
sl@0
   729
                    output.writeChar(chars[prev], prev, &tagArray[0]);
sl@0
   730
                    output.writeChar(chars[prev + 1], prev + 1, &tagArray[0]);
sl@0
   731
                }
sl@0
   732
sl@0
   733
                output.writeVMabove();
sl@0
   734
                output.writeSMabove(); // FIXME: there are no SM's in these scripts...
sl@0
   735
            }
sl@0
   736
sl@0
   737
            // write post-base consonants
sl@0
   738
            // FIXME: does this put the right tags on post-base consonants?
sl@0
   739
            if (baseConsonant != lastConsonant) {
sl@0
   740
                if (postBase <= lastConsonant) {
sl@0
   741
                    for (i = postBase; i <= lastConsonant; i += 1) {
sl@0
   742
                        output.writeChar(chars[i], i, &tagArray[3]);
sl@0
   743
                    }
sl@0
   744
sl@0
   745
                    // write halant that was after base consonant
sl@0
   746
                    output.writeChar(chars[bcSpan], bcSpan, &tagArray[1]);
sl@0
   747
                }
sl@0
   748
sl@0
   749
                // write the training halant, if there is one
sl@0
   750
                if (lastConsonant < matra && classTable->isVirama(chars[matra])) {
sl@0
   751
                    output.writeChar(chars[matra], matra, &tagArray[4]);
sl@0
   752
                }
sl@0
   753
            }
sl@0
   754
	        
sl@0
   755
            // Added by Nokia: write Mbelow, SMbelow, Mabove and Mpost after post-base consonants with flag SF_MATRAS_AFTER_POSTBASE
sl@0
   756
	        if ((classTable->scriptFlags & SF_MATRAS_AFTER_POSTBASE) != 0) {
sl@0
   757
	        		output.writeMbelow();
sl@0
   758
                    output.writeSMbelow();
sl@0
   759
                    output.writeMabove();
sl@0
   760
                    output.writeMpost();
sl@0
   761
	        }
sl@0
   762
sl@0
   763
	        //Added by Nokia: write Mpost finally
sl@0
   764
            if (((classTable->scriptFlags & SF_MATRAS_AFTER_BASE) == 0) &&
sl@0
   765
            	((classTable->scriptFlags & SF_MATRAS_AFTER_POSTBASE) == 0)) {
sl@0
   766
                output.writeMpost();
sl@0
   767
	        }
sl@0
   768
            
sl@0
   769
	        output.writeLengthMark();
sl@0
   770
sl@0
   771
            // write reph
sl@0
   772
            if ((classTable->scriptFlags & SF_REPH_AFTER_BELOW) == 0) {
sl@0
   773
                if (baseLimit == prev + 2) {
sl@0
   774
                    output.writeChar(chars[prev], prev, &tagArray[0]);
sl@0
   775
                    output.writeChar(chars[prev + 1], prev + 1, &tagArray[0]);
sl@0
   776
                }
sl@0
   777
sl@0
   778
                output.writeVMabove();
sl@0
   779
                output.writeSMabove();
sl@0
   780
            }
sl@0
   781
sl@0
   782
            output.writeVMpost();
sl@0
   783
sl@0
   784
            break;
sl@0
   785
        }
sl@0
   786
sl@0
   787
        default:
sl@0
   788
            break;
sl@0
   789
        }
sl@0
   790
sl@0
   791
        prev = syllable;
sl@0
   792
    }
sl@0
   793
sl@0
   794
    *outMPreFixups = mpreFixups;
sl@0
   795
sl@0
   796
    return output.getOutputIndex();
sl@0
   797
}
sl@0
   798
sl@0
   799
void IndicReordering::adjustMPres(MPreFixups *mpreFixups,
sl@0
   800
    LEGlyphStorage &glyphStorage, LEErrorCode& success)
sl@0
   801
{
sl@0
   802
    if (LE_SUCCESS(success) && mpreFixups != NULL) {
sl@0
   803
        mpreFixups->apply(glyphStorage, success);
sl@0
   804
        
sl@0
   805
        delete mpreFixups;
sl@0
   806
    }
sl@0
   807
}
sl@0
   808
sl@0
   809
U_NAMESPACE_END