2362N/A * or visit www.oracle.com if you need additional information or have any
0N/A * This file is a modification of the ICU file IndicReordering.cpp
0N/A#include "OpenTypeTables.h"
0N/A#include "KhmerReordering.h"
0N/A#include "LEGlyphStorage.h"
1693N/A // simple classes, they are used in the statetable (in this file) to control the length of a syllable
1693N/A // they are also used to know where a character should be placed (location in reference to the base character)
1693N/A // and also to know if a character, when independtly displayed, should be displayed with a dotted-circle to
1693N/A _sa = KhmerClassTable::CC_SIGN_ABOVE | KhmerClassTable::CF_DOTTED_CIRCLE | KhmerClassTable::CF_POS_ABOVE,
1693N/A _sp = KhmerClassTable::CC_SIGN_AFTER | KhmerClassTable::CF_DOTTED_CIRCLE| KhmerClassTable::CF_POS_AFTER,
1693N/A _rb = KhmerClassTable::CC_ROBAT | KhmerClassTable::CF_POS_ABOVE | KhmerClassTable::CF_DOTTED_CIRCLE,
1693N/A _cs = KhmerClassTable::CC_CONSONANT_SHIFTER | KhmerClassTable::CF_DOTTED_CIRCLE | KhmerClassTable::CF_SHIFTER,
1693N/A _dl = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_BEFORE | KhmerClassTable::CF_DOTTED_CIRCLE,
1693N/A _db = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_BELOW | KhmerClassTable::CF_DOTTED_CIRCLE,
1693N/A _da = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_ABOVE | KhmerClassTable::CF_DOTTED_CIRCLE | KhmerClassTable::CF_ABOVE_VOWEL,
1693N/A _dr = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_AFTER | KhmerClassTable::CF_DOTTED_CIRCLE,
1693N/A _co = KhmerClassTable::CC_COENG | KhmerClassTable::CF_COENG | KhmerClassTable::CF_DOTTED_CIRCLE,
1693N/A// _xx character does not combine into syllable, such as numbers, puntuation marks, non-Khmer signs...
1693N/A// _c1 Consonant of type 1 or independent vowel (independent vowels behave as type 1 consonants)
1693N/A// _co Khmer combining mark COENG u17D2, combines with the consonant or independent vowel following
1693N/A// _va Khmer split vowel in wich the first part is before the base and the second one above the base
1693N/A// _vr Khmer split vowel in wich the first part is before the base and the second one behind (right of) the base
1693N/A// The range of characters defined in the above table is defined here. FOr Khmer 1780 to 17DF
1693N/A// Even if the Khmer range is bigger, all other characters are not combinable, and therefore treated
1693N/A// Below we define how a character in the input string is either in the khmerCharClasses table
1693N/A// within the syllable, but are not in the table) we also get their type back, or an unknown object
0N/A return CC_ZERO_WIDTH_J_MARK;
0N/A return CC_ZERO_WIDTH_NJ_MARK;
0N/A return CC_RESERVED;
0N/A return &khmerClassTable;
3171N/A fGlyphStorage.setAuxData(fOutIndex, charFeatures | (fSyllableCount & LE_GLYPH_GROUP_MASK), success);
1693N/A#define tagAbvf (abvfFeatureMask | abvsFeatureMask | cligFeatureMask | distFeatureMask | abvmFeatureMask | mkmkFeatureMask)
1693N/A#define tagPstf (blwfFeatureMask | blwsFeatureMask | prefFeatureMask | presFeatureMask | pstfFeatureMask | pstsFeatureMask | cligFeatureMask | distFeatureMask | blwmFeatureMask)
1693N/A#define tagBlwf (blwfFeatureMask | blwsFeatureMask | cligFeatureMask | distFeatureMask | blwmFeatureMask | mkmkFeatureMask)
1693N/A#define tagDefault (prefFeatureMask | blwfFeatureMask | presFeatureMask | blwsFeatureMask | cligFeatureMask | distFeatureMask | abvmFeatureMask | blwmFeatureMask | mkmkFeatureMask)
1693N/A// CharClassValues in KhmerReordering.h This coincidence of values allows the
0N/A {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, // 1 - exit state (or sign to the right of the syllable)
0N/A {-1, 11, 11, 11, -1, -1, -1, -1, -1, -1, -1, -1}, // 10 - Second Coeng (no register shifter before)
1693N/A {-1, -1, -1, -1, 15, -1, -1, -1, 16, 17, 1, 14}, // 11 - Second coeng consonant (or ind. vowel) no register shifter before
3171N/A {-1, -1, -1, -1, -1, 13, -1, -1, 16, -1, -1, -1}, // 12 - Second ZWNJ before a register shifter
0N/A return featureMap;
1693N/Ale_int32 KhmerReordering::findSyllable(const KhmerClassTable *classTable, const LEUnicode *chars, le_int32 prev, le_int32 charCount)
1693N/A KhmerClassTable::CharClass charClass = (classTable->getCharClass(chars[cursor]) & KhmerClassTable::CF_CLASS_MASK);
1693N/Ale_int32 KhmerReordering::reorder(const LEUnicode *chars, le_int32 charCount, le_int32 /*scriptCode*/,
1693N/A ( (classTable->getCharClass(chars[i + 1]) & KhmerClassTable::CF_CLASS_MASK) == KhmerClassTable::CC_CONSONANT2) )
1693N/A && ( (classTable->getCharClass(chars[i + 1]) & KhmerClassTable::CF_CLASS_MASK) == C_VOWEL_AA)
1693N/A && ( (classTable->getCharClass(chars[i + 2]) & KhmerClassTable::CF_CLASS_MASK) == C_SIGN_NIKAHIT))
1693N/A || (i + 3 < syllable && (classTable->getCharClass(chars[i + 3]) & KhmerClassTable::CF_ABOVE_VOWEL))
1693N/A && ( (classTable->getCharClass(chars[i + 3]) & KhmerClassTable::CF_CLASS_MASK) == C_VOWEL_AA)
1693N/A && ( (classTable->getCharClass(chars[i + 4]) & KhmerClassTable::CF_CLASS_MASK) == C_SIGN_NIKAHIT) ) )