]>
Commit | Line | Data |
---|---|---|
b75a7d8f A |
1 | |
2 | /* | |
b75a7d8f | 3 | * |
374ca955 | 4 | * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved |
b75a7d8f A |
5 | * |
6 | */ | |
7 | ||
8 | #ifndef __THAILAYOUTENGINE_H | |
9 | #define __THAILAYOUTENGINE_H | |
10 | ||
11 | #include "LETypes.h" | |
12 | #include "LEFontInstance.h" | |
13 | #include "LayoutEngine.h" | |
14 | ||
15 | #include "ThaiShaping.h" | |
16 | ||
17 | U_NAMESPACE_BEGIN | |
18 | ||
374ca955 A |
19 | class LEGlyphStorage; |
20 | ||
b75a7d8f A |
21 | /** |
22 | * This class implements layout for the Thai script, using the ThaiShapingClass. | |
23 | * All existing Thai fonts use an encoding which assigns character codes to all | |
24 | * the variant forms needed to display accents and tone marks correctly in context. | |
25 | * This class can deal with fonts using the Microsoft, Macintosh, and WorldType encodings. | |
26 | * | |
27 | * @internal | |
28 | */ | |
29 | class ThaiLayoutEngine : public LayoutEngine | |
30 | { | |
31 | public: | |
32 | /** | |
33 | * This constructs an instance of ThaiLayoutEngine for the given font, script and | |
34 | * language. It examines the font, using LEFontInstance::canDisplay, to set fGlyphSet | |
35 | * and fErrorChar. (see below) | |
36 | * | |
37 | * @param fontInstance - the font | |
38 | * @param scriptCode - the script | |
39 | * @param languageCode - the language | |
40 | * | |
41 | * @see LEFontInstance | |
42 | * @see ScriptAndLanguageTags.h for script and language codes | |
43 | * | |
44 | * @internal | |
45 | */ | |
46 | ThaiLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode); | |
47 | ||
48 | /** | |
49 | * The destructor, virtual for correct polymorphic invocation. | |
50 | * | |
51 | * @internal | |
52 | */ | |
53 | virtual ~ThaiLayoutEngine(); | |
54 | ||
55 | /** | |
56 | * ICU "poor man's RTTI", returns a UClassID for the actual class. | |
57 | * | |
374ca955 | 58 | * @stable ICU 2.8 |
b75a7d8f | 59 | */ |
374ca955 | 60 | virtual UClassID getDynamicClassID() const; |
b75a7d8f A |
61 | |
62 | /** | |
63 | * ICU "poor man's RTTI", returns a UClassID for this class. | |
64 | * | |
374ca955 | 65 | * @stable ICU 2.8 |
b75a7d8f | 66 | */ |
374ca955 | 67 | static UClassID getStaticClassID(); |
b75a7d8f A |
68 | |
69 | protected: | |
70 | /** | |
71 | * A small integer indicating which Thai encoding | |
72 | * the font uses. | |
73 | * | |
74 | * @see ThaiShaping | |
75 | * | |
76 | * @internal | |
77 | */ | |
78 | le_uint8 fGlyphSet; | |
79 | ||
80 | /** | |
81 | * The character used as a base for vowels and | |
82 | * tone marks that are out of sequence. Usually | |
83 | * this will be Unicode 0x25CC, if the font can | |
84 | * display it. | |
85 | * | |
86 | * @see ThaiShaping | |
87 | * | |
88 | * @internal | |
89 | */ | |
90 | LEUnicode fErrorChar; | |
91 | ||
92 | /** | |
93 | * This method performs Thai layout. It calls ThaiShaping::compose to | |
94 | * generate the correct contextual character codes, and then calls | |
95 | * mapCharsToGlyphs to generate the glyph indices. | |
96 | * | |
97 | * Input parameters: | |
98 | * @param chars - the input character context | |
99 | * @param offset - the index of the first character to process | |
100 | * @param count - the number of characters to process | |
101 | * @param max - the number of characters in the input context | |
374ca955 A |
102 | * @param rightToLeft - <code>TRUE</code> if the text is in a right to left directional run |
103 | * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set. | |
b75a7d8f A |
104 | * |
105 | * Output parameters: | |
b75a7d8f A |
106 | * @param success - set to an error code if the operation fails |
107 | * | |
108 | * @return the number of glyphs in the glyph index array | |
109 | * | |
110 | * @see ThaiShaping | |
111 | * | |
112 | * @internal | |
113 | */ | |
114 | virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, | |
374ca955 | 115 | LEGlyphStorage &glyphStorage, LEErrorCode &success); |
b75a7d8f | 116 | |
b75a7d8f A |
117 | }; |
118 | ||
119 | U_NAMESPACE_END | |
120 | #endif | |
121 |