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