2000-11-14 21:22:14 +00:00
|
|
|
/*
|
|
|
|
*
|
2004-04-12 18:51:31 +00:00
|
|
|
* (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
|
2000-11-14 21:22:14 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __THAISHAPING_H
|
|
|
|
#define __THAISHAPING_H
|
|
|
|
|
2003-01-13 23:15:11 +00:00
|
|
|
/**
|
|
|
|
* \file
|
|
|
|
* \internal
|
|
|
|
*/
|
|
|
|
|
2000-11-14 21:22:14 +00:00
|
|
|
#include "LETypes.h"
|
|
|
|
#include "LEGlyphFilter.h"
|
|
|
|
#include "OpenTypeTables.h"
|
|
|
|
|
2001-10-16 00:39:01 +00:00
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
2004-04-12 18:51:31 +00:00
|
|
|
class LEGlyphStorage;
|
|
|
|
|
2002-06-29 00:04:16 +00:00
|
|
|
class ThaiShaping /* not : public UObject because all methods are static */ {
|
2000-11-14 21:22:14 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
enum {
|
|
|
|
// Character classes
|
2002-04-02 03:33:42 +00:00
|
|
|
NON = 0,
|
|
|
|
CON = 1,
|
|
|
|
COA = 2,
|
|
|
|
COD = 3,
|
2000-11-14 21:22:14 +00:00
|
|
|
LVO = 4,
|
2002-04-02 03:33:42 +00:00
|
|
|
FV1 = 5,
|
|
|
|
FV2 = 6,
|
|
|
|
FV3 = 7,
|
|
|
|
BV1 = 8,
|
|
|
|
BV2 = 9,
|
2000-11-14 21:22:14 +00:00
|
|
|
BDI = 10,
|
2002-04-02 03:33:42 +00:00
|
|
|
TON = 11,
|
|
|
|
AD1 = 12,
|
|
|
|
AD2 = 13,
|
|
|
|
AD3 = 14,
|
|
|
|
NIK = 15,
|
|
|
|
AV1 = 16,
|
|
|
|
AV2 = 17,
|
|
|
|
AV3 = 18,
|
2000-11-14 21:22:14 +00:00
|
|
|
classCount = 19,
|
|
|
|
|
|
|
|
// State Transition actions
|
2003-08-19 22:27:44 +00:00
|
|
|
tA = 0,
|
|
|
|
tC = 1,
|
|
|
|
tD = 2,
|
|
|
|
tE = 3,
|
|
|
|
tF = 4,
|
|
|
|
tG = 5,
|
|
|
|
tH = 6,
|
|
|
|
tR = 7,
|
|
|
|
tS = 8
|
2000-11-14 21:22:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct StateTransition
|
|
|
|
{
|
|
|
|
le_uint8 nextState;
|
|
|
|
le_uint8 action;
|
|
|
|
|
|
|
|
le_uint8 getNextState() { return nextState; };
|
|
|
|
le_uint8 getAction() { return action; };
|
|
|
|
};
|
|
|
|
|
|
|
|
static le_int32 compose(const LEUnicode *input, le_int32 offset, le_int32 charCount, le_uint8 glyphSet,
|
2004-04-12 18:51:31 +00:00
|
|
|
LEUnicode errorChar, LEUnicode *output, LEGlyphStorage &glyphStorage);
|
2000-11-14 21:22:14 +00:00
|
|
|
|
|
|
|
private:
|
2002-06-29 00:04:16 +00:00
|
|
|
// forbid instantiation
|
|
|
|
ThaiShaping();
|
2000-11-14 21:22:14 +00:00
|
|
|
|
2002-03-27 23:22:21 +00:00
|
|
|
static const le_uint8 classTable[];
|
|
|
|
static const StateTransition thaiStateTable[][classCount];
|
|
|
|
|
2000-11-14 21:22:14 +00:00
|
|
|
static StateTransition getTransition(le_uint8 state, le_uint8 currClass);
|
|
|
|
static le_uint8 doTransition(StateTransition transition, LEUnicode currChar, le_int32 inputIndex, le_uint8 glyphSet,
|
2004-04-12 18:51:31 +00:00
|
|
|
LEUnicode errorChar, LEUnicode *outputBuffer, LEGlyphStorage &glyphStorage, le_int32 &outputIndex);
|
2000-11-14 21:22:14 +00:00
|
|
|
|
|
|
|
static le_uint8 getNextState(LEUnicode ch, le_uint8 state, le_int32 inputIndex, le_uint8 glyphSet, LEUnicode errorChar,
|
2004-04-12 18:51:31 +00:00
|
|
|
le_uint8 &charClass, LEUnicode *output, LEGlyphStorage &glyphStorage, le_int32 &outputIndex);
|
2000-11-14 21:22:14 +00:00
|
|
|
|
|
|
|
static le_bool isLegalHere(LEUnicode ch, le_uint8 prevState);
|
|
|
|
static le_uint8 getCharClass(LEUnicode ch);
|
|
|
|
|
|
|
|
static LEUnicode noDescenderCOD(LEUnicode cod, le_uint8 glyphSet);
|
|
|
|
static LEUnicode leftAboveVowel(LEUnicode vowel, le_uint8 glyphSet);
|
|
|
|
static LEUnicode lowerBelowVowel(LEUnicode vowel, le_uint8 glyphSet);
|
|
|
|
static LEUnicode lowerRightTone(LEUnicode tone, le_uint8 glyphSet);
|
|
|
|
static LEUnicode lowerLeftTone(LEUnicode tone, le_uint8 glyphSet);
|
|
|
|
static LEUnicode upperLeftTone(LEUnicode tone, le_uint8 glyphSet);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
inline ThaiShaping::StateTransition ThaiShaping::getTransition(le_uint8 state, le_uint8 currClass)
|
|
|
|
{
|
|
|
|
return thaiStateTable[state][currClass];
|
|
|
|
}
|
|
|
|
|
2001-10-16 00:39:01 +00:00
|
|
|
U_NAMESPACE_END
|
2000-11-14 21:22:14 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|