]>
Commit | Line | Data |
---|---|---|
b75a7d8f A |
1 | |
2 | /* | |
b75a7d8f | 3 | * |
b331163b | 4 | * (C) Copyright IBM Corp. 1998-2014 - All Rights Reserved |
b75a7d8f A |
5 | * |
6 | */ | |
7 | ||
8 | #ifndef __INDICLAYOUTENGINE_H | |
9 | #define __INDICLAYOUTENGINE_H | |
10 | ||
11 | #include "LETypes.h" | |
12 | #include "LEFontInstance.h" | |
13 | #include "LEGlyphFilter.h" | |
14 | #include "LayoutEngine.h" | |
15 | #include "OpenTypeLayoutEngine.h" | |
16 | ||
17 | #include "GlyphSubstitutionTables.h" | |
18 | #include "GlyphDefinitionTables.h" | |
19 | #include "GlyphPositioningTables.h" | |
20 | ||
b75a7d8f A |
21 | U_NAMESPACE_BEGIN |
22 | ||
23 | class MPreFixups; | |
374ca955 | 24 | class LEGlyphStorage; |
b75a7d8f A |
25 | |
26 | /** | |
27 | * This class implements OpenType layout for Indic OpenType fonts, as | |
28 | * specified by Microsoft in "Creating and Supporting OpenType Fonts for | |
29 | * Indic Scripts" (http://www.microsoft.com/typography/otspec/indicot/default.htm) | |
30 | * | |
31 | * This class overrides the characterProcessing method to do Indic character processing | |
32 | * and reordering, and the glyphProcessing method to implement post-GSUB processing for | |
33 | * left matras. (See the MS spec. for more details) | |
34 | * | |
35 | * @internal | |
36 | */ | |
37 | class IndicOpenTypeLayoutEngine : public OpenTypeLayoutEngine | |
38 | { | |
39 | public: | |
40 | /** | |
41 | * This is the main constructor. It constructs an instance of IndicOpenTypeLayoutEngine for | |
42 | * a particular font, script and language. It takes the GSUB table as a parameter since | |
43 | * LayoutEngine::layoutEngineFactory has to read the GSUB table to know that it has an | |
44 | * Indic OpenType font. | |
45 | * | |
46 | * @param fontInstance - the font | |
47 | * @param scriptCode - the script | |
48 | * @param langaugeCode - the language | |
49 | * @param gsubTable - the GSUB table | |
729e4ab9 | 50 | * @param success - set to an error code if the operation fails |
b75a7d8f A |
51 | * |
52 | * @see LayoutEngine::layoutEngineFactory | |
53 | * @see OpenTypeLayoutEngine | |
54 | * @see ScriptAndLangaugeTags.h for script and language codes | |
55 | * | |
56 | * @internal | |
57 | */ | |
58 | IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, | |
57a6839d | 59 | le_int32 typoFlags, le_bool version2, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success); |
b75a7d8f A |
60 | |
61 | /** | |
62 | * This constructor is used when the font requires a "canned" GSUB table which can't be known | |
63 | * until after this constructor has been invoked. | |
64 | * | |
65 | * @param fontInstance - the font | |
66 | * @param scriptCode - the script | |
67 | * @param langaugeCode - the language | |
729e4ab9 | 68 | * @param success - set to an error code if the operation fails |
b75a7d8f A |
69 | * |
70 | * @see OpenTypeLayoutEngine | |
71 | * @see ScriptAndLangaugeTags.h for script and language codes | |
72 | * | |
73 | * @internal | |
74 | */ | |
73c04bcf | 75 | IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, |
729e4ab9 | 76 | le_int32 typoFlags, LEErrorCode &success); |
b75a7d8f A |
77 | |
78 | /** | |
79 | * The destructor, virtual for correct polymorphic invocation. | |
80 | * | |
81 | * @internal | |
82 | */ | |
83 | virtual ~IndicOpenTypeLayoutEngine(); | |
84 | ||
85 | /** | |
86 | * ICU "poor man's RTTI", returns a UClassID for the actual class. | |
87 | * | |
b331163b | 88 | * @deprecated ICU 54. See {@link icu::LayoutEngine} |
b75a7d8f | 89 | */ |
374ca955 | 90 | virtual UClassID getDynamicClassID() const; |
b75a7d8f A |
91 | |
92 | /** | |
93 | * ICU "poor man's RTTI", returns a UClassID for this class. | |
94 | * | |
b331163b | 95 | * @deprecated ICU 54. See {@link icu::LayoutEngine} |
b75a7d8f | 96 | */ |
374ca955 | 97 | static UClassID getStaticClassID(); |
b75a7d8f A |
98 | |
99 | protected: | |
100 | ||
101 | /** | |
102 | * This method does Indic OpenType character processing. It assigns the OpenType feature | |
103 | * tags to the characters, and may generate output characters which have been reordered. For | |
104 | * some Indic scripts, it may also split some vowels, resulting in more output characters | |
105 | * than input characters. | |
106 | * | |
107 | * Input parameters: | |
108 | * @param chars - the input character context | |
109 | * @param offset - the index of the first character to process | |
110 | * @param count - the number of characters to process | |
111 | * @param max - the number of characters in the input context | |
374ca955 A |
112 | * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run |
113 | * @param glyphStorage - the glyph storage object. The glyph and character index arrays will be set. | |
114 | * the auxillary data array will be set to the feature tags. | |
b75a7d8f A |
115 | * |
116 | * Output parameters: | |
b75a7d8f A |
117 | * @param success - set to an error code if the operation fails |
118 | * | |
119 | * @return the output character count | |
120 | * | |
121 | * @internal | |
122 | */ | |
123 | virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, | |
374ca955 | 124 | LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success); |
b75a7d8f A |
125 | |
126 | /** | |
127 | * This method does character to glyph mapping, applies the GSUB table and applies | |
128 | * any post GSUB fixups for left matras. It calls OpenTypeLayoutEngine::glyphProcessing | |
129 | * to do the character to glyph mapping, and apply the GSUB table. | |
130 | * | |
131 | * Note that in the case of "canned" GSUB tables, the output glyph indices may be | |
132 | * "fake" glyph indices that need to be converted to "real" glyph indices by the | |
133 | * glyphPostProcessing method. | |
134 | * | |
135 | * Input parameters: | |
136 | * @param chars - the input character context | |
137 | * @param offset - the index of the first character to process | |
138 | * @param count - the number of characters to process | |
139 | * @param max - the number of characters in the input context | |
374ca955 | 140 | * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run |
b75a7d8f | 141 | * @param featureTags - the feature tag array |
374ca955 | 142 | * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set. |
b75a7d8f A |
143 | * |
144 | * Output parameters: | |
b75a7d8f A |
145 | * @param success - set to an error code if the operation fails |
146 | * | |
147 | * @return the number of glyphs in the output glyph index array | |
148 | * | |
149 | * Note: if the character index array was already set by the characterProcessing | |
150 | * method, this method won't change it. | |
151 | * | |
152 | * @internal | |
153 | */ | |
154 | virtual le_int32 glyphProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, | |
374ca955 | 155 | LEGlyphStorage &glyphStorage, LEErrorCode &success); |
b75a7d8f | 156 | |
729e4ab9 A |
157 | le_bool fVersion2; |
158 | ||
b75a7d8f A |
159 | private: |
160 | ||
b75a7d8f | 161 | MPreFixups *fMPreFixups; |
729e4ab9 | 162 | |
b75a7d8f A |
163 | }; |
164 | ||
165 | U_NAMESPACE_END | |
166 | #endif | |
167 |