Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.h
38918 views
1
/*
2
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3
*
4
* This code is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 2 only, as
6
* published by the Free Software Foundation. Oracle designates this
7
* particular file as subject to the "Classpath" exception as provided
8
* by Oracle in the LICENSE file that accompanied this code.
9
*
10
* This code is distributed in the hope that it will be useful, but WITHOUT
11
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13
* version 2 for more details (a copy is included in the LICENSE file that
14
* accompanied this code).
15
*
16
* You should have received a copy of the GNU General Public License version
17
* 2 along with this work; if not, write to the Free Software Foundation,
18
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19
*
20
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21
* or visit www.oracle.com if you need additional information or have any
22
* questions.
23
*
24
*/
25
26
27
/*
28
*
29
* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
30
*
31
*/
32
33
#ifndef __ARABICLAYOUTENGINE_H
34
#define __ARABICLAYOUTENGINE_H
35
36
#include "LETypes.h"
37
#include "LEFontInstance.h"
38
#include "LEGlyphFilter.h"
39
#include "LayoutEngine.h"
40
#include "OpenTypeLayoutEngine.h"
41
42
#include "GlyphSubstitutionTables.h"
43
#include "GlyphDefinitionTables.h"
44
#include "GlyphPositioningTables.h"
45
46
U_NAMESPACE_BEGIN
47
48
/**
49
* This class implements OpenType layout for Arabic fonts. It overrides
50
* the characerProcessing method to assign the correct OpenType feature
51
* tags for the Arabic contextual forms. It also overrides the adjustGlyphPositions
52
* method to guarantee that all vowel and accent glyphs have zero advance width.
53
*
54
* @internal
55
*/
56
class ArabicOpenTypeLayoutEngine : public OpenTypeLayoutEngine
57
{
58
public:
59
/**
60
* This is the main constructor. It constructs an instance of ArabicOpenTypeLayoutEngine for
61
* a particular font, script and language. It takes the GSUB table as a parameter since
62
* LayoutEngine::layoutEngineFactory has to read the GSUB table to know that it has an
63
* Indic OpenType font.
64
*
65
* @param fontInstance - the font
66
* @param scriptCode - the script
67
* @param langaugeCode - the language
68
* @param gsubTable - the GSUB table
69
* @param success - set to an error code if the operation fails
70
*
71
* @see LayoutEngine::layoutEngineFactory
72
* @see OpenTypeLayoutEngine
73
* @see ScriptAndLanguageTags.h for script and language codes
74
*
75
* @internal
76
*/
77
ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
78
le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success);
79
80
/**
81
* This constructor is used when the font requires a "canned" GSUB table which can't be known
82
* until after this constructor has been invoked.
83
*
84
* @param fontInstance - the font
85
* @param scriptCode - the script
86
* @param langaugeCode - the language
87
* @param success - set to an error code if the operation fails
88
*
89
* @see OpenTypeLayoutEngine
90
* @see ScriptAndLanguageTags.h for script and language codes
91
*
92
* @internal
93
*/
94
ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
95
le_int32 typoFlags, LEErrorCode &success);
96
97
/**
98
* The destructor, virtual for correct polymorphic invocation.
99
*
100
* @internal
101
*/
102
virtual ~ArabicOpenTypeLayoutEngine();
103
104
/**
105
* ICU "poor man's RTTI", returns a UClassID for the actual class.
106
*
107
* @stable ICU 2.8
108
*/
109
virtual UClassID getDynamicClassID() const;
110
111
/**
112
* ICU "poor man's RTTI", returns a UClassID for this class.
113
*
114
* @stable ICU 2.8
115
*/
116
static UClassID getStaticClassID();
117
118
protected:
119
120
/**
121
* This method does Arabic OpenType character processing. It assigns the OpenType feature
122
* tags to the characters to generate the correct contextual forms and ligatures.
123
*
124
* Input parameters:
125
* @param chars - the input character context
126
* @param offset - the index of the first character to process
127
* @param count - the number of characters to process
128
* @param max - the number of characters in the input context
129
* @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
130
*
131
* Output parameters:
132
* @param outChars - the output character arrayt
133
* @param charIndices - the output character index array
134
* @param featureTags - the output feature tag array
135
* @param success - set to an error code if the operation fails
136
*
137
* @return the output character count
138
*
139
* @internal
140
*/
141
virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
142
LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
143
144
/**
145
* This method applies the GPOS table if it is present, otherwise it ensures that all vowel
146
* and accent glyphs have a zero advance width by calling the adjustMarkGlyphs method.
147
* If the font contains a GDEF table, that is used to identify voewls and accents. Otherwise
148
* the character codes are used.
149
*
150
* @param chars - the input character context
151
* @param offset - the offset of the first character to process
152
* @param count - the number of characters to process
153
* @param reverse - <code>TRUE</code> if the glyphs in the glyph array have been reordered
154
* @param glyphs - the input glyph array
155
* @param glyphCount - the number of glyphs
156
* @param positions - the position array, will be updated as needed
157
* @param success - output parameter set to an error code if the operation fails
158
*
159
* @internal
160
*/
161
virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
162
163
// static void adjustMarkGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success);
164
165
};
166
167
/**
168
* The class implements OpenType layout for Arabic fonts which don't
169
* contain a GSUB table, using a canned GSUB table based on Unicode
170
* Arabic Presentation Forms. It overrides the mapCharsToGlyphs method
171
* to use the Presentation Forms as logical glyph indices. It overrides the
172
* glyphPostProcessing method to convert the Presentation Forms to actual
173
* glyph indices.
174
*
175
* @see ArabicOpenTypeLayoutEngine
176
*
177
* @internal
178
*/
179
class UnicodeArabicOpenTypeLayoutEngine : public ArabicOpenTypeLayoutEngine
180
{
181
public:
182
/**
183
* This constructs an instance of UnicodeArabicOpenTypeLayoutEngine for a specific font,
184
* script and language.
185
*
186
* @param fontInstance - the font
187
* @param scriptCode - the script
188
* @param languageCode - the language
189
* @param success - set to an error code if the operation fails
190
*
191
* @see LEFontInstance
192
* @see ScriptAndLanguageTags.h for script and language codes
193
*
194
* @internal
195
*/
196
UnicodeArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
197
le_int32 typoFlags, LEErrorCode &success);
198
199
/**
200
* The destructor, virtual for correct polymorphic invocation.
201
*
202
* @internal
203
*/
204
virtual ~UnicodeArabicOpenTypeLayoutEngine();
205
206
protected:
207
208
/**
209
* This method converts the Arabic Presentation Forms in the temp glyph array
210
* into actual glyph indices using ArabicOpenTypeLayoutEngine::mapCharsToGlyps.
211
*
212
* Input parameters:
213
* @param tempGlyphs - the input presentation forms
214
* @param tempCharIndices - the input character index array
215
* @param tempGlyphCount - the number of Presentation Froms
216
*
217
* Output parameters:
218
* @param glyphs - the output glyph index array
219
* @param charIndices - the output character index array
220
* @param success - set to an error code if the operation fails
221
*
222
* @return the number of glyph indices in the output glyph index array
223
*
224
* @internal
225
*/
226
virtual le_int32 glyphPostProcessing(LEGlyphStorage &tempGlyphStorage, LEGlyphStorage &glyphStorage, LEErrorCode &success);
227
228
/**
229
* This method copies the input characters into the output glyph index array,
230
* for use by the canned GSUB table. It also generates the character index array.
231
*
232
* Input parameters:
233
* @param chars - the input character context
234
* @param offset - the offset of the first character to be mapped
235
* @param count - the number of characters to be mapped
236
* @param reverse - if <code>TRUE</code>, the output will be in reverse order
237
* @param mirror - if <code>TRUE</code>, do character mirroring
238
* @param glyphStorage - the glyph storage object. Glyph and char index arrays will be updated.
239
*
240
* @param success - set to an error code if the operation fails
241
*
242
* @internal
243
*/
244
virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror,
245
LEGlyphStorage &glyphStorage, LEErrorCode &success);
246
247
/**
248
* This method ensures that all vowel and accent glyphs have a zero advance width by calling
249
* the adjustMarkGlyphs method. The character codes are used to identify the vowel and mark
250
* glyphs.
251
*
252
* @param chars - the input character context
253
* @param offset - the offset of the first character to process
254
* @param count - the number of characters to process
255
* @param reverse - <code>TRUE</code> if the glyphs in the glyph array have been reordered
256
* @param glyphStorage - the glyph storage object. The glyph positions will be updated as needed.
257
* @param success - output parameter set to an error code if the operation fails
258
*
259
* @internal
260
*/
261
virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
262
};
263
264
U_NAMESPACE_END
265
#endif
266
267
268