2362N/A * or visit www.oracle.com if you need additional information or have any
0N/A#include "OpenTypeTables.h"
0N/A#include "OpenTypeUtilities.h"
0N/A#include "IndicReordering.h"
0N/A#include "LEGlyphStorage.h"
0N/A#include "MPreFixups.h"
3171N/A#define basicShapingFormsMask ( loclFeatureMask | nuktFeatureMask | akhnFeatureMask | rkrfFeatureMask | blwfFeatureMask | halfFeatureMask | vatuFeatureMask | cjctFeatureMask )
3171N/A#define positioningFormsMask ( kernFeatureMask | distFeatureMask | abvmFeatureMask | blwmFeatureMask )
3171N/A#define presentationFormsMask ( presFeatureMask | abvsFeatureMask | blwsFeatureMask | pstsFeatureMask | halnFeatureMask | caltFeatureMask )
3171N/A// Some level of debate as to the proper value for MAX_CONSONANTS_PER_SYLLABLE. Ticket 5588 states that 4
0N/A case CF_POS_BEFORE:
0N/A case CF_POS_BELOW:
0N/A case CF_POS_ABOVE:
0N/A case CF_POS_AFTER:
3171N/A IndicReorderingOutput(LEUnicode *outChars, LEGlyphStorage &glyphStorage, MPreFixups *mpreFixups)
3171N/A fMpost(0), fMpostIndex(0), fLengthMark(0), fLengthMarkIndex(0), fAlLakuna(0), fAlLakunaIndex(0),
3171N/A fGlyphStorage.setAuxData(fOutIndex, charFeatures | (fSyllableCount & LE_GLYPH_GROUP_MASK), success);
3171N/A void decomposeReorderMatras ( const IndicClassTable *classTable, le_int32 beginSyllable, le_int32 nextSyllable, le_int32 inv_count ) {
3171N/A void insertCharacter( LEUnicode ch, le_int32 toPosition, le_int32 charIndex, le_uint32 auxData ) {
1693N/A le_bool noteMatra(const IndicClassTable *classTable, LEUnicode matra, le_uint32 matraIndex, FeatureMask matraFeatures, le_bool wordStart)
1693N/A void noteVowelModifier(const IndicClassTable *classTable, LEUnicode vowelModifier, le_uint32 vowelModifierIndex, FeatureMask vowelModifierFeatures)
0N/A case CF_POS_ABOVE:
0N/A case CF_POS_AFTER:
1693N/A void noteStressMark(const IndicClassTable *classTable, LEUnicode stressMark, le_uint32 stressMarkIndex, FeatureMask stressMarkFeatures)
0N/A case CF_POS_ABOVE:
0N/A case CF_POS_BELOW:
3171N/A void notePreBaseConsonant(le_uint32 index,LEUnicode PBConsonant, LEUnicode PBVirama, FeatureMask features)
0N/A if (fLengthMark != 0) {
3171N/A // The TDIL spec says that consonant + virama + RRA should produce a rakar in Malayalam. However,
3171N/A // So, we're going to force the issue here by using the rakar as defined with RA in most fonts.
3171N/A if (fPreBaseConsonant != 0) {
3171N/A#define tagArray4 (loclFeatureMask | nuktFeatureMask | akhnFeatureMask | vatuFeatureMask | presFeatureMask | blwsFeatureMask | abvsFeatureMask | pstsFeatureMask | halnFeatureMask | blwmFeatureMask | abvmFeatureMask | distFeatureMask)
3171N/A {-1, -1, -1, -1, -1, -1, 3, 2, -1, -1, -1, -1, -1, -1, -1, -1}, // 7 - consonant virama ZWJ, consonant ZWJ virama
3171N/A {-1, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1}, // 8 - independent vowels that can take a virama
3171N/A {-1, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 5, -1, -1, -1}, // 9 - first part of split vowel
3171N/A {-1, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, -1, -1, -1}, // 10 - second part of split vowel
3171N/A {-1, 6, 1, -1, -1, -1, -1, -1, -1, 5, 9, 5, 5, 4, -1, -1}, // 11 - independent vowels that can take an iv
3171N/A {-1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, -1, 7}, // 12 - consonant ZWJ (TODO: Take everything else that can be after a consonant?)
3171N/A {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, -1} // 13 - consonant al-lakuna ZWJ consonant
0N/A return featureMap;
3171N/A return v2FeatureMap;
1693N/Ale_int32 IndicReordering::findSyllable(const IndicClassTable *classTable, const LEUnicode *chars, le_int32 prev, le_int32 charCount)
0N/Ale_int32 IndicReordering::reorder(const LEUnicode *chars, le_int32 charCount, le_int32 scriptCode,
0N/A while (output.noteMatra(classTable, chars[matra], matra, tagArray1, !lastInWord) && matra != prev) {
0N/A case CC_RESERVED:
0N/A case CC_INDEPENDENT_VOWEL:
0N/A case CC_ZERO_WIDTH_MARK:
3171N/A case CC_AL_LAKUNA:
0N/A case CC_DEPENDENT_VOWEL:
0N/A case CC_SPLIT_VOWEL_PIECE_1:
0N/A case CC_SPLIT_VOWEL_PIECE_2:
0N/A case CC_SPLIT_VOWEL_PIECE_3:
0N/A case CC_VOWEL_MODIFIER:
0N/A case CC_STRESS_MARK:
0N/A case CC_INDEPENDENT_VOWEL_2:
0N/A case CC_INDEPENDENT_VOWEL_3:
0N/A case CC_CONSONANT:
0N/A case CC_CONSONANT_WITH_NUKTA:
3171N/A if (length > 2 && classTable->isReph(chars[prev]) && classTable->isVirama(chars[prev + 1]) && chars[prev + 2] != C_SIGN_ZWNJ) {
3171N/A output.notePreBaseConsonant(lastConsonant,chars[lastConsonant],chars[lastConsonant-1],tagArray2);
3171N/A if (hasPostBaseForm) {
0N/A if (seenBelowBaseForm) {
3171N/A } else if (hasBelowBaseForm) {
3171N/Avoid IndicReordering::adjustMPres(MPreFixups *mpreFixups, LEGlyphStorage &glyphStorage, LEErrorCode& success)
0N/A delete mpreFixups;
3171N/A// This sets us up for 2nd pass of glyph substitution as well as setting the feature masks for the
3171N/A if ( ( tmpGlyph != NO_GLYPH ) && (tmpAuxData & rephConsonantMask) && !(tmpAuxData & repositionedGlyphMask)) {
3171N/A while (!targetPositionFound) {
3171N/A targetPositionFound = true;
3171N/A while (!targetPositionHasGlyph) {
3171N/A targetPositionHasGlyph = true;
3171N/A while ( !checkMatraDone ) {
3171N/A if ( checkMatraPosition >= count || ( (tmpAuxData ^ baseConsonantData) & LE_GLYPH_GROUP_MASK)) {
3171N/A checkMatraDone = true;
3171N/Ale_int32 IndicReordering::v2process(const LEUnicode *chars, le_int32 charCount, le_int32 scriptCode,
3171N/A le_int32 i, firstConsonant, baseConsonant, secondConsonant, inv_count = 0, beginSyllable = 0;
3171N/A // If the syllable starts with Ra + Halant ( in a script that has Reph ) and has more than one
3171N/A if ( i == baseConsonant ) {
3171N/Avoid IndicReordering::getDynamicProperties( DynamicProperties *, const IndicClassTable *classTable ) {
3171N/A for ( currentChar = classTable->firstChar ; currentChar <= classTable->lastChar ; currentChar++ ) {
3171N/A for ( currentChar = classTable->firstChar ; currentChar <= classTable->lastChar ; currentChar++ ) {