~ubuntu-branches/ubuntu/gutsy/icu/gutsy

« back to all changes in this revision

Viewing changes to source/layout/ArabicLayoutEngine.h

  • Committer: Package Import Robot
  • Author(s): Jay Berkenbilt
  • Date: 2005-11-19 11:29:31 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20051119112931-vcizkrp10tli4enw
Tags: 3.4-3
Explicitly build with g++ 3.4.  The current ICU fails its test suite
with 4.0 but not with 3.4.  Future versions should work properly with
4.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
/*
3
 
 * @(#)ArabicLayoutEngine.h     1.3 00/03/15
4
 
 *
5
 
 * (C) Copyright IBM Corp. 1998, 1999, 2000, 2001 - All Rights Reserved
6
 
 *
7
 
 */
8
 
 
9
 
#ifndef __ARABICLAYOUTENGINE_H
10
 
#define __ARABICLAYOUTENGINE_H
11
 
 
12
 
#include "LETypes.h"
13
 
#include "LEFontInstance.h"
14
 
#include "LEGlyphFilter.h"
15
 
#include "LayoutEngine.h"
16
 
#include "OpenTypeLayoutEngine.h"
17
 
 
18
 
#include "GlyphSubstitutionTables.h"
19
 
#include "GlyphDefinitionTables.h"
20
 
#include "GlyphPositioningTables.h"
21
 
 
22
 
U_NAMESPACE_BEGIN
23
 
 
24
 
/**
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.
29
 
 */
30
 
class ArabicOpenTypeLayoutEngine : public OpenTypeLayoutEngine
31
 
{
32
 
public:
33
 
    /**
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.
38
 
     *
39
 
     * @param fontInstance - the font
40
 
     * @param scriptCode - the script
41
 
     * @param langaugeCode - the language
42
 
     * @param gsubTable - the GSUB table
43
 
     *
44
 
     * @see LayoutEngine::layoutEngineFactory
45
 
     * @see OpenTypeLayoutEngine
46
 
     * @see ScriptAndLangaugeTags.h for script and language codes
47
 
     */
48
 
    ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
49
 
                            const GlyphSubstitutionTableHeader *gsubTable);
50
 
 
51
 
    /**
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.
54
 
     *
55
 
     * @param fontInstance - the font
56
 
     * @param scriptCode - the script
57
 
     * @param langaugeCode - the language
58
 
     *
59
 
     * @see OpenTypeLayoutEngine
60
 
     * @see ScriptAndLangaugeTags.h for script and language codes
61
 
     */
62
 
    ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode);
63
 
 
64
 
    /**
65
 
     * The destructor, virtual for correct polymorphic invocation.
66
 
     */
67
 
    virtual ~ArabicOpenTypeLayoutEngine();
68
 
 
69
 
protected:
70
 
 
71
 
    /**
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.
74
 
     *
75
 
     * Input parameters:
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
81
 
     *
82
 
     * Output parameters:
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
87
 
     *
88
 
     * @return the output character count
89
 
     */
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);
92
 
 
93
 
    /**
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.
98
 
     *
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
107
 
     */
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);
109
 
};
110
 
 
111
 
/**
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
117
 
 * glyph indices.
118
 
 *
119
 
 * @see ArabicOpenTypeLayoutEngine
120
 
 */
121
 
class UnicodeArabicOpenTypeLayoutEngine : public ArabicOpenTypeLayoutEngine
122
 
{
123
 
public:
124
 
    /**
125
 
     * This constructs an instance of UnicodeArabicOpenTypeLayoutEngine for a specific font,
126
 
     * script and language.
127
 
     *
128
 
     * @param fontInstance - the font
129
 
     * @param scriptCode - the script
130
 
     * @param languageCode - the language
131
 
     *
132
 
     * @see LEFontInstance
133
 
     * @see ScriptAndLanguageTags.h for script and language codes
134
 
     */
135
 
    UnicodeArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode);
136
 
 
137
 
    /**
138
 
     * The destructor, virtual for correct polymorphic invocation.
139
 
     */
140
 
    virtual ~UnicodeArabicOpenTypeLayoutEngine();
141
 
 
142
 
protected:
143
 
 
144
 
    /**
145
 
     * This method converts the Arabic Presentation Forms in the temp glyph array
146
 
     * into actual glyph indices using ArabicOpenTypeLayoutEngine::mapCharsToGlyps.
147
 
     *
148
 
     * Input paramters:
149
 
     * @param tempGlyphs - the input presentation forms
150
 
     * @param tempCharIndices - the input character index array
151
 
     * @param tempGlyphCount - the number of Presentation Froms
152
 
     *
153
 
     * Output parameters:
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
157
 
     *
158
 
     * @return the number of glyph indices in the output glyph index array
159
 
     */
160
 
    virtual le_int32 glyphPostProcessing(LEGlyphID tempGlyphs[], le_int32 tempCharIndices[], le_int32 tempGlyphCount,
161
 
                    LEGlyphID *&glyphs, le_int32 *&charIndices, LEErrorCode &success);
162
 
 
163
 
    /**
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.
166
 
     *
167
 
     * Input parameters:
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
173
 
     *
174
 
     * Output parameters:
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
178
 
     */
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);
181
 
 
182
 
    /**
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
185
 
     * glyphs.
186
 
     *
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
195
 
     */
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);
197
 
};
198
 
 
199
 
U_NAMESPACE_END
200
 
#endif
201