ICU-1274 reenable [and rename] arabic shaping option for tashkeel characters
X-SVN-Rev: 6229
This commit is contained in:
parent
0ed91898b2
commit
94b2c62a59
@ -150,8 +150,13 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
|
||||
/** Letter shaping option: replace "shaped" letter characters by abstract ones. */
|
||||
#define U_SHAPE_LETTERS_UNSHAPE 0x10
|
||||
|
||||
/** Not a valid option value. */
|
||||
#define U_SHAPE_LETTERS_RESERVED 0x18
|
||||
/**
|
||||
* Letter shaping option: replace abstract letter characters by "shaped" ones.
|
||||
* The only difference with U_SHAPE_LETTERS_SHAPE is that Tashkeel letters
|
||||
* are always "shaped" into the isolated form instead of the medial form
|
||||
* (selecting code points from the Arabic Presentation Forms-B block).
|
||||
*/
|
||||
#define U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED 0x18
|
||||
|
||||
/** Bit mask for letter shaping options. */
|
||||
#define U_SHAPE_LETTERS_MASK 0x18
|
||||
|
@ -45,22 +45,6 @@
|
||||
* + IBM Egypt has proposed to encode the tail in Unicode among Arabic Presentation Forms
|
||||
*/
|
||||
|
||||
/*
|
||||
* ### TODO
|
||||
*
|
||||
* The option U_SHAPE_LETTERS_EXCEPT_TASHKEEL was removed from ushape.h for
|
||||
* ICU 1.8 because its semantics were not clear:
|
||||
* It is not clear if the transformation of legacy codepage data might
|
||||
* need an option to
|
||||
* - ignore tashkeel characters, which would always leave them as is, or
|
||||
* - always shape to a certain form them regardless of other letter shaping options
|
||||
*/
|
||||
/**
|
||||
* Letter shaping option: replace abstract letter characters by "shaped" ones,
|
||||
* but do not process Tashkeel characters.
|
||||
*/
|
||||
#define U_SHAPE_LETTERS_EXCEPT_TASHKEEL 0x18
|
||||
|
||||
/* definitions for Arabic letter shaping ------------------------------------ */
|
||||
|
||||
#define IRRELEVANT 4
|
||||
@ -951,7 +935,6 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
|
||||
if( source==NULL || sourceLength<-1 ||
|
||||
(dest==NULL && destSize!=0) || destSize<0 ||
|
||||
options>=U_SHAPE_DIGIT_TYPE_RESERVED ||
|
||||
(options&U_SHAPE_LETTERS_MASK)==U_SHAPE_LETTERS_RESERVED ||
|
||||
(options&U_SHAPE_DIGITS_MASK)>=U_SHAPE_DIGITS_RESERVED
|
||||
) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
@ -1016,7 +999,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
|
||||
/* Call the shaping function with tashkeel flag == 1 */
|
||||
outputSize = shapeUnicode(tempbuffer,sourceLength,destSize,options,pErrorCode,1);
|
||||
break;
|
||||
case U_SHAPE_LETTERS_EXCEPT_TASHKEEL :
|
||||
case U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED :
|
||||
/* Call the shaping function with tashkeel flag == 0 */
|
||||
outputSize = shapeUnicode(tempbuffer,sourceLength,destSize,options,pErrorCode,0);
|
||||
break;
|
||||
|
@ -741,15 +741,6 @@ doArabicShapingTest() {
|
||||
log_err("failure in u_shapeArabic(destSize=-1), returned %s instead of U_ILLEGAL_ARGUMENT_ERROR\n", u_errorName(errorCode));
|
||||
}
|
||||
|
||||
errorCode=U_ZERO_ERROR;
|
||||
length=u_shapeArabic(source, LENGTHOF(source),
|
||||
dest, LENGTHOF(dest),
|
||||
U_SHAPE_LETTERS_RESERVED|U_SHAPE_DIGITS_EN2AN|U_SHAPE_DIGIT_TYPE_AN,
|
||||
&errorCode);
|
||||
if(errorCode!=U_ILLEGAL_ARGUMENT_ERROR) {
|
||||
log_err("failure in u_shapeArabic(U_SHAPE_LETTERS_RESERVED), returned %s instead of U_ILLEGAL_ARGUMENT_ERROR\n", u_errorName(errorCode));
|
||||
}
|
||||
|
||||
errorCode=U_ZERO_ERROR;
|
||||
length=u_shapeArabic(source, LENGTHOF(source),
|
||||
dest, LENGTHOF(dest),
|
||||
@ -878,21 +869,13 @@ doLamAlefSpecialVLTRArabicShapingTest() {
|
||||
log_err("failure in u_shapeArabic(LAMALEF shape_grow_shrink)\n");
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* ### TODO
|
||||
*
|
||||
* The option U_SHAPE_LETTERS_EXCEPT_TASHKEEL was removed from ushape.h for
|
||||
* ICU 1.8 because its semantics were not clear.
|
||||
* See ushape.c.
|
||||
*/
|
||||
/* ==================== SHAPE_EXCEPT_TASHKEEL ==================== */
|
||||
/* ==================== U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED ==================== */
|
||||
|
||||
errorCode=U_ZERO_ERROR;
|
||||
|
||||
length=u_shapeArabic(source, LENGTHOF(source),
|
||||
dest, LENGTHOF(dest),
|
||||
U_SHAPE_LETTERS_EXCEPT_TASHKEEL|U_SHAPE_LENGTH_FIXED_SPACES_NEAR|
|
||||
U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED|U_SHAPE_LENGTH_FIXED_SPACES_NEAR|
|
||||
U_SHAPE_TEXT_DIRECTION_VISUAL_LTR,
|
||||
&errorCode);
|
||||
|
||||
@ -904,7 +887,7 @@ doLamAlefSpecialVLTRArabicShapingTest() {
|
||||
|
||||
length=u_shapeArabic(source, LENGTHOF(source),
|
||||
dest, LENGTHOF(dest),
|
||||
U_SHAPE_LETTERS_EXCEPT_TASHKEEL|U_SHAPE_LENGTH_FIXED_SPACES_AT_END|
|
||||
U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED|U_SHAPE_LENGTH_FIXED_SPACES_AT_END|
|
||||
U_SHAPE_TEXT_DIRECTION_VISUAL_LTR,
|
||||
&errorCode);
|
||||
|
||||
@ -916,7 +899,7 @@ doLamAlefSpecialVLTRArabicShapingTest() {
|
||||
|
||||
length=u_shapeArabic(source, LENGTHOF(source),
|
||||
dest, LENGTHOF(dest),
|
||||
U_SHAPE_LETTERS_EXCEPT_TASHKEEL|U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING|
|
||||
U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED|U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING|
|
||||
U_SHAPE_TEXT_DIRECTION_VISUAL_LTR,
|
||||
&errorCode);
|
||||
|
||||
@ -928,14 +911,13 @@ doLamAlefSpecialVLTRArabicShapingTest() {
|
||||
|
||||
length=u_shapeArabic(source, LENGTHOF(source),
|
||||
dest, LENGTHOF(dest),
|
||||
U_SHAPE_LETTERS_EXCEPT_TASHKEEL|U_SHAPE_LENGTH_GROW_SHRINK|
|
||||
U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED|U_SHAPE_LENGTH_GROW_SHRINK|
|
||||
U_SHAPE_TEXT_DIRECTION_VISUAL_LTR,
|
||||
&errorCode);
|
||||
|
||||
if(U_FAILURE(errorCode) || uprv_memcmp(dest, shape_excepttashkeel_grow_shrink, length*U_SIZEOF_UCHAR)!=0) {
|
||||
log_err("failure in u_shapeArabic(LAMALEF shape_excepttashkeel_grow_shrink)\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@ -977,26 +959,17 @@ doTashkeelSpecialVLTRArabicShapingTest() {
|
||||
log_err("failure in u_shapeArabic(TASHKEEL shape_near)\n");
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* ### TODO
|
||||
*
|
||||
* The option U_SHAPE_LETTERS_EXCEPT_TASHKEEL was removed from ushape.h for
|
||||
* ICU 1.8 because its semantics were not clear.
|
||||
* See ushape.c.
|
||||
*/
|
||||
errorCode=U_ZERO_ERROR;
|
||||
|
||||
length=u_shapeArabic(source, LENGTHOF(source),
|
||||
dest, LENGTHOF(dest),
|
||||
U_SHAPE_LETTERS_EXCEPT_TASHKEEL|U_SHAPE_LENGTH_FIXED_SPACES_NEAR|
|
||||
U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED|U_SHAPE_LENGTH_FIXED_SPACES_NEAR|
|
||||
U_SHAPE_TEXT_DIRECTION_VISUAL_LTR,
|
||||
&errorCode);
|
||||
|
||||
if(U_FAILURE(errorCode) || length!=LENGTHOF(shape_excepttashkeel_near) || uprv_memcmp(dest, shape_excepttashkeel_near, length*U_SIZEOF_UCHAR)!=0) {
|
||||
log_err("failure in u_shapeArabic(TASHKEEL shape_excepttashkeel_near)\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user