sl@0: sl@0: /* sl@0: * sl@0: * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved sl@0: * sl@0: */ sl@0: sl@0: #ifndef __THAILAYOUTENGINE_H sl@0: #define __THAILAYOUTENGINE_H sl@0: sl@0: #include "LETypes.h" sl@0: #include "LEFontInstance.h" sl@0: #include "LayoutEngine.h" sl@0: sl@0: #include "ThaiShaping.h" sl@0: sl@0: U_NAMESPACE_BEGIN sl@0: sl@0: class LEGlyphStorage; sl@0: sl@0: /** sl@0: * This class implements layout for the Thai script, using the ThaiShapingClass. sl@0: * All existing Thai fonts use an encoding which assigns character codes to all sl@0: * the variant forms needed to display accents and tone marks correctly in context. sl@0: * This class can deal with fonts using the Microsoft, Macintosh, and WorldType encodings. sl@0: * sl@0: * @internal sl@0: */ sl@0: class ThaiLayoutEngine : public LayoutEngine sl@0: { sl@0: public: sl@0: /** sl@0: * This constructs an instance of ThaiLayoutEngine for the given font, script and sl@0: * language. It examines the font, using LEFontInstance::canDisplay, to set fGlyphSet sl@0: * and fErrorChar. (see below) sl@0: * sl@0: * @param fontInstance - the font sl@0: * @param scriptCode - the script sl@0: * @param languageCode - the language sl@0: * sl@0: * @see LEFontInstance sl@0: * @see ScriptAndLanguageTags.h for script and language codes sl@0: * sl@0: * @internal sl@0: */ sl@0: ThaiLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, 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 ~ThaiLayoutEngine(); 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: * A small integer indicating which Thai encoding sl@0: * the font uses. sl@0: * sl@0: * @see ThaiShaping sl@0: * sl@0: * @internal sl@0: */ sl@0: le_uint8 fGlyphSet; sl@0: sl@0: /** sl@0: * The character used as a base for vowels and sl@0: * tone marks that are out of sequence. Usually sl@0: * this will be Unicode 0x25CC, if the font can sl@0: * display it. sl@0: * sl@0: * @see ThaiShaping sl@0: * sl@0: * @internal sl@0: */ sl@0: LEUnicode fErrorChar; sl@0: sl@0: /** sl@0: * This method performs Thai layout. It calls ThaiShaping::compose to sl@0: * generate the correct contextual character codes, and then calls sl@0: * mapCharsToGlyphs to generate the glyph indices. 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 - TRUE if the text is in a right to left directional run sl@0: * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set. 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 number of glyphs in the glyph index array sl@0: * sl@0: * @see ThaiShaping sl@0: * sl@0: * @internal sl@0: */ sl@0: virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, sl@0: LEGlyphStorage &glyphStorage, LEErrorCode &success); sl@0: sl@0: }; sl@0: sl@0: U_NAMESPACE_END sl@0: #endif sl@0: