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