3
* @(#)ArabicLayoutEngine.h 1.3 00/03/15
5
* (C) Copyright IBM Corp. 1998, 1999, 2000, 2001 - All Rights Reserved
9
#ifndef __ARABICLAYOUTENGINE_H
10
#define __ARABICLAYOUTENGINE_H
13
#include "LEFontInstance.h"
14
#include "LEGlyphFilter.h"
15
#include "LayoutEngine.h"
16
#include "OpenTypeLayoutEngine.h"
18
#include "GlyphSubstitutionTables.h"
19
#include "GlyphDefinitionTables.h"
20
#include "GlyphPositioningTables.h"
25
* This class implements OpenType layout for Arabic fonts. It overrides
26
* the characerProcessing method to assign the correct OpenType feature
27
* tags for the Arabic contextual forms. It also overrides the adjustGlyphPositions
28
* method to guarantee that all vowel and accent glyphs have zero advance width.
30
class ArabicOpenTypeLayoutEngine : public OpenTypeLayoutEngine
34
* This is the main constructor. It constructs an instance of ArabicOpenTypeLayoutEngine for
35
* a particular font, script and language. It takes the GSUB table as a parameter since
36
* LayoutEngine::layoutEngineFactory has to read the GSUB table to know that it has an
37
* Indic OpenType font.
39
* @param fontInstance - the font
40
* @param scriptCode - the script
41
* @param langaugeCode - the language
42
* @param gsubTable - the GSUB table
44
* @see LayoutEngine::layoutEngineFactory
45
* @see OpenTypeLayoutEngine
46
* @see ScriptAndLangaugeTags.h for script and language codes
48
ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
49
const GlyphSubstitutionTableHeader *gsubTable);
52
* This constructor is used when the font requires a "canned" GSUB table which can't be known
53
* until after this constructor has been invoked.
55
* @param fontInstance - the font
56
* @param scriptCode - the script
57
* @param langaugeCode - the language
59
* @see OpenTypeLayoutEngine
60
* @see ScriptAndLangaugeTags.h for script and language codes
62
ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode);
65
* The destructor, virtual for correct polymorphic invocation.
67
virtual ~ArabicOpenTypeLayoutEngine();
72
* This method does Arabic OpenType character processing. It assigns the OpenType feature
73
* tags to the characters to generate the correct contextual forms and ligatures.
76
* @param chars - the input character context
77
* @param offset - the index of the first character to process
78
* @param count - the number of characters to process
79
* @param max - the number of characters in the input context
80
* @param rightToLeft - true if the characters are in a right to left directional run
83
* @param outChars - the output character arrayt
84
* @param charIndices - the output character index array
85
* @param featureTags - the output feature tag array
86
* @param success - set to an error code if the operation fails
88
* @return the output character count
90
virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
91
LEUnicode *&outChars, le_int32 *&charIndices, const LETag **&featureTags, LEErrorCode &success);
94
* This method applies the GPOS table if it is present, otherwise it ensures that all vowel
95
* and accent glyphs have a zero advance width by calling the adjustMarkGlyphs method.
96
* If the font contains a GDEF table, that is used to identify voewls and accents. Otherwise
97
* the character codes are used.
99
* @param chars - the input character context
100
* @param offset - the offset of the first character to process
101
* @param count - the number of characters to process
102
* @param reverse - true if the glyphs in the glyph array have been reordered
103
* @param glyphs - the input glyph array
104
* @param glyphCount - the number of glyphs
105
* @param positions - the position array, will be updated as needed
106
* @param success - output parameter set to an error code if the operation fails
108
virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphID glyphs[], le_int32 glyphCount, float positions[], LEErrorCode &success);
112
* The class implements OpenType layout for Arabic fonts which don't
113
* contain a GSUB table, using a canned GSUB table based on Unicode
114
* Arabic Presentation Forms. It overrides the mapCharsToGlyphs method
115
* to use the Presentation Forms as logical glyph indices. It overrides the
116
* glyphPostProcessing method to convert the Presentation Forms to actual
119
* @see ArabicOpenTypeLayoutEngine
121
class UnicodeArabicOpenTypeLayoutEngine : public ArabicOpenTypeLayoutEngine
125
* This constructs an instance of UnicodeArabicOpenTypeLayoutEngine for a specific font,
126
* script and language.
128
* @param fontInstance - the font
129
* @param scriptCode - the script
130
* @param languageCode - the language
132
* @see LEFontInstance
133
* @see ScriptAndLanguageTags.h for script and language codes
135
UnicodeArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode);
138
* The destructor, virtual for correct polymorphic invocation.
140
virtual ~UnicodeArabicOpenTypeLayoutEngine();
145
* This method converts the Arabic Presentation Forms in the temp glyph array
146
* into actual glyph indices using ArabicOpenTypeLayoutEngine::mapCharsToGlyps.
149
* @param tempGlyphs - the input presentation forms
150
* @param tempCharIndices - the input character index array
151
* @param tempGlyphCount - the number of Presentation Froms
154
* @param glyphs - the output glyph index array
155
* @param charIndices - the output character index array
156
* @param success - set to an error code if the operation fails
158
* @return the number of glyph indices in the output glyph index array
160
virtual le_int32 glyphPostProcessing(LEGlyphID tempGlyphs[], le_int32 tempCharIndices[], le_int32 tempGlyphCount,
161
LEGlyphID *&glyphs, le_int32 *&charIndices, LEErrorCode &success);
164
* This method copies the input characters into the output glyph index array,
165
* for use by the canned GSUB table. It also generates the character index array.
168
* @param chars - the input character context
169
* @param offset - the offset of the first character to be mapped
170
* @param count - the number of characters to be mapped
171
* @param reverse - if true, the output will be in reverse order
172
* @param mirror - if true, do character mirroring
175
* @param glyphs - the glyph array
176
* @param charIndices - the character index array
177
* @param success - set to an error code if the operation fails
179
virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror,
180
LEGlyphID *&glyphs, le_int32 *&charIndices, LEErrorCode &success);
183
* This method ensures that all vowel and accent glyphs have a zero advance width by calling
184
* the adjustMarkGlyphs method. The character codes are used to identify the vowel and mark
187
* @param chars - the input character context
188
* @param offset - the offset of the first character to process
189
* @param count - the number of characters to process
190
* @param reverse - true if the glyphs in the glyph array have been reordered
191
* @param glyphs - the input glyph array
192
* @param glyphCount - the number of glyphs
193
* @param positions - the position array, will be updated as needed
194
* @param success - output parameter set to an error code if the operation fails
196
virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphID glyphs[], le_int32 glyphCount, float positions[], LEErrorCode &success);