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