sl@0: 
sl@0: /*
sl@0:  *
sl@0:  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved 
sl@0:  *
sl@0:  * This file is a modification of the ICU file IndicLayoutEngine.h
sl@0:  * by Jens Herden and Javier Sola for Khmer language 
sl@0:  *
sl@0:  */
sl@0: 
sl@0: #ifndef __KHMERLAYOUTENGINE_H
sl@0: #define __KHMERLAYOUTENGINE_H
sl@0: 
sl@0: // #include "LETypes.h"
sl@0: // #include "LEFontInstance.h"
sl@0: // #include "LEGlyphFilter.h"
sl@0: // #include "LayoutEngine.h"
sl@0: // #include "OpenTypeLayoutEngine.h"
sl@0: 
sl@0: // #include "GlyphSubstitutionTables.h"
sl@0: // #include "GlyphDefinitionTables.h"
sl@0: // #include "GlyphPositioningTables.h"
sl@0: 
sl@0: U_NAMESPACE_BEGIN
sl@0: 
sl@0: // class MPreFixups;
sl@0: // class LEGlyphStorage;
sl@0: 
sl@0: /**
sl@0:  * This class implements OpenType layout for Khmer OpenType fonts, as
sl@0:  * specified by Microsoft in "Creating and Supporting OpenType Fonts for
sl@0:  * Khmer Scripts" (http://www.microsoft.com/typography/otspec/indicot/default.htm) TODO: change url
sl@0:  *
sl@0:  * This class overrides the characterProcessing method to do Khmer character processing
sl@0:  * and reordering (See the MS spec. for more details)
sl@0:  *
sl@0:  * @internal
sl@0:  */
sl@0: class KhmerOpenTypeLayoutEngine : public OpenTypeLayoutEngine
sl@0: {
sl@0: public:
sl@0:     /**
sl@0:      * This is the main constructor. It constructs an instance of KhmerOpenTypeLayoutEngine for
sl@0:      * a particular font, script and language. It takes the GSUB table as a parameter since
sl@0:      * LayoutEngine::layoutEngineFactory has to read the GSUB table to know that it has an
sl@0:      * Khmer OpenType font.
sl@0:      *
sl@0:      * @param fontInstance - the font
sl@0:      * @param scriptCode - the script
sl@0:      * @param langaugeCode - the language
sl@0:      * @param gsubTable - the GSUB table
sl@0:      *
sl@0:      * @see LayoutEngine::layoutEngineFactory
sl@0:      * @see OpenTypeLayoutEngine
sl@0:      * @see ScriptAndLangaugeTags.h for script and language codes
sl@0:      *
sl@0:      * @internal
sl@0:      */
sl@0:     KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
sl@0:                             le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
sl@0: 
sl@0:     /**
sl@0:      * This constructor is used when the font requires a "canned" GSUB table which can't be known
sl@0:      * until after this constructor has been invoked.
sl@0:      *
sl@0:      * @param fontInstance - the font
sl@0:      * @param scriptCode - the script
sl@0:      * @param langaugeCode - the language
sl@0:      *
sl@0:      * @see OpenTypeLayoutEngine
sl@0:      * @see ScriptAndLangaugeTags.h for script and language codes
sl@0:      *
sl@0:      * @internal
sl@0:      */
sl@0:     KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
sl@0: 			      le_int32 typoFlags);
sl@0: 
sl@0:     /**
sl@0:      * The destructor, virtual for correct polymorphic invocation.
sl@0:      *
sl@0:      * @internal
sl@0:      */
sl@0:    virtual ~KhmerOpenTypeLayoutEngine();
sl@0: 
sl@0:     /**
sl@0:      * ICU "poor man's RTTI", returns a UClassID for the actual class.
sl@0:      *
sl@0:      * @stable ICU 2.8
sl@0:      */
sl@0:     virtual UClassID getDynamicClassID() const;
sl@0: 
sl@0:     /**
sl@0:      * ICU "poor man's RTTI", returns a UClassID for this class.
sl@0:      *
sl@0:      * @stable ICU 2.8
sl@0:      */
sl@0:     static UClassID getStaticClassID();
sl@0: 
sl@0: protected:
sl@0: 
sl@0:     /**
sl@0:      * This method does Khmer OpenType character processing. It assigns the OpenType feature
sl@0:      * tags to the characters, and may generate output characters which have been reordered. 
sl@0:      * It may also split some vowels, resulting in more output characters than input characters.
sl@0:      *
sl@0:      * Input parameters:
sl@0:      * @param chars - the input character context
sl@0:      * @param offset - the index of the first character to process
sl@0:      * @param count - the number of characters to process
sl@0:      * @param max - the number of characters in the input context
sl@0:      * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
sl@0:      * @param glyphStorage - the glyph storage object. The glyph and character index arrays will be set.
sl@0:      *                       the auxillary data array will be set to the feature tags.
sl@0:      *
sl@0:      * Output parameters:
sl@0:      * @param success - set to an error code if the operation fails
sl@0:      *
sl@0:      * @return the output character count
sl@0:      *
sl@0:      * @internal
sl@0:      */
sl@0:     virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
sl@0:             LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
sl@0: 
sl@0: };
sl@0: 
sl@0: U_NAMESPACE_END
sl@0: #endif
sl@0: