Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

ThaiShaping.h

Go to the documentation of this file.
00001 /*
00002  * @(#)ThaiShaping.h    1.9 00/03/15
00003  *
00004  * (C) Copyright IBM Corp. 1998, 1999, 2000 - All Rights Reserved
00005  *
00006  */
00007 
00008 #ifndef __THAISHAPING_H
00009 #define __THAISHAPING_H
00010 
00011 #include "LETypes.h"
00012 #include "LEGlyphFilter.h"
00013 #include "OpenTypeTables.h"
00014 
00015 class ThaiMarkFilter : public LEGlyphFilter
00016 {
00017 private:
00018     struct MarkRange
00019     {
00020         LEUnicode first;
00021         LEUnicode last;
00022     };
00023 
00024     MarkRange *rangeList;
00025 
00026 public:
00027     ThaiMarkFilter(le_uint8 glyphSet);
00028     ~ThaiMarkFilter();
00029 
00030     virtual le_bool filter(LEGlyphID glyph);
00031 };
00032 
00033 class ThaiShaping
00034 {
00035 public:
00036 
00037     enum {
00038         // Character classes
00039         NON     =  0,
00040         CON     =  1,
00041         COA     =  2,
00042         COD     =  3,
00043         LVO =  4,
00044         FV1     =  5,
00045         FV2     =  6,
00046         FV3     =  7,
00047         BV1     =  8,
00048         BV2     =  9,
00049         BDI = 10,
00050         TON     = 11,
00051         AD1     = 12,
00052         AD2     = 13,
00053         AD3     = 14,
00054         NIK     = 15,
00055         AV1     = 16,
00056         AV2     = 17,
00057         AV3     = 18,
00058         classCount = 19,
00059 
00060         // State Transition actions
00061         _A  =  0,
00062         _C  =  1,
00063         _D  =  2,
00064         _E  =  3,
00065         _F  =  4,
00066         _G  =  5,
00067         _H  =  6,
00068         _R  =  7,
00069         _S  =  8
00070     };
00071 
00072     struct StateTransition
00073     {
00074         le_uint8 nextState;
00075         le_uint8 action;
00076 
00077         le_uint8 getNextState() { return nextState; };
00078         le_uint8 getAction() { return action; };
00079     };
00080 
00081     static le_int32 compose(const LEUnicode *input, le_int32 offset, le_int32 charCount, le_uint8 glyphSet,
00082         LEUnicode errorChar, LEUnicode *output, le_int32 *charIndicies);
00083 
00084 private:
00085 
00086     static le_uint8 classTable[];
00087     static StateTransition thaiStateTable[][classCount];
00088     static StateTransition getTransition(le_uint8 state, le_uint8 currClass);
00089     static le_uint8 doTransition(StateTransition transition, LEUnicode currChar, le_int32 inputIndex, le_uint8 glyphSet,
00090         LEUnicode errorChar, LEUnicode *outputBuffer, le_int32 *charIndicies, le_int32 &outputIndex);
00091 
00092     static le_uint8 getNextState(LEUnicode ch, le_uint8 state, le_int32 inputIndex, le_uint8 glyphSet, LEUnicode errorChar,
00093         le_uint8 &charClass, LEUnicode *output, le_int32 *charIndicies, le_int32 &outputIndex);
00094 
00095     static le_bool isLegalHere(LEUnicode ch, le_uint8 prevState);
00096     static le_uint8 getCharClass(LEUnicode ch);
00097 
00098     static LEUnicode noDescenderCOD(LEUnicode cod, le_uint8 glyphSet);
00099     static LEUnicode leftAboveVowel(LEUnicode vowel, le_uint8 glyphSet);
00100     static LEUnicode lowerBelowVowel(LEUnicode vowel, le_uint8 glyphSet);
00101     static LEUnicode lowerRightTone(LEUnicode tone, le_uint8 glyphSet);
00102     static LEUnicode lowerLeftTone(LEUnicode tone, le_uint8 glyphSet);
00103     static LEUnicode upperLeftTone(LEUnicode tone, le_uint8 glyphSet);
00104 
00105 };
00106 
00107 inline ThaiShaping::StateTransition ThaiShaping::getTransition(le_uint8 state, le_uint8 currClass)
00108 {
00109     return thaiStateTable[state][currClass];
00110 }
00111 
00112 #endif
00113 
00114 

Generated at Tue Dec 5 18:13:04 2000 for ICU by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000