|
1 |
|
2 /* |
|
3 * |
|
4 * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved |
|
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 |
|
21 U_NAMESPACE_BEGIN |
|
22 |
|
23 class MPreFixups; |
|
24 class LEGlyphStorage; |
|
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 |
|
50 * |
|
51 * @see LayoutEngine::layoutEngineFactory |
|
52 * @see OpenTypeLayoutEngine |
|
53 * @see ScriptAndLangaugeTags.h for script and language codes |
|
54 * |
|
55 * @internal |
|
56 */ |
|
57 IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, |
|
58 le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable); |
|
59 |
|
60 /** |
|
61 * This constructor is used when the font requires a "canned" GSUB table which can't be known |
|
62 * until after this constructor has been invoked. |
|
63 * |
|
64 * @param fontInstance - the font |
|
65 * @param scriptCode - the script |
|
66 * @param langaugeCode - the language |
|
67 * |
|
68 * @see OpenTypeLayoutEngine |
|
69 * @see ScriptAndLangaugeTags.h for script and language codes |
|
70 * |
|
71 * @internal |
|
72 */ |
|
73 IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, |
|
74 le_int32 typoFlags); |
|
75 |
|
76 /** |
|
77 * The destructor, virtual for correct polymorphic invocation. |
|
78 * |
|
79 * @internal |
|
80 */ |
|
81 virtual ~IndicOpenTypeLayoutEngine(); |
|
82 |
|
83 /** |
|
84 * ICU "poor man's RTTI", returns a UClassID for the actual class. |
|
85 * |
|
86 * @stable ICU 2.8 |
|
87 */ |
|
88 virtual UClassID getDynamicClassID() const; |
|
89 |
|
90 /** |
|
91 * ICU "poor man's RTTI", returns a UClassID for this class. |
|
92 * |
|
93 * @stable ICU 2.8 |
|
94 */ |
|
95 static UClassID getStaticClassID(); |
|
96 |
|
97 protected: |
|
98 |
|
99 /** |
|
100 * This method does Indic OpenType character processing. It assigns the OpenType feature |
|
101 * tags to the characters, and may generate output characters which have been reordered. For |
|
102 * some Indic scripts, it may also split some vowels, resulting in more output characters |
|
103 * than input characters. |
|
104 * |
|
105 * Input parameters: |
|
106 * @param chars - the input character context |
|
107 * @param offset - the index of the first character to process |
|
108 * @param count - the number of characters to process |
|
109 * @param max - the number of characters in the input context |
|
110 * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run |
|
111 * @param glyphStorage - the glyph storage object. The glyph and character index arrays will be set. |
|
112 * the auxillary data array will be set to the feature tags. |
|
113 * |
|
114 * Output parameters: |
|
115 * @param success - set to an error code if the operation fails |
|
116 * |
|
117 * @return the output character count |
|
118 * |
|
119 * @internal |
|
120 */ |
|
121 virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, |
|
122 LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success); |
|
123 |
|
124 /** |
|
125 * This method does character to glyph mapping, applies the GSUB table and applies |
|
126 * any post GSUB fixups for left matras. It calls OpenTypeLayoutEngine::glyphProcessing |
|
127 * to do the character to glyph mapping, and apply the GSUB table. |
|
128 * |
|
129 * Note that in the case of "canned" GSUB tables, the output glyph indices may be |
|
130 * "fake" glyph indices that need to be converted to "real" glyph indices by the |
|
131 * glyphPostProcessing method. |
|
132 * |
|
133 * Input parameters: |
|
134 * @param chars - the input character context |
|
135 * @param offset - the index of the first character to process |
|
136 * @param count - the number of characters to process |
|
137 * @param max - the number of characters in the input context |
|
138 * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run |
|
139 * @param featureTags - the feature tag array |
|
140 * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set. |
|
141 * |
|
142 * Output parameters: |
|
143 * @param success - set to an error code if the operation fails |
|
144 * |
|
145 * @return the number of glyphs in the output glyph index array |
|
146 * |
|
147 * Note: if the character index array was already set by the characterProcessing |
|
148 * method, this method won't change it. |
|
149 * |
|
150 * @internal |
|
151 */ |
|
152 virtual le_int32 glyphProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, |
|
153 LEGlyphStorage &glyphStorage, LEErrorCode &success); |
|
154 |
|
155 private: |
|
156 |
|
157 MPreFixups *fMPreFixups; |
|
158 }; |
|
159 |
|
160 U_NAMESPACE_END |
|
161 #endif |
|
162 |