0N/A/*
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A *
0N/A */
0N/A
0N/A/*
0N/A * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
0N/A *
0N/A * This file is a modification of the ICU file IndicReordering.h
0N/A * by Jens Herden and Javier Sola for Khmer language
0N/A *
0N/A */
0N/A
0N/A#ifndef __KHMERREORDERING_H
0N/A#define __KHMERREORDERING_H
0N/A
1693N/A/**
1693N/A * \file
1693N/A * \internal
1693N/A */
1693N/A
0N/A#include "LETypes.h"
0N/A#include "OpenTypeTables.h"
0N/A
1693N/AU_NAMESPACE_BEGIN
1693N/A
0N/Aclass LEGlyphStorage;
0N/A
0N/A// Vocabulary
1693N/A// Base -> A consonant or an independent vowel in its full (not subscript) form. It is the
1693N/A// center of the syllable, it can be souranded by coeng (subscript) consonants, vowels,
1693N/A// split vowels, signs... but there is only one base in a syllable, it has to be coded as
1693N/A// the first character of the syllable.
1693N/A// split vowel --> vowel that has two parts placed separately (e.g. Before and after the consonant).
1693N/A// Khmer language has five of them. Khmer split vowels either have one part before the
1693N/A// base and one after the base or they have a part before the base and a part above the base.
1693N/A// The first part of all Khmer split vowels is the same character, identical to
1693N/A// the glyph of Khmer dependent vowel SRA EI
1693N/A// coeng --> modifier used in Khmer to construct coeng (subscript) consonants
1693N/A// Differently than indian languages, the coeng modifies the consonant that follows it,
1693N/A// not the one preceding it Each consonant has two forms, the base form and the subscript form
1693N/A// the base form is the normal one (using the consonants code-point), the subscript form is
1693N/A// displayed when the combination coeng + consonant is encountered.
1693N/A// Consonant of type 1 -> A consonant which has subscript for that only occupies space under a base consonant
1693N/A// Consonant of type 2.-> Its subscript form occupies space under and before the base (only one, RO)
1693N/A// Consonant of Type 3 -> Its subscript form occupies space under and after the base (KHO, CHHO, THHO, BA, YO, SA)
1693N/A// Consonant shifter -> Khmer has to series of consonants. The same dependent vowel has different sounds
1693N/A// if it is attached to a consonant of the first series or a consonant of the second series
1693N/A// Most consonants have an equivalent in the other series, but some of theme exist only in
1693N/A// one series (for example SA). If we want to use the consonant SA with a vowel sound that
1693N/A// can only be done with a vowel sound that corresponds to a vowel accompanying a consonant
1693N/A// of the other series, then we need to use a consonant shifter: TRIISAP or MUSIKATOAN
1693N/A// x17C9 y x17CA. TRIISAP changes a first series consonant to second series sound and
1693N/A// MUSIKATOAN a second series consonant to have a first series vowel sound.
1693N/A// Consonant shifter are both normally supercript marks, but, when they are followed by a
1693N/A// superscript, they change shape and take the form of subscript dependent vowel SRA U.
1693N/A// If they are in the same syllable as a coeng consonant, Unicode 3.0 says that they
1693N/A// should be typed before the coeng. Unicode 4.0 breaks the standard and says that it should
1693N/A// be placed after the coeng consonant.
1693N/A// Dependent vowel -> In khmer dependent vowels can be placed above, below, before or after the base
1693N/A// Each vowel has its own position. Only one vowel per syllable is allowed.
1693N/A// Signs -> Khmer has above signs and post signs. Only one above sign and/or one post sign are
1693N/A// Allowed in a syllable.
1693N/A//
0N/A//
0N/A
1693N/Astruct KhmerClassTable // This list must include all types of components that can be used inside a syllable
0N/A{
1693N/A enum CharClassValues // order is important here! This order must be the same that is found in each horizontal
1693N/A // line in the statetable for Khmer (file KhmerReordering.cpp).
0N/A {
0N/A CC_RESERVED = 0,
0N/A CC_CONSONANT = 1, // consonant of type 1 or independent vowel
0N/A CC_CONSONANT2 = 2, // Consonant of type 2
0N/A CC_CONSONANT3 = 3, // Consonant of type 3
0N/A CC_ZERO_WIDTH_NJ_MARK = 4, // Zero Width non joiner character (0x200C)
0N/A CC_CONSONANT_SHIFTER = 5,
1693N/A CC_ROBAT = 6, // Khmer special diacritic accent -treated differently in state table
0N/A CC_COENG = 7, // Subscript consonant combining character
0N/A CC_DEPENDENT_VOWEL = 8,
0N/A CC_SIGN_ABOVE = 9,
0N/A CC_SIGN_AFTER = 10,
0N/A CC_ZERO_WIDTH_J_MARK = 11, // Zero width joiner character
0N/A CC_COUNT = 12 // This is the number of character classes
0N/A };
0N/A
0N/A enum CharClassFlags
0N/A {
0N/A CF_CLASS_MASK = 0x0000FFFF,
0N/A
0N/A CF_CONSONANT = 0x01000000, // flag to speed up comparing
1693N/A CF_SPLIT_VOWEL = 0x02000000, // flag for a split vowel -> the first part is added in front of the syllable
1693N/A CF_DOTTED_CIRCLE = 0x04000000, // add a dotted circle if a character with this flag is the first in a syllable
0N/A CF_COENG = 0x08000000, // flag to speed up comparing
0N/A CF_SHIFTER = 0x10000000, // flag to speed up comparing
0N/A CF_ABOVE_VOWEL = 0x20000000, // flag to speed up comparing
0N/A
0N/A // position flags
0N/A CF_POS_BEFORE = 0x00080000,
0N/A CF_POS_BELOW = 0x00040000,
0N/A CF_POS_ABOVE = 0x00020000,
0N/A CF_POS_AFTER = 0x00010000,
0N/A CF_POS_MASK = 0x000f0000
0N/A };
0N/A
0N/A typedef le_uint32 CharClass;
0N/A
0N/A typedef le_int32 ScriptFlags;
0N/A
0N/A LEUnicode firstChar; // for Khmer this will become x1780
0N/A LEUnicode lastChar; // and this x17DF
0N/A const CharClass *classTable;
0N/A
0N/A CharClass getCharClass(LEUnicode ch) const;
0N/A
0N/A static const KhmerClassTable *getKhmerClassTable();
0N/A};
0N/A
0N/A
1693N/Aclass KhmerReordering /* not : public UObject because all methods are static */ {
0N/Apublic:
1693N/A static le_int32 reorder(const LEUnicode *theChars, le_int32 charCount, le_int32 scriptCode,
1693N/A LEUnicode *outChars, LEGlyphStorage &glyphStorage);
0N/A
0N/A static const FeatureMap *getFeatureMap(le_int32 &count);
0N/A
0N/Aprivate:
0N/A // do not instantiate
0N/A KhmerReordering();
0N/A
1693N/A static le_int32 findSyllable(const KhmerClassTable *classTable, const LEUnicode *chars, le_int32 prev, le_int32 charCount);
1693N/A
0N/A};
0N/A
1693N/A
1693N/AU_NAMESPACE_END
0N/A#endif