ICU-1199 Stop using the deprecated Unicode C++ class

X-SVN-Rev: 8105
This commit is contained in:
George Rhoten 2002-03-19 03:01:28 +00:00
parent 6fc22af7c9
commit bc64b17bee
12 changed files with 271 additions and 275 deletions

View file

@ -25,7 +25,7 @@
#include "cmemory.h"
#include "unicode/ustring.h"
#include "unicode/unistr.h"
#include "unicode/unicode.h"
#include "unicode/uchar.h"
#include "unicode/ucnv.h"
#include "unicode/ubrk.h"
#include "uhash.h"
@ -451,19 +451,19 @@ UnicodeString::numDisplayCells( int32_t start,
while(start < limit) {
UTF_NEXT_CHAR(fArray, start, limit, c);
switch(Unicode::getCellWidth(c)) {
case Unicode::ZERO_WIDTH:
switch(u_charCellWidth(c)) {
case U_ZERO_WIDTH:
break;
case Unicode::HALF_WIDTH:
case U_HALF_WIDTH:
result += 1;
break;
case Unicode::FULL_WIDTH:
case U_FULL_WIDTH:
result += 2;
break;
case Unicode::NEUTRAL:
case U_NEUTRAL_WIDTH:
result += (asian ? 2 : 1);
break;
}
@ -1441,7 +1441,7 @@ UnicodeString::trim()
break;
}
UTF_PREV_CHAR(fArray, 0, i, c);
if(!(c == 0x20 || Unicode::isWhitespace(c))) {
if(!(c == 0x20 || u_isWhitespace(c))) {
break;
}
}
@ -1458,7 +1458,7 @@ UnicodeString::trim()
break;
}
UTF_NEXT_CHAR(fArray, i, length, c);
if(!(c == 0x20 || Unicode::isWhitespace(c))) {
if(!(c == 0x20 || u_isWhitespace(c))) {
break;
}
}

View file

@ -41,7 +41,7 @@
#include "digitlst.h"
#include "unicode/dcfmtsym.h"
#include "unicode/resbund.h"
#include "unicode/unicode.h"
#include "unicode/uchar.h"
#include "cmemory.h"
U_NAMESPACE_BEGIN

View file

@ -10,7 +10,7 @@
#include "unicode/hextouni.h"
#include "unicode/rep.h"
#include "unicode/unifilt.h"
#include "unicode/unicode.h"
#include "unicode/uchar.h"
U_NAMESPACE_BEGIN

View file

@ -11,7 +11,7 @@
#include "unicode/rbbi.h"
#include "rbbi_bld.h"
#include "cmemory.h"
#include "unicode/unicode.h"
#include "unicode/uchar.h"
//=======================================================================
// RuleBasedBreakIterator.Builder
@ -508,8 +508,8 @@ RuleBasedBreakIteratorBuilder::buildRuleList(UnicodeString& description,
// if the character is anything else (escaped characters are
// skipped and don't make it here), it's an error
default:
if (c >= ASCII_LOW && c < ASCII_HI && !Unicode::isLetter(c)
&& !Unicode::isDigit(c) && !sawIllegalChar) {
if (c >= ASCII_LOW && c < ASCII_HI && !u_isalpha(c)
&& !u_isdigit(c) && !sawIllegalChar) {
sawIllegalChar = TRUE;
illegalCharPos = p;
}
@ -979,8 +979,8 @@ RuleBasedBreakIteratorBuilder::parseRule(const UnicodeString& rule,
// effectively literal characters too), the . token, and [] expressions
if (c == OPEN_BRACKET
|| c == BACKSLASH
|| Unicode::isLetter(c)
|| Unicode::isDigit(c)
|| u_isalpha(c)
|| u_isdigit(c)
|| c < ASCII_LOW
|| c == PERIOD
|| c >= ASCII_HI) {

View file

@ -12,7 +12,6 @@
#include "rbt_data.h"
#include "unicode/unifilt.h"
#include "unicode/uniset.h"
#include "unicode/unicode.h"
#include "cmemory.h"
#include "strmatch.h"
#include "strrepl.h"

View file

@ -33,7 +33,7 @@
#include "unicode/timezone.h"
#include "unicode/decimfmt.h"
#include "unicode/dcfmtsym.h"
#include "unicode/unicode.h"
#include "unicode/uchar.h"
#include "unicode/ustring.h"
#include <float.h>
@ -1122,8 +1122,8 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
// century, for parsed strings from "00" to "99". Any other string
// is treated literally: "2250", "-1", "1", "002".
if (count <= 2 && (pos.getIndex() - start) == 2
&& Unicode::isDigit(text.charAt(start))
&& Unicode::isDigit(text.charAt(start+1)))
&& u_isdigit(text.charAt(start))
&& u_isdigit(text.charAt(start+1)))
{
// Assume for example that the defaultCenturyStart is 6/18/1903.
// This means that two-digit years will be forced into the range
@ -1143,8 +1143,8 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
case kYearWOYField:
// Comment is the same as for kYearFiels - look above
if (count <= 2 && (pos.getIndex() - start) == 2
&& Unicode::isDigit(text.charAt(start))
&& Unicode::isDigit(text.charAt(start+1)))
&& u_isdigit(text.charAt(start))
&& u_isdigit(text.charAt(start+1)))
{
int32_t ambiguousTwoDigitYear = fDefaultCenturyStartYear % 100;
ambiguousYear[0] = (value == ambiguousTwoDigitYear);

View file

@ -30,7 +30,6 @@
#include "toupptrn.h"
#include "unicode/translit.h"
#include "uni2name.h"
#include "unicode/unicode.h"
#include "unicode/unifilt.h"
#include "unicode/unifltlg.h"
#include "unicode/uniset.h"

View file

@ -10,7 +10,7 @@
#include "unicode/uniset.h"
#include "unicode/parsepos.h"
#include "unicode/unicode.h"
#include "unicode/uchar.h"
#include "unicode/uscript.h"
#include "symtable.h"
#include "cmemory.h"
@ -356,7 +356,7 @@ void UnicodeSet::applyPattern(const UnicodeString& pattern,
// Skip over trailing whitespace
int32_t i = pos.getIndex();
int32_t n = pattern.length();
while (i<n && Unicode::isWhitespace(pattern.charAt(i))) {
while (i<n && u_isWhitespace(pattern.charAt(i))) {
++i;
}

View file

@ -10,7 +10,6 @@
#include "util.h"
#include "unicode/uchar.h"
#include "unicode/unicode.h"
#include "unicode/unimatch.h"
// Define UChar constants using hex for EBCDIC compatibility
@ -457,7 +456,7 @@ void ICU_Utility::appendToRule(UnicodeString& rule,
!((c >= 0x0030/*'0'*/ && c <= 0x0039/*'9'*/) ||
(c >= 0x0041/*'A'*/ && c <= 0x005A/*'Z'*/) ||
(c >= 0x0061/*'a'*/ && c <= 0x007A/*'z'*/))) ||
Unicode::isWhitespace(c)) {
u_isWhitespace(c)) {
quoteBuf.append(c);
// Double ' within a quote
if (c == APOSTROPHE) {

View file

@ -16,7 +16,7 @@
#include "RenderingFontInstance.h"
#include "unicode/utypes.h"
#include "unicode/unicode.h"
#include "unicode/uchar.h"
#include "unicode/uchriter.h"
#include "unicode/brkiter.h"
#include "unicode/locid.h"
@ -218,8 +218,8 @@ int32_t Paragraph::previousBreak(int32_t charIndex)
// characters, because they can hang in
// the margin.
while (charIndex < fCharCount &&
(Unicode::isWhitespace(ch) ||
Unicode::isControl(ch))) {
(u_isWhitespace(ch) ||
u_iscntrl(ch))) {
ch = fText[++charIndex];
}

View file

@ -15,7 +15,7 @@
#include "unicode/utypes.h"
#include "unicode/uscript.h"
#include "unicode/unicode.h"
#include "unicode/uchar.h"
#include "unicode/locid.h"
#include "unicode/loengine.h"
@ -27,37 +27,37 @@ U_NAMESPACE_USE
struct TestInput
{
char *fontName;
UChar *text;
int32_t textLength;
UScriptCode scriptCode;
UBool rightToLeft;
char *fontName;
UChar *text;
int32_t textLength;
UScriptCode scriptCode;
UBool rightToLeft;
};
/*
* FIXME: should use the output file name and the current date.
*/
char *header =
"/*\n"
" *******************************************************************************\n"
" *\n"
" * Copyright (C) 1999-2000, International Business Machines\n"
" * Corporation and others. All Rights Reserved.\n"
" *\n"
" * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT\n"
" * UNLESS YOU REALLY KNOW WHAT YOU'RE DOING.\n"
" *\n"
" *******************************************************************************\n"
" *\n"
" * file name: testdata.cpp\n"
" * created on: 12/14/2000\n"
" * created by: gendata.cpp\n"
" */\n"
"\n"
"#include \"unicode/utypes.h\"\n"
"#include \"unicode/uscript.h\"\n"
"#include \"letest.h\"\n"
"\n";
"/*\n"
" *******************************************************************************\n"
" *\n"
" * Copyright (C) 1999-2000, International Business Machines\n"
" * Corporation and others. All Rights Reserved.\n"
" *\n"
" * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT\n"
" * UNLESS YOU REALLY KNOW WHAT YOU'RE DOING.\n"
" *\n"
" *******************************************************************************\n"
" *\n"
" * file name: testdata.cpp\n"
" * created on: 12/14/2000\n"
" * created by: gendata.cpp\n"
" */\n"
"\n"
"#include \"unicode/utypes.h\"\n"
"#include \"unicode/uscript.h\"\n"
"#include \"letest.h\"\n"
"\n";
char *scriptNames[] =
{
@ -109,149 +109,149 @@ UChar devaText[] =
{
0x0936, 0x094d, 0x0930, 0x0940, 0x092e, 0x0926, 0x094d, 0x0020,
0x092d, 0x0917, 0x0935, 0x0926, 0x094d, 0x0917, 0x0940, 0x0924,
0x093e, 0x0020, 0x0905, 0x0927, 0x094d, 0x092f, 0x093e, 0x092f,
0x0020, 0x0905, 0x0930, 0x094d, 0x091c, 0x0941, 0x0928, 0x0020,
0x093e, 0x0020, 0x0905, 0x0927, 0x094d, 0x092f, 0x093e, 0x092f,
0x0020, 0x0905, 0x0930, 0x094d, 0x091c, 0x0941, 0x0928, 0x0020,
0x0935, 0x093f, 0x0937, 0x093e, 0x0926, 0x0020, 0x092f, 0x094b,
0x0917, 0x0020, 0x0927, 0x0943, 0x0924, 0x0930, 0x093e, 0x0937,
0x094d, 0x091f, 0x094d, 0x0930, 0x0020, 0x0909, 0x0935, 0x093E,
0x091A, 0x0943, 0x0020, 0x0927, 0x0930, 0x094d, 0x092e, 0x0915,
0x094d, 0x0937, 0x0947, 0x0924, 0x094d, 0x0930, 0x0947, 0x0020,
0x0917, 0x0020, 0x0927, 0x0943, 0x0924, 0x0930, 0x093e, 0x0937,
0x094d, 0x091f, 0x094d, 0x0930, 0x0020, 0x0909, 0x0935, 0x093E,
0x091A, 0x0943, 0x0020, 0x0927, 0x0930, 0x094d, 0x092e, 0x0915,
0x094d, 0x0937, 0x0947, 0x0924, 0x094d, 0x0930, 0x0947, 0x0020,
0x0915, 0x0941, 0x0930, 0x0941, 0x0915, 0x094d, 0x0937, 0x0947,
0x0924, 0x094d, 0x0930, 0x0947, 0x0020, 0x0938, 0x092e, 0x0935,
0x0947, 0x0924, 0x093e, 0x0020, 0x092f, 0x0941, 0x092f, 0x0941,
0x0924, 0x094d, 0x0938, 0x0935, 0x0903, 0x0020, 0x092e, 0x093e,
0x092e, 0x0915, 0x093e, 0x0903, 0x0020, 0x092a, 0x093e, 0x0923,
0x094d, 0x0921, 0x0935, 0x093e, 0x0936, 0x094d, 0x091a, 0x0948,
0x0935, 0x0020, 0x0915, 0x093f, 0x092e, 0x0915, 0x0941, 0x0930,
0x094d, 0x0935, 0x0924, 0x0020, 0x0938, 0x0902, 0x091c, 0x0935
0x0924, 0x094d, 0x0930, 0x0947, 0x0020, 0x0938, 0x092e, 0x0935,
0x0947, 0x0924, 0x093e, 0x0020, 0x092f, 0x0941, 0x092f, 0x0941,
0x0924, 0x094d, 0x0938, 0x0935, 0x0903, 0x0020, 0x092e, 0x093e,
0x092e, 0x0915, 0x093e, 0x0903, 0x0020, 0x092a, 0x093e, 0x0923,
0x094d, 0x0921, 0x0935, 0x093e, 0x0936, 0x094d, 0x091a, 0x0948,
0x0935, 0x0020, 0x0915, 0x093f, 0x092e, 0x0915, 0x0941, 0x0930,
0x094d, 0x0935, 0x0924, 0x0020, 0x0938, 0x0902, 0x091c, 0x0935
};
int32_t devaTextLength = ARRAY_LENGTH(devaText);
UChar arabText[] =
{
0x0623, 0x0633, 0x0627, 0x0633, 0x064B, 0x0627, 0x060C, 0x0020,
0x062A, 0x062A, 0x0639, 0x0627, 0x0645, 0x0644, 0x0020,
0x0627, 0x0644, 0x062D, 0x0648, 0x0627, 0x0633, 0x064A, 0x0628,
0x0020, 0x0641, 0x0642, 0x0637, 0x0020, 0x0645, 0x0639, 0x0020,
0x0627, 0x0644, 0x0623, 0x0631, 0x0642, 0x0627, 0x0645, 0x060C,
0x0020, 0x0648, 0x062A, 0x0642, 0x0648, 0x0645, 0x0020, 0x0628,
0x062A, 0x062E, 0x0632, 0x064A, 0x0646, 0x0020, 0x0627, 0x0644,
0x0623, 0x062D, 0x0631, 0x0641, 0x0020, 0x0648, 0x0627, 0x0644,
0x0645, 0x062D, 0x0627, 0x0631, 0x0641, 0x0020, 0x0627, 0x0644,
0x0623, 0x062E, 0x0631, 0x0649, 0x0020, 0x0628, 0x0639, 0x062F,
0x0020, 0x0623, 0x0646, 0x0020, 0x062A, 0x064F, 0x0639, 0x0637,
0x064A, 0x0020, 0x0631, 0x0642, 0x0645, 0x0627, 0x0020, 0x0645,
0x0639, 0x064A, 0x0646, 0x0627, 0x0020, 0x0644, 0x0643, 0x0644,
0x0020, 0x0648, 0x0627, 0x062D, 0x062F, 0x0020, 0x0645, 0x0646,
0x0647, 0x0627, 0x002E, 0x0020, 0x0648, 0x0642, 0x0628, 0x0644,
0x0020, 0x0627, 0x062E, 0x062A, 0x0631, 0x0627, 0x0639, 0x0020,
0x0022, 0x064A, 0x0648, 0x0646, 0x0650, 0x0643, 0x0648, 0x062F,
0x0022, 0x060C, 0x0020, 0x0643, 0x0627, 0x0646, 0x0020, 0x0647,
0x0646, 0x0627, 0x0643, 0x0020, 0x0645, 0x0626, 0x0627, 0x062A,
0x0020, 0x0627, 0x0644, 0x0623, 0x0646, 0x0638, 0x0645, 0x0629,
0x0020, 0x0644, 0x0644, 0x062A, 0x0634, 0x0641, 0x064A, 0x0631,
0x0020, 0x0648, 0x062A, 0x062E, 0x0635, 0x064A, 0x0635, 0x0020,
0x0647, 0x0630, 0x0647, 0x0020, 0x0627, 0x0644, 0x0623, 0x0631,
0x0642, 0x0627, 0x0645, 0x0020, 0x0644, 0x0644, 0x0645, 0x062D,
0x0627, 0x0631, 0x0641, 0x060C, 0x0020, 0x0648, 0x0644, 0x0645,
0x0020, 0x064A, 0x0648, 0x062C, 0x062F, 0x0020, 0x0646, 0x0638,
0x0627, 0x0645, 0x0020, 0x062A, 0x0634, 0x0641, 0x064A, 0x0631,
0x0020, 0x0648, 0x0627, 0x062D, 0x062F, 0x0020, 0x064A, 0x062D,
0x062A, 0x0648, 0x064A, 0x0020, 0x0639, 0x0644, 0x0649, 0x0020,
0x062C, 0x0645, 0x064A, 0x0639, 0x0020, 0x0627, 0x0644, 0x0645,
0x062D, 0x0627, 0x0631, 0x0641, 0x0020, 0x0627, 0x0644, 0x0636,
0x0631, 0x0648, 0x0631, 0x064A, 0x0629
/* The next few sentences...
0x002E, 0x0020, 0x0648,
0x0639, 0x0644, 0x0649, 0x0020, 0x0633, 0x0628, 0x064A, 0x0644,
0x0020, 0x0627, 0x0644, 0x0645, 0x062B, 0x0627, 0x0644, 0x060C,
0x0020, 0x0641, 0x0625, 0x0646, 0x0020, 0x0627, 0x0644, 0x0627,
0x062A, 0x062D, 0x0627, 0x062F, 0x0020, 0x0627, 0x0644, 0x0623,
0x0648, 0x0631, 0x0648, 0x0628, 0x064A, 0x0020, 0x0644, 0x0648,
0x062D, 0x062F, 0x0647, 0x060C, 0x0020, 0x0627, 0x062D, 0x062A,
0x0648, 0x0649, 0x0020, 0x0627, 0x0644, 0x0639, 0x062F, 0x064A,
0x062F, 0x0020, 0x0645, 0x0646, 0x0020, 0x0627, 0x0644, 0x0634,
0x0641, 0x0631, 0x0627, 0x062A, 0x0020, 0x0627, 0x0644, 0x0645,
0x062E, 0x062A, 0x0644, 0x0641, 0x0629, 0x0020, 0x0644, 0x064A,
0x063A, 0x0637, 0x064A, 0x0020, 0x062C, 0x0645, 0x064A, 0x0639,
0x0020, 0x0627, 0x0644, 0x0644, 0x063A, 0x0627, 0x062A, 0x0020,
0x0627, 0x0644, 0x0645, 0x0633, 0x062A, 0x062E, 0x062F, 0x0645,
0x0629, 0x0020, 0x0641, 0x064A, 0x0020, 0x0627, 0x0644, 0x0627,
0x062A, 0x062D, 0x0627, 0x062F, 0x002E, 0x0020, 0x0648, 0x062D,
0x062A, 0x0649, 0x0020, 0x0644, 0x0648, 0x0020, 0x0627, 0x0639,
0x062A, 0x0628, 0x0631, 0x0646, 0x0627, 0x0020, 0x0644, 0x063A,
0x0629, 0x0020, 0x0648, 0x0627, 0x062D, 0x062F, 0x0629, 0x060C,
0x0020, 0x0643, 0x0627, 0x0644, 0x0644, 0x063A, 0x0629, 0x0020,
0x0627, 0x0644, 0x0625, 0x0646, 0x062C, 0x0644, 0x064A, 0x0632,
0x064A, 0x0629, 0x060C, 0x0020, 0x0641, 0x0625, 0x0646, 0x0020,
0x062C, 0x062F, 0x0648, 0x0644, 0x0020, 0x0634, 0x0641, 0x0631,
0x0629, 0x0020, 0x0648, 0x0627, 0x062D, 0x062F, 0x0020, 0x0644,
0x0645, 0x0020, 0x064A, 0x0643, 0x0641, 0x0020, 0x0644, 0x0627,
0x0633, 0x062A, 0x064A, 0x0639, 0x0627, 0x0628, 0x0020, 0x062C,
0x0645, 0x064A, 0x0639, 0x0020, 0x0627, 0x0644, 0x0623, 0x062D,
0x0631, 0x0641, 0x0020, 0x0648, 0x0639, 0x0644, 0x0627, 0x0645,
0x0627, 0x062A, 0x0020, 0x0627, 0x0644, 0x062A, 0x0631, 0x0642,
0x064A, 0x0645, 0x0020, 0x0648, 0x0627, 0x0644, 0x0631, 0x0645,
0x0648, 0x0632, 0x0020, 0x0627, 0x0644, 0x0641, 0x0646, 0x064A,
0x0629, 0x0020, 0x0648, 0x0627, 0x0644, 0x0639, 0x0644, 0x0645,
0x064A, 0x0629, 0x0020, 0x0627, 0x0644, 0x0634, 0x0627, 0x0626,
0x0639, 0x0629, 0x0020, 0x0627, 0x0644, 0x0627, 0x0633, 0x062A,
0x0639, 0x0645, 0x0627, 0x0644, 0x002E */
0x0623, 0x0633, 0x0627, 0x0633, 0x064B, 0x0627, 0x060C, 0x0020,
0x062A, 0x062A, 0x0639, 0x0627, 0x0645, 0x0644, 0x0020,
0x0627, 0x0644, 0x062D, 0x0648, 0x0627, 0x0633, 0x064A, 0x0628,
0x0020, 0x0641, 0x0642, 0x0637, 0x0020, 0x0645, 0x0639, 0x0020,
0x0627, 0x0644, 0x0623, 0x0631, 0x0642, 0x0627, 0x0645, 0x060C,
0x0020, 0x0648, 0x062A, 0x0642, 0x0648, 0x0645, 0x0020, 0x0628,
0x062A, 0x062E, 0x0632, 0x064A, 0x0646, 0x0020, 0x0627, 0x0644,
0x0623, 0x062D, 0x0631, 0x0641, 0x0020, 0x0648, 0x0627, 0x0644,
0x0645, 0x062D, 0x0627, 0x0631, 0x0641, 0x0020, 0x0627, 0x0644,
0x0623, 0x062E, 0x0631, 0x0649, 0x0020, 0x0628, 0x0639, 0x062F,
0x0020, 0x0623, 0x0646, 0x0020, 0x062A, 0x064F, 0x0639, 0x0637,
0x064A, 0x0020, 0x0631, 0x0642, 0x0645, 0x0627, 0x0020, 0x0645,
0x0639, 0x064A, 0x0646, 0x0627, 0x0020, 0x0644, 0x0643, 0x0644,
0x0020, 0x0648, 0x0627, 0x062D, 0x062F, 0x0020, 0x0645, 0x0646,
0x0647, 0x0627, 0x002E, 0x0020, 0x0648, 0x0642, 0x0628, 0x0644,
0x0020, 0x0627, 0x062E, 0x062A, 0x0631, 0x0627, 0x0639, 0x0020,
0x0022, 0x064A, 0x0648, 0x0646, 0x0650, 0x0643, 0x0648, 0x062F,
0x0022, 0x060C, 0x0020, 0x0643, 0x0627, 0x0646, 0x0020, 0x0647,
0x0646, 0x0627, 0x0643, 0x0020, 0x0645, 0x0626, 0x0627, 0x062A,
0x0020, 0x0627, 0x0644, 0x0623, 0x0646, 0x0638, 0x0645, 0x0629,
0x0020, 0x0644, 0x0644, 0x062A, 0x0634, 0x0641, 0x064A, 0x0631,
0x0020, 0x0648, 0x062A, 0x062E, 0x0635, 0x064A, 0x0635, 0x0020,
0x0647, 0x0630, 0x0647, 0x0020, 0x0627, 0x0644, 0x0623, 0x0631,
0x0642, 0x0627, 0x0645, 0x0020, 0x0644, 0x0644, 0x0645, 0x062D,
0x0627, 0x0631, 0x0641, 0x060C, 0x0020, 0x0648, 0x0644, 0x0645,
0x0020, 0x064A, 0x0648, 0x062C, 0x062F, 0x0020, 0x0646, 0x0638,
0x0627, 0x0645, 0x0020, 0x062A, 0x0634, 0x0641, 0x064A, 0x0631,
0x0020, 0x0648, 0x0627, 0x062D, 0x062F, 0x0020, 0x064A, 0x062D,
0x062A, 0x0648, 0x064A, 0x0020, 0x0639, 0x0644, 0x0649, 0x0020,
0x062C, 0x0645, 0x064A, 0x0639, 0x0020, 0x0627, 0x0644, 0x0645,
0x062D, 0x0627, 0x0631, 0x0641, 0x0020, 0x0627, 0x0644, 0x0636,
0x0631, 0x0648, 0x0631, 0x064A, 0x0629
/* The next few sentences...
0x002E, 0x0020, 0x0648,
0x0639, 0x0644, 0x0649, 0x0020, 0x0633, 0x0628, 0x064A, 0x0644,
0x0020, 0x0627, 0x0644, 0x0645, 0x062B, 0x0627, 0x0644, 0x060C,
0x0020, 0x0641, 0x0625, 0x0646, 0x0020, 0x0627, 0x0644, 0x0627,
0x062A, 0x062D, 0x0627, 0x062F, 0x0020, 0x0627, 0x0644, 0x0623,
0x0648, 0x0631, 0x0648, 0x0628, 0x064A, 0x0020, 0x0644, 0x0648,
0x062D, 0x062F, 0x0647, 0x060C, 0x0020, 0x0627, 0x062D, 0x062A,
0x0648, 0x0649, 0x0020, 0x0627, 0x0644, 0x0639, 0x062F, 0x064A,
0x062F, 0x0020, 0x0645, 0x0646, 0x0020, 0x0627, 0x0644, 0x0634,
0x0641, 0x0631, 0x0627, 0x062A, 0x0020, 0x0627, 0x0644, 0x0645,
0x062E, 0x062A, 0x0644, 0x0641, 0x0629, 0x0020, 0x0644, 0x064A,
0x063A, 0x0637, 0x064A, 0x0020, 0x062C, 0x0645, 0x064A, 0x0639,
0x0020, 0x0627, 0x0644, 0x0644, 0x063A, 0x0627, 0x062A, 0x0020,
0x0627, 0x0644, 0x0645, 0x0633, 0x062A, 0x062E, 0x062F, 0x0645,
0x0629, 0x0020, 0x0641, 0x064A, 0x0020, 0x0627, 0x0644, 0x0627,
0x062A, 0x062D, 0x0627, 0x062F, 0x002E, 0x0020, 0x0648, 0x062D,
0x062A, 0x0649, 0x0020, 0x0644, 0x0648, 0x0020, 0x0627, 0x0639,
0x062A, 0x0628, 0x0631, 0x0646, 0x0627, 0x0020, 0x0644, 0x063A,
0x0629, 0x0020, 0x0648, 0x0627, 0x062D, 0x062F, 0x0629, 0x060C,
0x0020, 0x0643, 0x0627, 0x0644, 0x0644, 0x063A, 0x0629, 0x0020,
0x0627, 0x0644, 0x0625, 0x0646, 0x062C, 0x0644, 0x064A, 0x0632,
0x064A, 0x0629, 0x060C, 0x0020, 0x0641, 0x0625, 0x0646, 0x0020,
0x062C, 0x062F, 0x0648, 0x0644, 0x0020, 0x0634, 0x0641, 0x0631,
0x0629, 0x0020, 0x0648, 0x0627, 0x062D, 0x062F, 0x0020, 0x0644,
0x0645, 0x0020, 0x064A, 0x0643, 0x0641, 0x0020, 0x0644, 0x0627,
0x0633, 0x062A, 0x064A, 0x0639, 0x0627, 0x0628, 0x0020, 0x062C,
0x0645, 0x064A, 0x0639, 0x0020, 0x0627, 0x0644, 0x0623, 0x062D,
0x0631, 0x0641, 0x0020, 0x0648, 0x0639, 0x0644, 0x0627, 0x0645,
0x0627, 0x062A, 0x0020, 0x0627, 0x0644, 0x062A, 0x0631, 0x0642,
0x064A, 0x0645, 0x0020, 0x0648, 0x0627, 0x0644, 0x0631, 0x0645,
0x0648, 0x0632, 0x0020, 0x0627, 0x0644, 0x0641, 0x0646, 0x064A,
0x0629, 0x0020, 0x0648, 0x0627, 0x0644, 0x0639, 0x0644, 0x0645,
0x064A, 0x0629, 0x0020, 0x0627, 0x0644, 0x0634, 0x0627, 0x0626,
0x0639, 0x0629, 0x0020, 0x0627, 0x0644, 0x0627, 0x0633, 0x062A,
0x0639, 0x0645, 0x0627, 0x0644, 0x002E */
};
int32_t arabTextLength = ARRAY_LENGTH(arabText);
UChar thaiSample[] =
{
0x0E1A, 0x0E17, 0x0E17, 0x0E35, 0x0E48, 0x0E51, 0x0E1E, 0x0E32,
0x0E22, 0x0E38, 0x0E44, 0x0E0B, 0x0E42, 0x0E04, 0x0E25, 0x0E19,
0x0E42, 0x0E14, 0x0E42, 0x0E23, 0x0E18, 0x0E35, 0x0E2D, 0x0E32,
0x0E28, 0x0E31, 0x0E22, 0x0E2D, 0x0E22, 0x0E39, 0x0E48, 0x0E17,
0x0E48, 0x0E32, 0x0E21, 0x0E01, 0x0E25, 0x0E32, 0x0E07, 0x0E17,
0x0E38, 0x0E48, 0x0E07, 0x0E43, 0x0E2B, 0x0E0D, 0x0E48, 0x0E43,
0x0E19, 0x0E41, 0x0E04, 0x0E19, 0x0E0B, 0x0E31, 0x0E2A, 0x0E01,
0x0E31, 0x0E1A, 0x0E25, 0x0E38, 0x0E07, 0x0E40, 0x0E2E, 0x0E19,
0x0E23, 0x0E35, 0x0E0A, 0x0E32, 0x0E27, 0x0E44, 0x0E23, 0x0E48,
0x0E41, 0x0E25, 0x0E30, 0x0E1B, 0x0E49, 0x0E32, 0x0E40, 0x0E2D,
0x0E47, 0x0E21, 0x0E20, 0x0E23, 0x0E23, 0x0E22, 0x0E32, 0x0E0A,
0x0E32, 0x0E27, 0x0E44, 0x0E23, 0x0E48, 0x0E1A, 0x0E49, 0x0E32,
0x0E19, 0x0E02, 0x0E2D, 0x0E07, 0x0E1E, 0x0E27, 0x0E01, 0x0E40,
0x0E02, 0x0E32, 0x0E2B, 0x0E25, 0x0E31, 0x0E07, 0x0E40, 0x0E25,
0x0E47, 0x0E01, 0x0E40, 0x0E1E, 0x0E23, 0x0E32, 0x0E30, 0x0E44,
0x0E21, 0x0E49, 0x0E2A, 0x0E23, 0x0E49, 0x0E32, 0x0E07, 0x0E1A,
0x0E49, 0x0E32, 0x0E19, 0x0E15, 0x0E49, 0x0E2D, 0x0E07, 0x0E02,
0x0E19, 0x0E21, 0x0E32, 0x0E14, 0x0E49, 0x0E27, 0x0E22, 0x0E40,
0x0E01, 0x0E27, 0x0E35, 0x0E22, 0x0E19, 0x0E40, 0x0E1B, 0x0E47,
0x0E19, 0x0E23, 0x0E30, 0x0E22, 0x0E30, 0x0E17, 0x0E32, 0x0E07,
0x0E2B, 0x0E25, 0x0E32, 0x0E22, 0x0E44, 0x0E21, 0x0E25, 0x0E4C
/* A few more lines...
0x0E1A, 0x0E49, 0x0E32, 0x0E19, 0x0E21, 0x0E35, 0x0E2A, 0x0E35,
0x0E48, 0x0E1D, 0x0E32, 0x0E21, 0x0E35, 0x0E1E, 0x0E37, 0x0E49,
0x0E19, 0x0E01, 0x0E31, 0x0E1A, 0x0E2B, 0x0E25, 0x0E31, 0x0E07,
0x0E04, 0x0E32, 0x0E23, 0x0E27, 0x0E21, 0x0E17, 0x0E33, 0x0E40,
0x0E1B, 0x0E47, 0x0E19, 0x0E2B, 0x0E49, 0x0E2D, 0x0E07, 0x0E40,
0x0E14, 0x0E35, 0x0E22, 0x0E27, 0x0E43, 0x0E19, 0x0E2B, 0x0E49,
0x0E2D, 0x0E07, 0x0E21, 0x0E35, 0x0E17, 0x0E31, 0x0E49, 0x0E07,
0x0E40, 0x0E15, 0x0E32, 0x0E2B, 0x0E38, 0x0E07, 0x0E15, 0x0E49,
0x0E21, 0x0E17, 0x0E35, 0x0E48, 0x0E2A, 0x0E19, 0x0E34, 0x0E21,
0x0E14, 0x0E39, 0x0E02, 0x0E36, 0x0E49, 0x0E19, 0x0E40, 0x0E25,
0x0E2D, 0x0E30, 0x0E21, 0x0E35, 0x0E15, 0x0E39, 0x0E49, 0x0E43,
0x0E2A, 0x0E48, 0x0E16, 0x0E49, 0x0E27, 0x0E22, 0x0E0A, 0x0E32,
0x0E21, 0x0E42, 0x0E15, 0x0E4A, 0x0E30, 0x0E40, 0x0E01, 0x0E49,
0x0E32, 0x0E2D, 0x0E35, 0x0E49, 0x0E2A, 0x0E32, 0x0E21, 0x0E2B,
0x0E23
*/
0x0E1A, 0x0E17, 0x0E17, 0x0E35, 0x0E48, 0x0E51, 0x0E1E, 0x0E32,
0x0E22, 0x0E38, 0x0E44, 0x0E0B, 0x0E42, 0x0E04, 0x0E25, 0x0E19,
0x0E42, 0x0E14, 0x0E42, 0x0E23, 0x0E18, 0x0E35, 0x0E2D, 0x0E32,
0x0E28, 0x0E31, 0x0E22, 0x0E2D, 0x0E22, 0x0E39, 0x0E48, 0x0E17,
0x0E48, 0x0E32, 0x0E21, 0x0E01, 0x0E25, 0x0E32, 0x0E07, 0x0E17,
0x0E38, 0x0E48, 0x0E07, 0x0E43, 0x0E2B, 0x0E0D, 0x0E48, 0x0E43,
0x0E19, 0x0E41, 0x0E04, 0x0E19, 0x0E0B, 0x0E31, 0x0E2A, 0x0E01,
0x0E31, 0x0E1A, 0x0E25, 0x0E38, 0x0E07, 0x0E40, 0x0E2E, 0x0E19,
0x0E23, 0x0E35, 0x0E0A, 0x0E32, 0x0E27, 0x0E44, 0x0E23, 0x0E48,
0x0E41, 0x0E25, 0x0E30, 0x0E1B, 0x0E49, 0x0E32, 0x0E40, 0x0E2D,
0x0E47, 0x0E21, 0x0E20, 0x0E23, 0x0E23, 0x0E22, 0x0E32, 0x0E0A,
0x0E32, 0x0E27, 0x0E44, 0x0E23, 0x0E48, 0x0E1A, 0x0E49, 0x0E32,
0x0E19, 0x0E02, 0x0E2D, 0x0E07, 0x0E1E, 0x0E27, 0x0E01, 0x0E40,
0x0E02, 0x0E32, 0x0E2B, 0x0E25, 0x0E31, 0x0E07, 0x0E40, 0x0E25,
0x0E47, 0x0E01, 0x0E40, 0x0E1E, 0x0E23, 0x0E32, 0x0E30, 0x0E44,
0x0E21, 0x0E49, 0x0E2A, 0x0E23, 0x0E49, 0x0E32, 0x0E07, 0x0E1A,
0x0E49, 0x0E32, 0x0E19, 0x0E15, 0x0E49, 0x0E2D, 0x0E07, 0x0E02,
0x0E19, 0x0E21, 0x0E32, 0x0E14, 0x0E49, 0x0E27, 0x0E22, 0x0E40,
0x0E01, 0x0E27, 0x0E35, 0x0E22, 0x0E19, 0x0E40, 0x0E1B, 0x0E47,
0x0E19, 0x0E23, 0x0E30, 0x0E22, 0x0E30, 0x0E17, 0x0E32, 0x0E07,
0x0E2B, 0x0E25, 0x0E32, 0x0E22, 0x0E44, 0x0E21, 0x0E25, 0x0E4C
/* A few more lines...
0x0E1A, 0x0E49, 0x0E32, 0x0E19, 0x0E21, 0x0E35, 0x0E2A, 0x0E35,
0x0E48, 0x0E1D, 0x0E32, 0x0E21, 0x0E35, 0x0E1E, 0x0E37, 0x0E49,
0x0E19, 0x0E01, 0x0E31, 0x0E1A, 0x0E2B, 0x0E25, 0x0E31, 0x0E07,
0x0E04, 0x0E32, 0x0E23, 0x0E27, 0x0E21, 0x0E17, 0x0E33, 0x0E40,
0x0E1B, 0x0E47, 0x0E19, 0x0E2B, 0x0E49, 0x0E2D, 0x0E07, 0x0E40,
0x0E14, 0x0E35, 0x0E22, 0x0E27, 0x0E43, 0x0E19, 0x0E2B, 0x0E49,
0x0E2D, 0x0E07, 0x0E21, 0x0E35, 0x0E17, 0x0E31, 0x0E49, 0x0E07,
0x0E40, 0x0E15, 0x0E32, 0x0E2B, 0x0E38, 0x0E07, 0x0E15, 0x0E49,
0x0E21, 0x0E17, 0x0E35, 0x0E48, 0x0E2A, 0x0E19, 0x0E34, 0x0E21,
0x0E14, 0x0E39, 0x0E02, 0x0E36, 0x0E49, 0x0E19, 0x0E40, 0x0E25,
0x0E2D, 0x0E30, 0x0E21, 0x0E35, 0x0E15, 0x0E39, 0x0E49, 0x0E43,
0x0E2A, 0x0E48, 0x0E16, 0x0E49, 0x0E27, 0x0E22, 0x0E0A, 0x0E32,
0x0E21, 0x0E42, 0x0E15, 0x0E4A, 0x0E30, 0x0E40, 0x0E01, 0x0E49,
0x0E32, 0x0E2D, 0x0E35, 0x0E49, 0x0E2A, 0x0E32, 0x0E21, 0x0E2B,
0x0E23
*/
};
int32_t thaiSampleLength = ARRAY_LENGTH(thaiSample);
TestInput testInputs[] = {
{"Devamt.ttf", devaText, devaTextLength, USCRIPT_DEVANAGARI, false},
{"Times.TTF", arabText, arabTextLength, USCRIPT_ARABIC, true},
{"LucidaSansRegular.ttf", arabText, arabTextLength, USCRIPT_ARABIC, true},
{"Thonburi.ttf", thaiSample, thaiSampleLength, USCRIPT_THAI, false}
{"Devamt.ttf", devaText, devaTextLength, USCRIPT_DEVANAGARI, false},
{"Times.TTF", arabText, arabTextLength, USCRIPT_ARABIC, true},
{"LucidaSansRegular.ttf", arabText, arabTextLength, USCRIPT_ARABIC, true},
{"Thonburi.ttf", thaiSample, thaiSampleLength, USCRIPT_THAI, false}
};
#define TEST_COUNT ARRAY_LENGTH(testInputs)
@ -259,150 +259,150 @@ TestInput testInputs[] = {
int32_t testCount = TEST_COUNT;
void dumpShorts(FILE *file, char *label, int32_t id, uint16_t *shorts, int32_t count) {
char lineBuffer[8 * 8 + 2];
int32_t bufp = 0;
char lineBuffer[8 * 8 + 2];
int32_t bufp = 0;
fprintf(file, label, id);
fprintf(file, label, id);
for (int i = 0; i < count; i += 1) {
if (i % 8 == 0 && bufp != 0) {
fprintf(file, " %s\n", lineBuffer);
bufp = 0;
}
bufp += sprintf(&lineBuffer[bufp], "0x%4.4X, ", shorts[i]);
}
for (int i = 0; i < count; i += 1) {
if (i % 8 == 0 && bufp != 0) {
fprintf(file, " %s\n", lineBuffer);
bufp = 0;
}
if (bufp != 0) {
lineBuffer[bufp - 2] = '\0';
fprintf(file, " %s\n", lineBuffer);
}
bufp += sprintf(&lineBuffer[bufp], "0x%4.4X, ", shorts[i]);
}
fprintf(file, "};\n\n");
if (bufp != 0) {
lineBuffer[bufp - 2] = '\0';
fprintf(file, " %s\n", lineBuffer);
}
fprintf(file, "};\n\n");
}
void dumpLongs(FILE *file, char *label, int32_t id, int32_t *longs, int32_t count) {
char lineBuffer[8 * 12 + 2];
int32_t bufp = 0;
char lineBuffer[8 * 12 + 2];
int32_t bufp = 0;
fprintf(file, label, id);
fprintf(file, label, id);
for (int i = 0; i < count; i += 1) {
if (i % 8 == 0 && bufp != 0) {
fprintf(file, " %s\n", lineBuffer);
bufp = 0;
}
bufp += sprintf(&lineBuffer[bufp], "0x%8.8X, ", longs[i]);
}
for (int i = 0; i < count; i += 1) {
if (i % 8 == 0 && bufp != 0) {
fprintf(file, " %s\n", lineBuffer);
bufp = 0;
}
if (bufp != 0) {
lineBuffer[bufp - 2] = '\0';
fprintf(file, " %s\n", lineBuffer);
}
bufp += sprintf(&lineBuffer[bufp], "0x%8.8X, ", longs[i]);
}
fprintf(file, "};\n\n");
if (bufp != 0) {
lineBuffer[bufp - 2] = '\0';
fprintf(file, " %s\n", lineBuffer);
}
fprintf(file, "};\n\n");
}
void dumpFloats(FILE *file, char *label, int32_t id, float *floats, int32_t count) {
char lineBuffer[8 * 16 + 2];
int32_t bufp = 0;
char lineBuffer[8 * 16 + 2];
int32_t bufp = 0;
fprintf(file, label, id);
fprintf(file, label, id);
for (int i = 0; i < count; i += 1) {
if (i % 8 == 0 && bufp != 0) {
fprintf(file, " %s\n", lineBuffer);
bufp = 0;
}
bufp += sprintf(&lineBuffer[bufp], "%fF, ", floats[i]);
}
for (int i = 0; i < count; i += 1) {
if (i % 8 == 0 && bufp != 0) {
fprintf(file, " %s\n", lineBuffer);
bufp = 0;
}
if (bufp != 0) {
lineBuffer[bufp - 2] = '\0';
fprintf(file, " %s\n", lineBuffer);
}
bufp += sprintf(&lineBuffer[bufp], "%fF, ", floats[i]);
}
fprintf(file, "};\n\n");
if (bufp != 0) {
lineBuffer[bufp - 2] = '\0';
fprintf(file, " %s\n", lineBuffer);
}
fprintf(file, "};\n\n");
}
int main(int argc, char *argv[])
{
Locale dummyLocale;
int32_t test;
FILE *outputFile = fopen(argv[1], "w");
Locale dummyLocale;
int32_t test;
FILE *outputFile = fopen(argv[1], "w");
fprintf(outputFile, header);
fprintf(outputFile, header);
for (test = 0; test < testCount; test += 1) {
for (test = 0; test < testCount; test += 1) {
PFIErrorCode fontStatus = PFI_NO_ERROR;
PortableFontInstance fontInstance(testInputs[test].fontName, 12, fontStatus);
PortableFontInstance fontInstance(testInputs[test].fontName, 12, fontStatus);
if (LE_FAILURE(fontStatus)) {
printf("ERROR: test case %d, could not get a font instance for %s\n", test, testInputs[test].fontName);
continue;
}
UErrorCode success = U_ZERO_ERROR;
ICULayoutEngine *engine = ICULayoutEngine::createInstance(&fontInstance, testInputs[test].scriptCode, dummyLocale, success);
uint32_t glyphCount;
uint16_t *glyphs;
int32_t *indices;
float *positions;
UErrorCode success = U_ZERO_ERROR;
ICULayoutEngine *engine = ICULayoutEngine::createInstance(&fontInstance, testInputs[test].scriptCode, dummyLocale, success);
uint32_t glyphCount;
uint16_t *glyphs;
int32_t *indices;
float *positions;
if (LE_FAILURE(success)) {
printf("ERROR: test case %d, could not create a LayoutEngine for script %s.\n", test, scriptNames[testInputs[test].scriptCode]);
continue;
}
glyphCount = engine->layoutChars(testInputs[test].text, 0, testInputs[test].textLength, testInputs[test].textLength, testInputs[test].rightToLeft, 0, 0, success);
glyphCount = engine->layoutChars(testInputs[test].text, 0, testInputs[test].textLength, testInputs[test].textLength, testInputs[test].rightToLeft, 0, 0, success);
glyphs = new uint16_t[glyphCount];
indices = new int32_t[glyphCount];
positions = new float[glyphCount * 2 + 2];
glyphs = new uint16_t[glyphCount];
indices = new int32_t[glyphCount];
positions = new float[glyphCount * 2 + 2];
engine->getGlyphs(glyphs, success);
engine->getCharIndices(indices, success);
engine->getGlyphPositions(positions, success);
engine->getGlyphs(glyphs, success);
engine->getCharIndices(indices, success);
engine->getGlyphPositions(positions, success);
//fprintf(outputFile, "font: %s\n", testInputs[test].fontName);
dumpShorts(outputFile, "UChar inputText%d[] =\n{\n", test, testInputs[test].text, testInputs[test].textLength);
//fprintf(outputFile, "font: %s\n", testInputs[test].fontName);
dumpShorts(outputFile, "UChar inputText%d[] =\n{\n", test, testInputs[test].text, testInputs[test].textLength);
dumpShorts(outputFile, "uint16_t resultGlyphs%d[] =\n{\n", test, glyphs, glyphCount);
fprintf(outputFile, "int32_t resultGlyphCount%d = %d;\n\n", test, glyphCount);
dumpShorts(outputFile, "uint16_t resultGlyphs%d[] =\n{\n", test, glyphs, glyphCount);
fprintf(outputFile, "int32_t resultGlyphCount%d = %d;\n\n", test, glyphCount);
dumpLongs(outputFile, "int32_t resultIndices%d[] =\n{\n", test, indices, glyphCount);
dumpLongs(outputFile, "int32_t resultIndices%d[] =\n{\n", test, indices, glyphCount);
dumpFloats(outputFile, "float resultPositions%d[] =\n{\n", test, positions, glyphCount * 2 + 2);
dumpFloats(outputFile, "float resultPositions%d[] =\n{\n", test, positions, glyphCount * 2 + 2);
fprintf(outputFile, "\n");
delete[] positions;
delete[] indices;
delete[] glyphs;
delete engine;
}
fprintf(outputFile, "\n");
fprintf(outputFile, "TestInput testInputs[] = \n{\n");
delete[] positions;
delete[] indices;
delete[] glyphs;
delete engine;
}
for (test = 0; test < testCount; test += 1) {
fprintf(outputFile, " {\"%s\", inputText%d, %d, %s, %s},\n",
testInputs[test].fontName, test, testInputs[test].textLength, scriptNames[testInputs[test].scriptCode],
testInputs[test].rightToLeft? "true" : "false");
}
fprintf(outputFile, "TestInput testInputs[] = \n{\n");
fprintf(outputFile, "};\n\nint32_t testCount = ARRAY_LENGTH(testInputs);\n\n");
for (test = 0; test < testCount; test += 1) {
fprintf(outputFile, " {\"%s\", inputText%d, %d, %s, %s},\n",
testInputs[test].fontName, test, testInputs[test].textLength, scriptNames[testInputs[test].scriptCode],
testInputs[test].rightToLeft? "true" : "false");
}
fprintf(outputFile, "TestResult testResults[] = \n{\n");
fprintf(outputFile, "};\n\nint32_t testCount = ARRAY_LENGTH(testInputs);\n\n");
for (test = 0; test < testCount; test += 1) {
fprintf(outputFile, " {resultGlyphCount%d, resultGlyphs%d, resultIndices%d, resultPositions%d},\n",
test, test, test, test);
}
fprintf(outputFile, "TestResult testResults[] = \n{\n");
fprintf(outputFile, "};\n\n");
for (test = 0; test < testCount; test += 1) {
fprintf(outputFile, " {resultGlyphCount%d, resultGlyphs%d, resultIndices%d, resultPositions%d},\n",
test, test, test, test);
}
fclose(outputFile);
return 0;
fprintf(outputFile, "};\n\n");
fclose(outputFile);
return 0;
}

View file

@ -10,7 +10,6 @@
#include <string.h>
#include "unicode/utypes.h"
#include "unicode/unicode.h"
#include "unicode/uchar.h"
#include "unicode/uchriter.h"
#include "unicode/brkiter.h"