1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/fontservices/textshaperplugin/IcuSource/layout/ThaiLayoutEngine.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,121 @@
1.4 +
1.5 +/*
1.6 + *
1.7 + * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
1.8 + *
1.9 + */
1.10 +
1.11 +#ifndef __THAILAYOUTENGINE_H
1.12 +#define __THAILAYOUTENGINE_H
1.13 +
1.14 +#include "LETypes.h"
1.15 +#include "LEFontInstance.h"
1.16 +#include "LayoutEngine.h"
1.17 +
1.18 +#include "ThaiShaping.h"
1.19 +
1.20 +U_NAMESPACE_BEGIN
1.21 +
1.22 +class LEGlyphStorage;
1.23 +
1.24 +/**
1.25 + * This class implements layout for the Thai script, using the ThaiShapingClass.
1.26 + * All existing Thai fonts use an encoding which assigns character codes to all
1.27 + * the variant forms needed to display accents and tone marks correctly in context.
1.28 + * This class can deal with fonts using the Microsoft, Macintosh, and WorldType encodings.
1.29 + *
1.30 + * @internal
1.31 + */
1.32 +class ThaiLayoutEngine : public LayoutEngine
1.33 +{
1.34 +public:
1.35 + /**
1.36 + * This constructs an instance of ThaiLayoutEngine for the given font, script and
1.37 + * language. It examines the font, using LEFontInstance::canDisplay, to set fGlyphSet
1.38 + * and fErrorChar. (see below)
1.39 + *
1.40 + * @param fontInstance - the font
1.41 + * @param scriptCode - the script
1.42 + * @param languageCode - the language
1.43 + *
1.44 + * @see LEFontInstance
1.45 + * @see ScriptAndLanguageTags.h for script and language codes
1.46 + *
1.47 + * @internal
1.48 + */
1.49 + ThaiLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags);
1.50 +
1.51 + /**
1.52 + * The destructor, virtual for correct polymorphic invocation.
1.53 + *
1.54 + * @internal
1.55 + */
1.56 + virtual ~ThaiLayoutEngine();
1.57 +
1.58 + /**
1.59 + * ICU "poor man's RTTI", returns a UClassID for the actual class.
1.60 + *
1.61 + * @stable ICU 2.8
1.62 + */
1.63 + virtual UClassID getDynamicClassID() const;
1.64 +
1.65 + /**
1.66 + * ICU "poor man's RTTI", returns a UClassID for this class.
1.67 + *
1.68 + * @stable ICU 2.8
1.69 + */
1.70 + static UClassID getStaticClassID();
1.71 +
1.72 +protected:
1.73 + /**
1.74 + * A small integer indicating which Thai encoding
1.75 + * the font uses.
1.76 + *
1.77 + * @see ThaiShaping
1.78 + *
1.79 + * @internal
1.80 + */
1.81 + le_uint8 fGlyphSet;
1.82 +
1.83 + /**
1.84 + * The character used as a base for vowels and
1.85 + * tone marks that are out of sequence. Usually
1.86 + * this will be Unicode 0x25CC, if the font can
1.87 + * display it.
1.88 + *
1.89 + * @see ThaiShaping
1.90 + *
1.91 + * @internal
1.92 + */
1.93 + LEUnicode fErrorChar;
1.94 +
1.95 + /**
1.96 + * This method performs Thai layout. It calls ThaiShaping::compose to
1.97 + * generate the correct contextual character codes, and then calls
1.98 + * mapCharsToGlyphs to generate the glyph indices.
1.99 + *
1.100 + * Input parameters:
1.101 + * @param chars - the input character context
1.102 + * @param offset - the index of the first character to process
1.103 + * @param count - the number of characters to process
1.104 + * @param max - the number of characters in the input context
1.105 + * @param rightToLeft - <code>TRUE</code> if the text is in a right to left directional run
1.106 + * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set.
1.107 + *
1.108 + * Output parameters:
1.109 + * @param success - set to an error code if the operation fails
1.110 + *
1.111 + * @return the number of glyphs in the glyph index array
1.112 + *
1.113 + * @see ThaiShaping
1.114 + *
1.115 + * @internal
1.116 + */
1.117 + virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
1.118 + LEGlyphStorage &glyphStorage, LEErrorCode &success);
1.119 +
1.120 +};
1.121 +
1.122 +U_NAMESPACE_END
1.123 +#endif
1.124 +