xref: /aosp_15_r20/external/icu/libandroidicu/include/unicode/ushape.h (revision 0e209d3975ff4a8c132096b14b0e9364a753506e)
1*0e209d39SAndroid Build Coastguard Worker // © 2016 and later: Unicode, Inc. and others.
2*0e209d39SAndroid Build Coastguard Worker // License & terms of use: http://www.unicode.org/copyright.html
3*0e209d39SAndroid Build Coastguard Worker /*
4*0e209d39SAndroid Build Coastguard Worker ******************************************************************************
5*0e209d39SAndroid Build Coastguard Worker *
6*0e209d39SAndroid Build Coastguard Worker *   Copyright (C) 2000-2012, International Business Machines
7*0e209d39SAndroid Build Coastguard Worker *   Corporation and others.  All Rights Reserved.
8*0e209d39SAndroid Build Coastguard Worker *
9*0e209d39SAndroid Build Coastguard Worker ******************************************************************************
10*0e209d39SAndroid Build Coastguard Worker *   file name:  ushape.h
11*0e209d39SAndroid Build Coastguard Worker *   encoding:   UTF-8
12*0e209d39SAndroid Build Coastguard Worker *   tab size:   8 (not used)
13*0e209d39SAndroid Build Coastguard Worker *   indentation:4
14*0e209d39SAndroid Build Coastguard Worker *
15*0e209d39SAndroid Build Coastguard Worker *   created on: 2000jun29
16*0e209d39SAndroid Build Coastguard Worker *   created by: Markus W. Scherer
17*0e209d39SAndroid Build Coastguard Worker */
18*0e209d39SAndroid Build Coastguard Worker 
19*0e209d39SAndroid Build Coastguard Worker #ifndef __USHAPE_H__
20*0e209d39SAndroid Build Coastguard Worker #define __USHAPE_H__
21*0e209d39SAndroid Build Coastguard Worker 
22*0e209d39SAndroid Build Coastguard Worker #include "unicode/utypes.h"
23*0e209d39SAndroid Build Coastguard Worker 
24*0e209d39SAndroid Build Coastguard Worker /**
25*0e209d39SAndroid Build Coastguard Worker  * \file
26*0e209d39SAndroid Build Coastguard Worker  * \brief C API:  Arabic shaping
27*0e209d39SAndroid Build Coastguard Worker  *
28*0e209d39SAndroid Build Coastguard Worker  */
29*0e209d39SAndroid Build Coastguard Worker 
30*0e209d39SAndroid Build Coastguard Worker /**
31*0e209d39SAndroid Build Coastguard Worker  * Shape Arabic text on a character basis.
32*0e209d39SAndroid Build Coastguard Worker  *
33*0e209d39SAndroid Build Coastguard Worker  * <p>This function performs basic operations for "shaping" Arabic text. It is most
34*0e209d39SAndroid Build Coastguard Worker  * useful for use with legacy data formats and legacy display technology
35*0e209d39SAndroid Build Coastguard Worker  * (simple terminals). All operations are performed on Unicode characters.</p>
36*0e209d39SAndroid Build Coastguard Worker  *
37*0e209d39SAndroid Build Coastguard Worker  * <p>Text-based shaping means that some character code points in the text are
38*0e209d39SAndroid Build Coastguard Worker  * replaced by others depending on the context. It transforms one kind of text
39*0e209d39SAndroid Build Coastguard Worker  * into another. In comparison, modern displays for Arabic text select
40*0e209d39SAndroid Build Coastguard Worker  * appropriate, context-dependent font glyphs for each text element, which means
41*0e209d39SAndroid Build Coastguard Worker  * that they transform text into a glyph vector.</p>
42*0e209d39SAndroid Build Coastguard Worker  *
43*0e209d39SAndroid Build Coastguard Worker  * <p>Text transformations are necessary when modern display technology is not
44*0e209d39SAndroid Build Coastguard Worker  * available or when text needs to be transformed to or from legacy formats that
45*0e209d39SAndroid Build Coastguard Worker  * use "shaped" characters. Since the Arabic script is cursive, connecting
46*0e209d39SAndroid Build Coastguard Worker  * adjacent letters to each other, computers select images for each letter based
47*0e209d39SAndroid Build Coastguard Worker  * on the surrounding letters. This usually results in four images per Arabic
48*0e209d39SAndroid Build Coastguard Worker  * letter: initial, middle, final, and isolated forms. In Unicode, on the other
49*0e209d39SAndroid Build Coastguard Worker  * hand, letters are normally stored abstract, and a display system is expected
50*0e209d39SAndroid Build Coastguard Worker  * to select the necessary glyphs. (This makes searching and other text
51*0e209d39SAndroid Build Coastguard Worker  * processing easier because the same letter has only one code.) It is possible
52*0e209d39SAndroid Build Coastguard Worker  * to mimic this with text transformations because there are characters in
53*0e209d39SAndroid Build Coastguard Worker  * Unicode that are rendered as letters with a specific shape
54*0e209d39SAndroid Build Coastguard Worker  * (or cursive connectivity). They were included for interoperability with
55*0e209d39SAndroid Build Coastguard Worker  * legacy systems and codepages, and for unsophisticated display systems.</p>
56*0e209d39SAndroid Build Coastguard Worker  *
57*0e209d39SAndroid Build Coastguard Worker  * <p>A second kind of text transformations is supported for Arabic digits:
58*0e209d39SAndroid Build Coastguard Worker  * For compatibility with legacy codepages that only include European digits,
59*0e209d39SAndroid Build Coastguard Worker  * it is possible to replace one set of digits by another, changing the
60*0e209d39SAndroid Build Coastguard Worker  * character code points. These operations can be performed for either
61*0e209d39SAndroid Build Coastguard Worker  * Arabic-Indic Digits (U+0660...U+0669) or Eastern (Extended) Arabic-Indic
62*0e209d39SAndroid Build Coastguard Worker  * digits (U+06f0...U+06f9).</p>
63*0e209d39SAndroid Build Coastguard Worker  *
64*0e209d39SAndroid Build Coastguard Worker  * <p>Some replacements may result in more or fewer characters (code points).
65*0e209d39SAndroid Build Coastguard Worker  * By default, this means that the destination buffer may receive text with a
66*0e209d39SAndroid Build Coastguard Worker  * length different from the source length. Some legacy systems rely on the
67*0e209d39SAndroid Build Coastguard Worker  * length of the text to be constant. They expect extra spaces to be added
68*0e209d39SAndroid Build Coastguard Worker  * or consumed either next to the affected character or at the end of the
69*0e209d39SAndroid Build Coastguard Worker  * text.</p>
70*0e209d39SAndroid Build Coastguard Worker  *
71*0e209d39SAndroid Build Coastguard Worker  * <p>For details about the available operations, see the description of the
72*0e209d39SAndroid Build Coastguard Worker  * <code>U_SHAPE_...</code> options.</p>
73*0e209d39SAndroid Build Coastguard Worker  *
74*0e209d39SAndroid Build Coastguard Worker  * @param source The input text.
75*0e209d39SAndroid Build Coastguard Worker  *
76*0e209d39SAndroid Build Coastguard Worker  * @param sourceLength The number of UChars in <code>source</code>.
77*0e209d39SAndroid Build Coastguard Worker  *
78*0e209d39SAndroid Build Coastguard Worker  * @param dest The destination buffer that will receive the results of the
79*0e209d39SAndroid Build Coastguard Worker  *             requested operations. It may be <code>NULL</code> only if
80*0e209d39SAndroid Build Coastguard Worker  *             <code>destSize</code> is 0. The source and destination must not
81*0e209d39SAndroid Build Coastguard Worker  *             overlap.
82*0e209d39SAndroid Build Coastguard Worker  *
83*0e209d39SAndroid Build Coastguard Worker  * @param destSize The size (capacity) of the destination buffer in UChars.
84*0e209d39SAndroid Build Coastguard Worker  *                 If <code>destSize</code> is 0, then no output is produced,
85*0e209d39SAndroid Build Coastguard Worker  *                 but the necessary buffer size is returned ("preflighting").
86*0e209d39SAndroid Build Coastguard Worker  *
87*0e209d39SAndroid Build Coastguard Worker  * @param options This is a 32-bit set of flags that specify the operations
88*0e209d39SAndroid Build Coastguard Worker  *                that are performed on the input text. If no error occurs,
89*0e209d39SAndroid Build Coastguard Worker  *                then the result will always be written to the destination
90*0e209d39SAndroid Build Coastguard Worker  *                buffer.
91*0e209d39SAndroid Build Coastguard Worker  *
92*0e209d39SAndroid Build Coastguard Worker  * @param pErrorCode must be a valid pointer to an error code value,
93*0e209d39SAndroid Build Coastguard Worker  *        which must not indicate a failure before the function call.
94*0e209d39SAndroid Build Coastguard Worker  *
95*0e209d39SAndroid Build Coastguard Worker  * @return The number of UChars written to the destination buffer.
96*0e209d39SAndroid Build Coastguard Worker  *         If an error occurred, then no output was written, or it may be
97*0e209d39SAndroid Build Coastguard Worker  *         incomplete. If <code>U_BUFFER_OVERFLOW_ERROR</code> is set, then
98*0e209d39SAndroid Build Coastguard Worker  *         the return value indicates the necessary destination buffer size.
99*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
100*0e209d39SAndroid Build Coastguard Worker  */
101*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
102*0e209d39SAndroid Build Coastguard Worker u_shapeArabic(const UChar *source, int32_t sourceLength,
103*0e209d39SAndroid Build Coastguard Worker               UChar *dest, int32_t destSize,
104*0e209d39SAndroid Build Coastguard Worker               uint32_t options,
105*0e209d39SAndroid Build Coastguard Worker               UErrorCode *pErrorCode);
106*0e209d39SAndroid Build Coastguard Worker 
107*0e209d39SAndroid Build Coastguard Worker /**
108*0e209d39SAndroid Build Coastguard Worker  * Memory option: allow the result to have a different length than the source.
109*0e209d39SAndroid Build Coastguard Worker  * Affects: LamAlef options
110*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
111*0e209d39SAndroid Build Coastguard Worker  */
112*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_LENGTH_GROW_SHRINK              0
113*0e209d39SAndroid Build Coastguard Worker 
114*0e209d39SAndroid Build Coastguard Worker /**
115*0e209d39SAndroid Build Coastguard Worker  * Memory option: allow the result to have a different length than the source.
116*0e209d39SAndroid Build Coastguard Worker  * Affects: LamAlef options
117*0e209d39SAndroid Build Coastguard Worker  * This option is an alias to U_SHAPE_LENGTH_GROW_SHRINK
118*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.2
119*0e209d39SAndroid Build Coastguard Worker  */
120*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_LAMALEF_RESIZE                  0
121*0e209d39SAndroid Build Coastguard Worker 
122*0e209d39SAndroid Build Coastguard Worker /**
123*0e209d39SAndroid Build Coastguard Worker  * Memory option: the result must have the same length as the source.
124*0e209d39SAndroid Build Coastguard Worker  * If more room is necessary, then try to consume spaces next to modified characters.
125*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
126*0e209d39SAndroid Build Coastguard Worker  */
127*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_LENGTH_FIXED_SPACES_NEAR        1
128*0e209d39SAndroid Build Coastguard Worker 
129*0e209d39SAndroid Build Coastguard Worker /**
130*0e209d39SAndroid Build Coastguard Worker  * Memory option: the result must have the same length as the source.
131*0e209d39SAndroid Build Coastguard Worker  * If more room is necessary, then try to consume spaces next to modified characters.
132*0e209d39SAndroid Build Coastguard Worker  * Affects: LamAlef options
133*0e209d39SAndroid Build Coastguard Worker  * This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_NEAR
134*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.2
135*0e209d39SAndroid Build Coastguard Worker  */
136*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_LAMALEF_NEAR                    1
137*0e209d39SAndroid Build Coastguard Worker 
138*0e209d39SAndroid Build Coastguard Worker /**
139*0e209d39SAndroid Build Coastguard Worker  * Memory option: the result must have the same length as the source.
140*0e209d39SAndroid Build Coastguard Worker  * If more room is necessary, then try to consume spaces at the end of the text.
141*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
142*0e209d39SAndroid Build Coastguard Worker  */
143*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_LENGTH_FIXED_SPACES_AT_END      2
144*0e209d39SAndroid Build Coastguard Worker 
145*0e209d39SAndroid Build Coastguard Worker /**
146*0e209d39SAndroid Build Coastguard Worker  * Memory option: the result must have the same length as the source.
147*0e209d39SAndroid Build Coastguard Worker  * If more room is necessary, then try to consume spaces at the end of the text.
148*0e209d39SAndroid Build Coastguard Worker  * Affects: LamAlef options
149*0e209d39SAndroid Build Coastguard Worker  * This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_AT_END
150*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.2
151*0e209d39SAndroid Build Coastguard Worker  */
152*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_LAMALEF_END                     2
153*0e209d39SAndroid Build Coastguard Worker 
154*0e209d39SAndroid Build Coastguard Worker /**
155*0e209d39SAndroid Build Coastguard Worker  * Memory option: the result must have the same length as the source.
156*0e209d39SAndroid Build Coastguard Worker  * If more room is necessary, then try to consume spaces at the beginning of the text.
157*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
158*0e209d39SAndroid Build Coastguard Worker  */
159*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING 3
160*0e209d39SAndroid Build Coastguard Worker 
161*0e209d39SAndroid Build Coastguard Worker /**
162*0e209d39SAndroid Build Coastguard Worker  * Memory option: the result must have the same length as the source.
163*0e209d39SAndroid Build Coastguard Worker  * If more room is necessary, then try to consume spaces at the beginning of the text.
164*0e209d39SAndroid Build Coastguard Worker  * Affects: LamAlef options
165*0e209d39SAndroid Build Coastguard Worker  * This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING
166*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.2
167*0e209d39SAndroid Build Coastguard Worker  */
168*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_LAMALEF_BEGIN                    3
169*0e209d39SAndroid Build Coastguard Worker 
170*0e209d39SAndroid Build Coastguard Worker 
171*0e209d39SAndroid Build Coastguard Worker /**
172*0e209d39SAndroid Build Coastguard Worker  * Memory option: the result must have the same length as the source.
173*0e209d39SAndroid Build Coastguard Worker  * Shaping Mode: For each LAMALEF character found, expand LAMALEF using space at end.
174*0e209d39SAndroid Build Coastguard Worker  *               If there is no space at end, use spaces at beginning of the buffer. If there
175*0e209d39SAndroid Build Coastguard Worker  *               is no space at beginning of the buffer, use spaces at the near (i.e. the space
176*0e209d39SAndroid Build Coastguard Worker  *               after the LAMALEF character).
177*0e209d39SAndroid Build Coastguard Worker  *               If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h)
178*0e209d39SAndroid Build Coastguard Worker  *               will be set in pErrorCode
179*0e209d39SAndroid Build Coastguard Worker  *
180*0e209d39SAndroid Build Coastguard Worker  * Deshaping Mode: Perform the same function as the flag equals U_SHAPE_LAMALEF_END.
181*0e209d39SAndroid Build Coastguard Worker  * Affects: LamAlef options
182*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.2
183*0e209d39SAndroid Build Coastguard Worker  */
184*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_LAMALEF_AUTO                     0x10000
185*0e209d39SAndroid Build Coastguard Worker 
186*0e209d39SAndroid Build Coastguard Worker /** Bit mask for memory options. @stable ICU 2.0 */
187*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_LENGTH_MASK                      0x10003 /* Changed old value 3 */
188*0e209d39SAndroid Build Coastguard Worker 
189*0e209d39SAndroid Build Coastguard Worker 
190*0e209d39SAndroid Build Coastguard Worker /**
191*0e209d39SAndroid Build Coastguard Worker  * Bit mask for LamAlef memory options.
192*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.2
193*0e209d39SAndroid Build Coastguard Worker  */
194*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_LAMALEF_MASK                     0x10003 /* updated */
195*0e209d39SAndroid Build Coastguard Worker 
196*0e209d39SAndroid Build Coastguard Worker /** Direction indicator: the source is in logical (keyboard) order. @stable ICU 2.0 */
197*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_TEXT_DIRECTION_LOGICAL          0
198*0e209d39SAndroid Build Coastguard Worker 
199*0e209d39SAndroid Build Coastguard Worker /**
200*0e209d39SAndroid Build Coastguard Worker  * Direction indicator:
201*0e209d39SAndroid Build Coastguard Worker  * the source is in visual RTL order,
202*0e209d39SAndroid Build Coastguard Worker  * the rightmost displayed character stored first.
203*0e209d39SAndroid Build Coastguard Worker  * This option is an alias to U_SHAPE_TEXT_DIRECTION_LOGICAL
204*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.2
205*0e209d39SAndroid Build Coastguard Worker  */
206*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_TEXT_DIRECTION_VISUAL_RTL       0
207*0e209d39SAndroid Build Coastguard Worker 
208*0e209d39SAndroid Build Coastguard Worker /**
209*0e209d39SAndroid Build Coastguard Worker  * Direction indicator:
210*0e209d39SAndroid Build Coastguard Worker  * the source is in visual LTR order,
211*0e209d39SAndroid Build Coastguard Worker  * the leftmost displayed character stored first.
212*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
213*0e209d39SAndroid Build Coastguard Worker  */
214*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_TEXT_DIRECTION_VISUAL_LTR       4
215*0e209d39SAndroid Build Coastguard Worker 
216*0e209d39SAndroid Build Coastguard Worker /** Bit mask for direction indicators. @stable ICU 2.0 */
217*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_TEXT_DIRECTION_MASK             4
218*0e209d39SAndroid Build Coastguard Worker 
219*0e209d39SAndroid Build Coastguard Worker 
220*0e209d39SAndroid Build Coastguard Worker /** Letter shaping option: do not perform letter shaping. @stable ICU 2.0 */
221*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_LETTERS_NOOP                    0
222*0e209d39SAndroid Build Coastguard Worker 
223*0e209d39SAndroid Build Coastguard Worker /** Letter shaping option: replace abstract letter characters by "shaped" ones. @stable ICU 2.0 */
224*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_LETTERS_SHAPE                   8
225*0e209d39SAndroid Build Coastguard Worker 
226*0e209d39SAndroid Build Coastguard Worker /** Letter shaping option: replace "shaped" letter characters by abstract ones. @stable ICU 2.0 */
227*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_LETTERS_UNSHAPE                 0x10
228*0e209d39SAndroid Build Coastguard Worker 
229*0e209d39SAndroid Build Coastguard Worker /**
230*0e209d39SAndroid Build Coastguard Worker  * Letter shaping option: replace abstract letter characters by "shaped" ones.
231*0e209d39SAndroid Build Coastguard Worker  * The only difference with U_SHAPE_LETTERS_SHAPE is that Tashkeel letters
232*0e209d39SAndroid Build Coastguard Worker  * are always "shaped" into the isolated form instead of the medial form
233*0e209d39SAndroid Build Coastguard Worker  * (selecting code points from the Arabic Presentation Forms-B block).
234*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
235*0e209d39SAndroid Build Coastguard Worker  */
236*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED 0x18
237*0e209d39SAndroid Build Coastguard Worker 
238*0e209d39SAndroid Build Coastguard Worker 
239*0e209d39SAndroid Build Coastguard Worker /** Bit mask for letter shaping options. @stable ICU 2.0 */
240*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_LETTERS_MASK                        0x18
241*0e209d39SAndroid Build Coastguard Worker 
242*0e209d39SAndroid Build Coastguard Worker 
243*0e209d39SAndroid Build Coastguard Worker /** Digit shaping option: do not perform digit shaping. @stable ICU 2.0 */
244*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_DIGITS_NOOP                     0
245*0e209d39SAndroid Build Coastguard Worker 
246*0e209d39SAndroid Build Coastguard Worker /**
247*0e209d39SAndroid Build Coastguard Worker  * Digit shaping option:
248*0e209d39SAndroid Build Coastguard Worker  * Replace European digits (U+0030...) by Arabic-Indic digits.
249*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
250*0e209d39SAndroid Build Coastguard Worker  */
251*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_DIGITS_EN2AN                    0x20
252*0e209d39SAndroid Build Coastguard Worker 
253*0e209d39SAndroid Build Coastguard Worker /**
254*0e209d39SAndroid Build Coastguard Worker  * Digit shaping option:
255*0e209d39SAndroid Build Coastguard Worker  * Replace Arabic-Indic digits by European digits (U+0030...).
256*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
257*0e209d39SAndroid Build Coastguard Worker  */
258*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_DIGITS_AN2EN                    0x40
259*0e209d39SAndroid Build Coastguard Worker 
260*0e209d39SAndroid Build Coastguard Worker /**
261*0e209d39SAndroid Build Coastguard Worker  * Digit shaping option:
262*0e209d39SAndroid Build Coastguard Worker  * Replace European digits (U+0030...) by Arabic-Indic digits if the most recent
263*0e209d39SAndroid Build Coastguard Worker  * strongly directional character is an Arabic letter
264*0e209d39SAndroid Build Coastguard Worker  * (<code>u_charDirection()</code> result <code>U_RIGHT_TO_LEFT_ARABIC</code> [AL]).<br>
265*0e209d39SAndroid Build Coastguard Worker  * The direction of "preceding" depends on the direction indicator option.
266*0e209d39SAndroid Build Coastguard Worker  * For the first characters, the preceding strongly directional character
267*0e209d39SAndroid Build Coastguard Worker  * (initial state) is assumed to be not an Arabic letter
268*0e209d39SAndroid Build Coastguard Worker  * (it is <code>U_LEFT_TO_RIGHT</code> [L] or <code>U_RIGHT_TO_LEFT</code> [R]).
269*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
270*0e209d39SAndroid Build Coastguard Worker  */
271*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_DIGITS_ALEN2AN_INIT_LR          0x60
272*0e209d39SAndroid Build Coastguard Worker 
273*0e209d39SAndroid Build Coastguard Worker /**
274*0e209d39SAndroid Build Coastguard Worker  * Digit shaping option:
275*0e209d39SAndroid Build Coastguard Worker  * Replace European digits (U+0030...) by Arabic-Indic digits if the most recent
276*0e209d39SAndroid Build Coastguard Worker  * strongly directional character is an Arabic letter
277*0e209d39SAndroid Build Coastguard Worker  * (<code>u_charDirection()</code> result <code>U_RIGHT_TO_LEFT_ARABIC</code> [AL]).<br>
278*0e209d39SAndroid Build Coastguard Worker  * The direction of "preceding" depends on the direction indicator option.
279*0e209d39SAndroid Build Coastguard Worker  * For the first characters, the preceding strongly directional character
280*0e209d39SAndroid Build Coastguard Worker  * (initial state) is assumed to be an Arabic letter.
281*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
282*0e209d39SAndroid Build Coastguard Worker  */
283*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_DIGITS_ALEN2AN_INIT_AL          0x80
284*0e209d39SAndroid Build Coastguard Worker 
285*0e209d39SAndroid Build Coastguard Worker /** Not a valid option value. May be replaced by a new option. @stable ICU 2.0 */
286*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_DIGITS_RESERVED                 0xa0
287*0e209d39SAndroid Build Coastguard Worker 
288*0e209d39SAndroid Build Coastguard Worker /** Bit mask for digit shaping options. @stable ICU 2.0 */
289*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_DIGITS_MASK                     0xe0
290*0e209d39SAndroid Build Coastguard Worker 
291*0e209d39SAndroid Build Coastguard Worker 
292*0e209d39SAndroid Build Coastguard Worker /** Digit type option: Use Arabic-Indic digits (U+0660...U+0669). @stable ICU 2.0 */
293*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_DIGIT_TYPE_AN                   0
294*0e209d39SAndroid Build Coastguard Worker 
295*0e209d39SAndroid Build Coastguard Worker /** Digit type option: Use Eastern (Extended) Arabic-Indic digits (U+06f0...U+06f9). @stable ICU 2.0 */
296*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_DIGIT_TYPE_AN_EXTENDED          0x100
297*0e209d39SAndroid Build Coastguard Worker 
298*0e209d39SAndroid Build Coastguard Worker /** Not a valid option value. May be replaced by a new option. @stable ICU 2.0 */
299*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_DIGIT_TYPE_RESERVED             0x200
300*0e209d39SAndroid Build Coastguard Worker 
301*0e209d39SAndroid Build Coastguard Worker /** Bit mask for digit type options. @stable ICU 2.0 */
302*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_DIGIT_TYPE_MASK                 0x300 /* I need to change this from 0x3f00 to 0x300 */
303*0e209d39SAndroid Build Coastguard Worker 
304*0e209d39SAndroid Build Coastguard Worker /**
305*0e209d39SAndroid Build Coastguard Worker  * Tashkeel aggregation option:
306*0e209d39SAndroid Build Coastguard Worker  * Replaces any combination of U+0651 with one of
307*0e209d39SAndroid Build Coastguard Worker  * U+064C, U+064D, U+064E, U+064F, U+0650 with
308*0e209d39SAndroid Build Coastguard Worker  * U+FC5E, U+FC5F, U+FC60, U+FC61, U+FC62 consecutively.
309*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 3.6
310*0e209d39SAndroid Build Coastguard Worker  */
311*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_AGGREGATE_TASHKEEL              0x4000
312*0e209d39SAndroid Build Coastguard Worker /** Tashkeel aggregation option: do not aggregate tashkeels. @stable ICU 3.6 */
313*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_AGGREGATE_TASHKEEL_NOOP         0
314*0e209d39SAndroid Build Coastguard Worker /** Bit mask for tashkeel aggregation. @stable ICU 3.6 */
315*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_AGGREGATE_TASHKEEL_MASK         0x4000
316*0e209d39SAndroid Build Coastguard Worker 
317*0e209d39SAndroid Build Coastguard Worker /**
318*0e209d39SAndroid Build Coastguard Worker  * Presentation form option:
319*0e209d39SAndroid Build Coastguard Worker  * Don't replace Arabic Presentation Forms-A and Arabic Presentation Forms-B
320*0e209d39SAndroid Build Coastguard Worker  * characters with 0+06xx characters, before shaping.
321*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 3.6
322*0e209d39SAndroid Build Coastguard Worker  */
323*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_PRESERVE_PRESENTATION           0x8000
324*0e209d39SAndroid Build Coastguard Worker /** Presentation form option:
325*0e209d39SAndroid Build Coastguard Worker  * Replace Arabic Presentation Forms-A and Arabic Presentationo Forms-B with
326*0e209d39SAndroid Build Coastguard Worker  * their unshaped correspondents in range 0+06xx, before shaping.
327*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 3.6
328*0e209d39SAndroid Build Coastguard Worker  */
329*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_PRESERVE_PRESENTATION_NOOP      0
330*0e209d39SAndroid Build Coastguard Worker /** Bit mask for preserve presentation form. @stable ICU 3.6 */
331*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_PRESERVE_PRESENTATION_MASK      0x8000
332*0e209d39SAndroid Build Coastguard Worker 
333*0e209d39SAndroid Build Coastguard Worker /* Seen Tail option */
334*0e209d39SAndroid Build Coastguard Worker /**
335*0e209d39SAndroid Build Coastguard Worker  * Memory option: the result must have the same length as the source.
336*0e209d39SAndroid Build Coastguard Worker  * Shaping mode: The SEEN family character will expand into two characters using space near
337*0e209d39SAndroid Build Coastguard Worker  *               the SEEN family character(i.e. the space after the character).
338*0e209d39SAndroid Build Coastguard Worker  *               If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h)
339*0e209d39SAndroid Build Coastguard Worker  *               will be set in pErrorCode
340*0e209d39SAndroid Build Coastguard Worker  *
341*0e209d39SAndroid Build Coastguard Worker  * De-shaping mode: Any Seen character followed by Tail character will be
342*0e209d39SAndroid Build Coastguard Worker  *                  replaced by one cell Seen and a space will replace the Tail.
343*0e209d39SAndroid Build Coastguard Worker  * Affects: Seen options
344*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.2
345*0e209d39SAndroid Build Coastguard Worker  */
346*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_SEEN_TWOCELL_NEAR     0x200000
347*0e209d39SAndroid Build Coastguard Worker 
348*0e209d39SAndroid Build Coastguard Worker /**
349*0e209d39SAndroid Build Coastguard Worker  * Bit mask for Seen memory options.
350*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.2
351*0e209d39SAndroid Build Coastguard Worker  */
352*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_SEEN_MASK             0x700000
353*0e209d39SAndroid Build Coastguard Worker 
354*0e209d39SAndroid Build Coastguard Worker /* YehHamza option */
355*0e209d39SAndroid Build Coastguard Worker /**
356*0e209d39SAndroid Build Coastguard Worker  * Memory option: the result must have the same length as the source.
357*0e209d39SAndroid Build Coastguard Worker  * Shaping mode: The YEHHAMZA character will expand into two characters using space near it
358*0e209d39SAndroid Build Coastguard Worker  *              (i.e. the space after the character
359*0e209d39SAndroid Build Coastguard Worker  *               If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h)
360*0e209d39SAndroid Build Coastguard Worker  *               will be set in pErrorCode
361*0e209d39SAndroid Build Coastguard Worker  *
362*0e209d39SAndroid Build Coastguard Worker  * De-shaping mode: Any Yeh (final or isolated) character followed by Hamza character will be
363*0e209d39SAndroid Build Coastguard Worker  *                  replaced by one cell YehHamza and space will replace the Hamza.
364*0e209d39SAndroid Build Coastguard Worker  * Affects: YehHamza options
365*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.2
366*0e209d39SAndroid Build Coastguard Worker  */
367*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_YEHHAMZA_TWOCELL_NEAR      0x1000000
368*0e209d39SAndroid Build Coastguard Worker 
369*0e209d39SAndroid Build Coastguard Worker 
370*0e209d39SAndroid Build Coastguard Worker /**
371*0e209d39SAndroid Build Coastguard Worker  * Bit mask for YehHamza memory options.
372*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.2
373*0e209d39SAndroid Build Coastguard Worker  */
374*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_YEHHAMZA_MASK              0x3800000
375*0e209d39SAndroid Build Coastguard Worker 
376*0e209d39SAndroid Build Coastguard Worker /* New Tashkeel options */
377*0e209d39SAndroid Build Coastguard Worker /**
378*0e209d39SAndroid Build Coastguard Worker  * Memory option: the result must have the same length as the source.
379*0e209d39SAndroid Build Coastguard Worker  * Shaping mode: Tashkeel characters will be replaced by spaces.
380*0e209d39SAndroid Build Coastguard Worker  *               Spaces will be placed at beginning of the buffer
381*0e209d39SAndroid Build Coastguard Worker  *
382*0e209d39SAndroid Build Coastguard Worker  * De-shaping mode: N/A
383*0e209d39SAndroid Build Coastguard Worker  * Affects: Tashkeel options
384*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.2
385*0e209d39SAndroid Build Coastguard Worker  */
386*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_TASHKEEL_BEGIN                      0x40000
387*0e209d39SAndroid Build Coastguard Worker 
388*0e209d39SAndroid Build Coastguard Worker /**
389*0e209d39SAndroid Build Coastguard Worker  * Memory option: the result must have the same length as the source.
390*0e209d39SAndroid Build Coastguard Worker  * Shaping mode: Tashkeel characters will be replaced by spaces.
391*0e209d39SAndroid Build Coastguard Worker  *               Spaces will be placed at end of the buffer
392*0e209d39SAndroid Build Coastguard Worker  *
393*0e209d39SAndroid Build Coastguard Worker  * De-shaping mode: N/A
394*0e209d39SAndroid Build Coastguard Worker  * Affects: Tashkeel options
395*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.2
396*0e209d39SAndroid Build Coastguard Worker  */
397*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_TASHKEEL_END                        0x60000
398*0e209d39SAndroid Build Coastguard Worker 
399*0e209d39SAndroid Build Coastguard Worker /**
400*0e209d39SAndroid Build Coastguard Worker  * Memory option: allow the result to have a different length than the source.
401*0e209d39SAndroid Build Coastguard Worker  * Shaping mode: Tashkeel characters will be removed, buffer length will shrink.
402*0e209d39SAndroid Build Coastguard Worker  * De-shaping mode: N/A
403*0e209d39SAndroid Build Coastguard Worker  *
404*0e209d39SAndroid Build Coastguard Worker  * Affect: Tashkeel options
405*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.2
406*0e209d39SAndroid Build Coastguard Worker  */
407*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_TASHKEEL_RESIZE                     0x80000
408*0e209d39SAndroid Build Coastguard Worker 
409*0e209d39SAndroid Build Coastguard Worker /**
410*0e209d39SAndroid Build Coastguard Worker  * Memory option: the result must have the same length as the source.
411*0e209d39SAndroid Build Coastguard Worker  * Shaping mode: Tashkeel characters will be replaced by Tatweel if it is connected to adjacent
412*0e209d39SAndroid Build Coastguard Worker  *               characters (i.e. shaped on Tatweel) or replaced by space if it is not connected.
413*0e209d39SAndroid Build Coastguard Worker  *
414*0e209d39SAndroid Build Coastguard Worker  * De-shaping mode: N/A
415*0e209d39SAndroid Build Coastguard Worker  * Affects: YehHamza options
416*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.2
417*0e209d39SAndroid Build Coastguard Worker  */
418*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_TASHKEEL_REPLACE_BY_TATWEEL         0xC0000
419*0e209d39SAndroid Build Coastguard Worker 
420*0e209d39SAndroid Build Coastguard Worker /**
421*0e209d39SAndroid Build Coastguard Worker  * Bit mask for Tashkeel replacement with Space or Tatweel memory options.
422*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.2
423*0e209d39SAndroid Build Coastguard Worker  */
424*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_TASHKEEL_MASK                       0xE0000
425*0e209d39SAndroid Build Coastguard Worker 
426*0e209d39SAndroid Build Coastguard Worker 
427*0e209d39SAndroid Build Coastguard Worker /* Space location Control options */
428*0e209d39SAndroid Build Coastguard Worker /**
429*0e209d39SAndroid Build Coastguard Worker  * This option affect the meaning of BEGIN and END options. if this option is not used the default
430*0e209d39SAndroid Build Coastguard Worker  * for BEGIN and END will be as following:
431*0e209d39SAndroid Build Coastguard Worker  * The Default (for both Visual LTR, Visual RTL and Logical Text)
432*0e209d39SAndroid Build Coastguard Worker  *           1. BEGIN always refers to the start address of physical memory.
433*0e209d39SAndroid Build Coastguard Worker  *           2. END always refers to the end address of physical memory.
434*0e209d39SAndroid Build Coastguard Worker  *
435*0e209d39SAndroid Build Coastguard Worker  * If this option is used it will swap the meaning of BEGIN and END only for Visual LTR text.
436*0e209d39SAndroid Build Coastguard Worker  *
437*0e209d39SAndroid Build Coastguard Worker  * The effect on BEGIN and END Memory Options will be as following:
438*0e209d39SAndroid Build Coastguard Worker  *    A. BEGIN For Visual LTR text: This will be the beginning (right side) of the visual text(
439*0e209d39SAndroid Build Coastguard Worker  *       corresponding to the physical memory address end for Visual LTR text, Same as END in
440*0e209d39SAndroid Build Coastguard Worker  *       default behavior)
441*0e209d39SAndroid Build Coastguard Worker  *    B. BEGIN For Logical text: Same as BEGIN in default behavior.
442*0e209d39SAndroid Build Coastguard Worker  *    C. END For Visual LTR text: This will be the end (left side) of the visual text (corresponding
443*0e209d39SAndroid Build Coastguard Worker  *       to the physical memory address beginning for Visual LTR text, Same as BEGIN in default behavior.
444*0e209d39SAndroid Build Coastguard Worker  *    D. END For Logical text: Same as END in default behavior).
445*0e209d39SAndroid Build Coastguard Worker  * Affects: All LamAlef BEGIN, END and AUTO options.
446*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.2
447*0e209d39SAndroid Build Coastguard Worker  */
448*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_SPACES_RELATIVE_TO_TEXT_BEGIN_END 0x4000000
449*0e209d39SAndroid Build Coastguard Worker 
450*0e209d39SAndroid Build Coastguard Worker /**
451*0e209d39SAndroid Build Coastguard Worker  * Bit mask for swapping BEGIN and END for Visual LTR text
452*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.2
453*0e209d39SAndroid Build Coastguard Worker  */
454*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_SPACES_RELATIVE_TO_TEXT_MASK      0x4000000
455*0e209d39SAndroid Build Coastguard Worker 
456*0e209d39SAndroid Build Coastguard Worker /**
457*0e209d39SAndroid Build Coastguard Worker  * If this option is used, shaping will use the new Unicode code point for TAIL (i.e. 0xFE73).
458*0e209d39SAndroid Build Coastguard Worker  * If this option is not specified (Default), old unofficial Unicode TAIL code point is used (i.e. 0x200B)
459*0e209d39SAndroid Build Coastguard Worker  * De-shaping will not use this option as it will always search for both the new Unicode code point for the
460*0e209d39SAndroid Build Coastguard Worker  * TAIL (i.e. 0xFE73) or the old unofficial Unicode TAIL code point (i.e. 0x200B) and de-shape the
461*0e209d39SAndroid Build Coastguard Worker  * Seen-Family letter accordingly.
462*0e209d39SAndroid Build Coastguard Worker  *
463*0e209d39SAndroid Build Coastguard Worker  * Shaping Mode: Only shaping.
464*0e209d39SAndroid Build Coastguard Worker  * De-shaping Mode: N/A.
465*0e209d39SAndroid Build Coastguard Worker  * Affects: All Seen options
466*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.8
467*0e209d39SAndroid Build Coastguard Worker  */
468*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_TAIL_NEW_UNICODE        0x8000000
469*0e209d39SAndroid Build Coastguard Worker 
470*0e209d39SAndroid Build Coastguard Worker /**
471*0e209d39SAndroid Build Coastguard Worker  * Bit mask for new Unicode Tail option
472*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.8
473*0e209d39SAndroid Build Coastguard Worker  */
474*0e209d39SAndroid Build Coastguard Worker #define U_SHAPE_TAIL_TYPE_MASK          0x8000000
475*0e209d39SAndroid Build Coastguard Worker 
476*0e209d39SAndroid Build Coastguard Worker #endif
477