From f91e2604fcd5bcdfadb436e63e6a682ad58969a8 Mon Sep 17 00:00:00 2001 From: "smontagu%smontagu.org" Date: Tue, 18 May 2004 11:01:49 +0000 Subject: [PATCH] Update bidi data tables to Unicode 4.0.1 and add surrogate handling. Bug 240943, r=jshin, sr=rbs. git-svn-id: svn://10.0.0.236/trunk@156524 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/shared/public/nsBidiUtils.h | 4 +- mozilla/content/shared/src/nsTextFragment.cpp | 12 +- mozilla/layout/base/bidicattable.h | 679 +++++++++++++++--- mozilla/layout/base/nsBidi.cpp | 16 +- mozilla/layout/base/nsBidi.h | 20 +- mozilla/layout/base/nsBidiPresUtils.cpp | 4 +- mozilla/layout/base/nsBidiUtils.h | 4 +- mozilla/layout/base/public/nsBidi.h | 20 +- mozilla/layout/base/src/bidicattable.h | 679 +++++++++++++++--- mozilla/layout/base/src/nsBidi.cpp | 16 +- mozilla/layout/base/src/nsBidiPresUtils.cpp | 4 +- mozilla/layout/tools/genbidicattable.pl | 134 ++-- .../layout/xul/base/src/nsTextBoxFrame.cpp | 8 +- 13 files changed, 1336 insertions(+), 264 deletions(-) diff --git a/mozilla/content/shared/public/nsBidiUtils.h b/mozilla/content/shared/public/nsBidiUtils.h index 1cb135f6127..9e7b6f98085 100644 --- a/mozilla/content/shared/public/nsBidiUtils.h +++ b/mozilla/content/shared/public/nsBidiUtils.h @@ -233,7 +233,9 @@ #define IS_ARABIC_CHAR(c) ((0x0600 <= (c)) && ((c)<= 0x06FF)) #define IS_ARABIC_ALPHABETIC(c) (IS_ARABIC_CHAR(c) && \ !(IS_HINDI_DIGIT(c) || IS_FARSI_DIGIT(c) || IS_ARABIC_SEPARATOR(c))) +#define IS_CYPRIOT_CHAR(c) ((0x10800 <= (c)) && ((c) <=0x1083F)) #define CHAR_IS_BIDI(c) ( (IS_HINDI_DIGIT(c) ) || (IS_HEBREW_CHAR(c) ) \ - || (IS_06_CHAR(c) ) || (IS_FE_CHAR(c) ) ) + || (IS_06_CHAR(c) ) || (IS_FE_CHAR(c) ) \ + || (IS_CYPRIOT_CHAR(c) ) ) #endif /* nsBidiUtils_h__ */ diff --git a/mozilla/content/shared/src/nsTextFragment.cpp b/mozilla/content/shared/src/nsTextFragment.cpp index f3627d1c745..c770e454d8f 100644 --- a/mozilla/content/shared/src/nsTextFragment.cpp +++ b/mozilla/content/shared/src/nsTextFragment.cpp @@ -40,6 +40,7 @@ #include "nsReadableUtils.h" #include "nsMemory.h" #include "nsBidiUtils.h" +#include "nsUnicharUtils.h" // Static buffer used for newline fragments static unsigned char sNewLineCharacter = '\n'; @@ -350,8 +351,15 @@ nsTextFragment::SetBidiFlag() const PRUnichar* cp = m2b; const PRUnichar* end = cp + mState.mLength; while (cp < end) { - PRUnichar ch = *cp++; - if (CHAR_IS_BIDI(ch) ) { + PRUnichar ch1 = *cp++; + PRUint32 utf32Char = ch1; + if (IS_HIGH_SURROGATE(ch1) && + cp < end && + IS_LOW_SURROGATE(*cp)) { + PRUnichar ch2 = *cp++; + utf32Char = SURROGATE_TO_UCS4(ch1, ch2); + } + if (CHAR_IS_BIDI(utf32Char) ) { mState.mIsBidi = PR_TRUE; break; } diff --git a/mozilla/layout/base/bidicattable.h b/mozilla/layout/base/bidicattable.h index 3083e59d72d..55ad0484dc7 100644 --- a/mozilla/layout/base/bidicattable.h +++ b/mozilla/layout/base/bidicattable.h @@ -1,20 +1,40 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- * - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "MPL"); you may not use this file except in - * compliance with the MPL. You may obtain a copy of the MPL at + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * - * Software distributed under the MPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the - * MPL. + * License. * - * The Initial Developer of the Original Code is IBM - * Corporation. Portions created by IBM are - * Copyright (C) 2000 IBM Corporation. All - * Rights Reserved. - */ + * The Original Code is mozilla.org Code. + * + * The Initial Developer of the Original Code is + * IBM Corporation. + * Portions created by the Initial Developer are Copyright (C) 2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ /* DO NOT EDIT THIS DOCUMENT !!! THIS DOCUMENT IS GENERATED BY mozilla/layout/tools/genbidicattable.pl @@ -272,14 +292,14 @@ static PRUint8 gBidiCatIdx1[256] = { 10, /* U+07A8 - U+07AF : 0xAAAAAAAA */ 48, /* U+07B0 - U+07B7 : 0x3333333A */ 3, /* U+07B8 - U+07BF : 0x33333333 */ - 1, /* U+07C0 - U+07C7 : 0x11111111 */ - 1, /* U+07C8 - U+07CF : 0x11111111 */ - 1, /* U+07D0 - U+07D7 : 0x11111111 */ - 1, /* U+07D8 - U+07DF : 0x11111111 */ - 1, /* U+07E0 - U+07E7 : 0x11111111 */ - 1, /* U+07E8 - U+07EF : 0x11111111 */ - 1, /* U+07F0 - U+07F7 : 0x11111111 */ - 1, /* U+07F8 - U+07FF : 0x11111111 */ + 2, /* U+07C0 - U+07C7 : 0x22222222 */ + 2, /* U+07C8 - U+07CF : 0x22222222 */ + 2, /* U+07D0 - U+07D7 : 0x22222222 */ + 2, /* U+07D8 - U+07DF : 0x22222222 */ + 2, /* U+07E0 - U+07E7 : 0x22222222 */ + 2, /* U+07E8 - U+07EF : 0x22222222 */ + 2, /* U+07F0 - U+07F7 : 0x22222222 */ + 2, /* U+07F8 - U+07FF : 0x22222222 */ }; static PRUint8 gBidiCatIdx2[544] = { @@ -1665,7 +1685,7 @@ static PRUint8 gBidiCatIdx6[160] = { 1, /* U+A4F8 - U+A4FF : 0x11111111 */ }; -static PRUint8 gBidiCatIdx7[224] = { +static PRUint8 gBidiCatIdx7[264] = { 1, /* U+F900 - U+F907 : 0x11111111 */ 1, /* U+F908 - U+F90F : 0x11111111 */ 1, /* U+F910 - U+F917 : 0x11111111 */ @@ -1820,10 +1840,10 @@ static PRUint8 gBidiCatIdx7[224] = { 3, /* U+FDB8 - U+FDBF : 0x33333333 */ 3, /* U+FDC0 - U+FDC7 : 0x33333333 */ 3, /* U+FDC8 - U+FDCF : 0x33333333 */ - 3, /* U+FDD0 - U+FDD7 : 0x33333333 */ - 3, /* U+FDD8 - U+FDDF : 0x33333333 */ - 3, /* U+FDE0 - U+FDE7 : 0x33333333 */ - 3, /* U+FDE8 - U+FDEF : 0x33333333 */ + 1, /* U+FDD0 - U+FDD7 : 0x11111111 */ + 1, /* U+FDD8 - U+FDDF : 0x11111111 */ + 1, /* U+FDE0 - U+FDE7 : 0x11111111 */ + 1, /* U+FDE8 - U+FDEF : 0x11111111 */ 3, /* U+FDF0 - U+FDF7 : 0x33333333 */ 145, /* U+FDF8 - U+FDFF : 0x33933333 */ 10, /* U+FE00 - U+FE07 : 0xAAAAAAAA */ @@ -1890,9 +1910,495 @@ static PRUint8 gBidiCatIdx7[224] = { 127, /* U+FFE8 - U+FFEF : 0x19999999 */ 1, /* U+FFF0 - U+FFF7 : 0x11111111 */ 153, /* U+FFF8 - U+FFFF : 0x11999991 */ + 1, /* U+10000 - U+10007 : 0x11111111 */ + 1, /* U+10008 - U+1000F : 0x11111111 */ + 1, /* U+10010 - U+10017 : 0x11111111 */ + 1, /* U+10018 - U+1001F : 0x11111111 */ + 1, /* U+10020 - U+10027 : 0x11111111 */ + 1, /* U+10028 - U+1002F : 0x11111111 */ + 1, /* U+10030 - U+10037 : 0x11111111 */ + 1, /* U+10038 - U+1003F : 0x11111111 */ + 1, /* U+10040 - U+10047 : 0x11111111 */ + 1, /* U+10048 - U+1004F : 0x11111111 */ + 1, /* U+10050 - U+10057 : 0x11111111 */ + 1, /* U+10058 - U+1005F : 0x11111111 */ + 1, /* U+10060 - U+10067 : 0x11111111 */ + 1, /* U+10068 - U+1006F : 0x11111111 */ + 1, /* U+10070 - U+10077 : 0x11111111 */ + 1, /* U+10078 - U+1007F : 0x11111111 */ + 1, /* U+10080 - U+10087 : 0x11111111 */ + 1, /* U+10088 - U+1008F : 0x11111111 */ + 1, /* U+10090 - U+10097 : 0x11111111 */ + 1, /* U+10098 - U+1009F : 0x11111111 */ + 1, /* U+100A0 - U+100A7 : 0x11111111 */ + 1, /* U+100A8 - U+100AF : 0x11111111 */ + 1, /* U+100B0 - U+100B7 : 0x11111111 */ + 1, /* U+100B8 - U+100BF : 0x11111111 */ + 1, /* U+100C0 - U+100C7 : 0x11111111 */ + 1, /* U+100C8 - U+100CF : 0x11111111 */ + 1, /* U+100D0 - U+100D7 : 0x11111111 */ + 1, /* U+100D8 - U+100DF : 0x11111111 */ + 1, /* U+100E0 - U+100E7 : 0x11111111 */ + 1, /* U+100E8 - U+100EF : 0x11111111 */ + 1, /* U+100F0 - U+100F7 : 0x11111111 */ + 1, /* U+100F8 - U+100FF : 0x11111111 */ + 154, /* U+10100 - U+10107 : 0x11111191 */ + 1, /* U+10108 - U+1010F : 0x11111111 */ + 1, /* U+10110 - U+10117 : 0x11111111 */ + 1, /* U+10118 - U+1011F : 0x11111111 */ + 1, /* U+10120 - U+10127 : 0x11111111 */ + 1, /* U+10128 - U+1012F : 0x11111111 */ + 1, /* U+10130 - U+10137 : 0x11111111 */ + 1, /* U+10138 - U+1013F : 0x11111111 */ }; -static PRUint32 gBidiCatPat[154] = { +static PRUint8 gBidiCatIdx8[64] = { + 1, /* U+10300 - U+10307 : 0x11111111 */ + 1, /* U+10308 - U+1030F : 0x11111111 */ + 1, /* U+10310 - U+10317 : 0x11111111 */ + 1, /* U+10318 - U+1031F : 0x11111111 */ + 1, /* U+10320 - U+10327 : 0x11111111 */ + 1, /* U+10328 - U+1032F : 0x11111111 */ + 1, /* U+10330 - U+10337 : 0x11111111 */ + 1, /* U+10338 - U+1033F : 0x11111111 */ + 1, /* U+10340 - U+10347 : 0x11111111 */ + 1, /* U+10348 - U+1034F : 0x11111111 */ + 1, /* U+10350 - U+10357 : 0x11111111 */ + 1, /* U+10358 - U+1035F : 0x11111111 */ + 1, /* U+10360 - U+10367 : 0x11111111 */ + 1, /* U+10368 - U+1036F : 0x11111111 */ + 1, /* U+10370 - U+10377 : 0x11111111 */ + 1, /* U+10378 - U+1037F : 0x11111111 */ + 1, /* U+10380 - U+10387 : 0x11111111 */ + 1, /* U+10388 - U+1038F : 0x11111111 */ + 1, /* U+10390 - U+10397 : 0x11111111 */ + 1, /* U+10398 - U+1039F : 0x11111111 */ + 1, /* U+103A0 - U+103A7 : 0x11111111 */ + 1, /* U+103A8 - U+103AF : 0x11111111 */ + 1, /* U+103B0 - U+103B7 : 0x11111111 */ + 1, /* U+103B8 - U+103BF : 0x11111111 */ + 1, /* U+103C0 - U+103C7 : 0x11111111 */ + 1, /* U+103C8 - U+103CF : 0x11111111 */ + 1, /* U+103D0 - U+103D7 : 0x11111111 */ + 1, /* U+103D8 - U+103DF : 0x11111111 */ + 1, /* U+103E0 - U+103E7 : 0x11111111 */ + 1, /* U+103E8 - U+103EF : 0x11111111 */ + 1, /* U+103F0 - U+103F7 : 0x11111111 */ + 1, /* U+103F8 - U+103FF : 0x11111111 */ + 1, /* U+10400 - U+10407 : 0x11111111 */ + 1, /* U+10408 - U+1040F : 0x11111111 */ + 1, /* U+10410 - U+10417 : 0x11111111 */ + 1, /* U+10418 - U+1041F : 0x11111111 */ + 1, /* U+10420 - U+10427 : 0x11111111 */ + 1, /* U+10428 - U+1042F : 0x11111111 */ + 1, /* U+10430 - U+10437 : 0x11111111 */ + 1, /* U+10438 - U+1043F : 0x11111111 */ + 1, /* U+10440 - U+10447 : 0x11111111 */ + 1, /* U+10448 - U+1044F : 0x11111111 */ + 1, /* U+10450 - U+10457 : 0x11111111 */ + 1, /* U+10458 - U+1045F : 0x11111111 */ + 1, /* U+10460 - U+10467 : 0x11111111 */ + 1, /* U+10468 - U+1046F : 0x11111111 */ + 1, /* U+10470 - U+10477 : 0x11111111 */ + 1, /* U+10478 - U+1047F : 0x11111111 */ + 1, /* U+10480 - U+10487 : 0x11111111 */ + 1, /* U+10488 - U+1048F : 0x11111111 */ + 1, /* U+10490 - U+10497 : 0x11111111 */ + 1, /* U+10498 - U+1049F : 0x11111111 */ + 1, /* U+104A0 - U+104A7 : 0x11111111 */ + 1, /* U+104A8 - U+104AF : 0x11111111 */ + 1, /* U+104B0 - U+104B7 : 0x11111111 */ + 1, /* U+104B8 - U+104BF : 0x11111111 */ + 1, /* U+104C0 - U+104C7 : 0x11111111 */ + 1, /* U+104C8 - U+104CF : 0x11111111 */ + 1, /* U+104D0 - U+104D7 : 0x11111111 */ + 1, /* U+104D8 - U+104DF : 0x11111111 */ + 1, /* U+104E0 - U+104E7 : 0x11111111 */ + 1, /* U+104E8 - U+104EF : 0x11111111 */ + 1, /* U+104F0 - U+104F7 : 0x11111111 */ + 1, /* U+104F8 - U+104FF : 0x11111111 */ +}; + +static PRUint8 gBidiCatIdx9[8] = { + 2, /* U+10800 - U+10807 : 0x22222222 */ + 2, /* U+10808 - U+1080F : 0x22222222 */ + 2, /* U+10810 - U+10817 : 0x22222222 */ + 2, /* U+10818 - U+1081F : 0x22222222 */ + 2, /* U+10820 - U+10827 : 0x22222222 */ + 2, /* U+10828 - U+1082F : 0x22222222 */ + 2, /* U+10830 - U+10837 : 0x22222222 */ + 2, /* U+10838 - U+1083F : 0x22222222 */ +}; + +static PRUint8 gBidiCatIdx10[64] = { + 1, /* U+1D000 - U+1D007 : 0x11111111 */ + 1, /* U+1D008 - U+1D00F : 0x11111111 */ + 1, /* U+1D010 - U+1D017 : 0x11111111 */ + 1, /* U+1D018 - U+1D01F : 0x11111111 */ + 1, /* U+1D020 - U+1D027 : 0x11111111 */ + 1, /* U+1D028 - U+1D02F : 0x11111111 */ + 1, /* U+1D030 - U+1D037 : 0x11111111 */ + 1, /* U+1D038 - U+1D03F : 0x11111111 */ + 1, /* U+1D040 - U+1D047 : 0x11111111 */ + 1, /* U+1D048 - U+1D04F : 0x11111111 */ + 1, /* U+1D050 - U+1D057 : 0x11111111 */ + 1, /* U+1D058 - U+1D05F : 0x11111111 */ + 1, /* U+1D060 - U+1D067 : 0x11111111 */ + 1, /* U+1D068 - U+1D06F : 0x11111111 */ + 1, /* U+1D070 - U+1D077 : 0x11111111 */ + 1, /* U+1D078 - U+1D07F : 0x11111111 */ + 1, /* U+1D080 - U+1D087 : 0x11111111 */ + 1, /* U+1D088 - U+1D08F : 0x11111111 */ + 1, /* U+1D090 - U+1D097 : 0x11111111 */ + 1, /* U+1D098 - U+1D09F : 0x11111111 */ + 1, /* U+1D0A0 - U+1D0A7 : 0x11111111 */ + 1, /* U+1D0A8 - U+1D0AF : 0x11111111 */ + 1, /* U+1D0B0 - U+1D0B7 : 0x11111111 */ + 1, /* U+1D0B8 - U+1D0BF : 0x11111111 */ + 1, /* U+1D0C0 - U+1D0C7 : 0x11111111 */ + 1, /* U+1D0C8 - U+1D0CF : 0x11111111 */ + 1, /* U+1D0D0 - U+1D0D7 : 0x11111111 */ + 1, /* U+1D0D8 - U+1D0DF : 0x11111111 */ + 1, /* U+1D0E0 - U+1D0E7 : 0x11111111 */ + 1, /* U+1D0E8 - U+1D0EF : 0x11111111 */ + 1, /* U+1D0F0 - U+1D0F7 : 0x11111111 */ + 1, /* U+1D0F8 - U+1D0FF : 0x11111111 */ + 1, /* U+1D100 - U+1D107 : 0x11111111 */ + 1, /* U+1D108 - U+1D10F : 0x11111111 */ + 1, /* U+1D110 - U+1D117 : 0x11111111 */ + 1, /* U+1D118 - U+1D11F : 0x11111111 */ + 1, /* U+1D120 - U+1D127 : 0x11111111 */ + 1, /* U+1D128 - U+1D12F : 0x11111111 */ + 1, /* U+1D130 - U+1D137 : 0x11111111 */ + 1, /* U+1D138 - U+1D13F : 0x11111111 */ + 1, /* U+1D140 - U+1D147 : 0x11111111 */ + 1, /* U+1D148 - U+1D14F : 0x11111111 */ + 1, /* U+1D150 - U+1D157 : 0x11111111 */ + 1, /* U+1D158 - U+1D15F : 0x11111111 */ + 85, /* U+1D160 - U+1D167 : 0xA1111111 */ + 39, /* U+1D168 - U+1D16F : 0x111111AA */ + 155, /* U+1D170 - U+1D177 : 0xBBBBB111 */ + 156, /* U+1D178 - U+1D17F : 0xAAAAABBB */ + 157, /* U+1D180 - U+1D187 : 0xAAA11AAA */ + 97, /* U+1D188 - U+1D18F : 0x1111AAAA */ + 1, /* U+1D190 - U+1D197 : 0x11111111 */ + 1, /* U+1D198 - U+1D19F : 0x11111111 */ + 1, /* U+1D1A0 - U+1D1A7 : 0x11111111 */ + 158, /* U+1D1A8 - U+1D1AF : 0x11AAAA11 */ + 1, /* U+1D1B0 - U+1D1B7 : 0x11111111 */ + 1, /* U+1D1B8 - U+1D1BF : 0x11111111 */ + 1, /* U+1D1C0 - U+1D1C7 : 0x11111111 */ + 1, /* U+1D1C8 - U+1D1CF : 0x11111111 */ + 1, /* U+1D1D0 - U+1D1D7 : 0x11111111 */ + 1, /* U+1D1D8 - U+1D1DF : 0x11111111 */ + 1, /* U+1D1E0 - U+1D1E7 : 0x11111111 */ + 1, /* U+1D1E8 - U+1D1EF : 0x11111111 */ + 1, /* U+1D1F0 - U+1D1F7 : 0x11111111 */ + 1, /* U+1D1F8 - U+1D1FF : 0x11111111 */ +}; + +static PRUint8 gBidiCatIdx11[160] = { + 9, /* U+1D300 - U+1D307 : 0x99999999 */ + 9, /* U+1D308 - U+1D30F : 0x99999999 */ + 9, /* U+1D310 - U+1D317 : 0x99999999 */ + 9, /* U+1D318 - U+1D31F : 0x99999999 */ + 9, /* U+1D320 - U+1D327 : 0x99999999 */ + 9, /* U+1D328 - U+1D32F : 0x99999999 */ + 9, /* U+1D330 - U+1D337 : 0x99999999 */ + 9, /* U+1D338 - U+1D33F : 0x99999999 */ + 9, /* U+1D340 - U+1D347 : 0x99999999 */ + 9, /* U+1D348 - U+1D34F : 0x99999999 */ + 127, /* U+1D350 - U+1D357 : 0x19999999 */ + 1, /* U+1D358 - U+1D35F : 0x11111111 */ + 1, /* U+1D360 - U+1D367 : 0x11111111 */ + 1, /* U+1D368 - U+1D36F : 0x11111111 */ + 1, /* U+1D370 - U+1D377 : 0x11111111 */ + 1, /* U+1D378 - U+1D37F : 0x11111111 */ + 1, /* U+1D380 - U+1D387 : 0x11111111 */ + 1, /* U+1D388 - U+1D38F : 0x11111111 */ + 1, /* U+1D390 - U+1D397 : 0x11111111 */ + 1, /* U+1D398 - U+1D39F : 0x11111111 */ + 1, /* U+1D3A0 - U+1D3A7 : 0x11111111 */ + 1, /* U+1D3A8 - U+1D3AF : 0x11111111 */ + 1, /* U+1D3B0 - U+1D3B7 : 0x11111111 */ + 1, /* U+1D3B8 - U+1D3BF : 0x11111111 */ + 1, /* U+1D3C0 - U+1D3C7 : 0x11111111 */ + 1, /* U+1D3C8 - U+1D3CF : 0x11111111 */ + 1, /* U+1D3D0 - U+1D3D7 : 0x11111111 */ + 1, /* U+1D3D8 - U+1D3DF : 0x11111111 */ + 1, /* U+1D3E0 - U+1D3E7 : 0x11111111 */ + 1, /* U+1D3E8 - U+1D3EF : 0x11111111 */ + 1, /* U+1D3F0 - U+1D3F7 : 0x11111111 */ + 1, /* U+1D3F8 - U+1D3FF : 0x11111111 */ + 1, /* U+1D400 - U+1D407 : 0x11111111 */ + 1, /* U+1D408 - U+1D40F : 0x11111111 */ + 1, /* U+1D410 - U+1D417 : 0x11111111 */ + 1, /* U+1D418 - U+1D41F : 0x11111111 */ + 1, /* U+1D420 - U+1D427 : 0x11111111 */ + 1, /* U+1D428 - U+1D42F : 0x11111111 */ + 1, /* U+1D430 - U+1D437 : 0x11111111 */ + 1, /* U+1D438 - U+1D43F : 0x11111111 */ + 1, /* U+1D440 - U+1D447 : 0x11111111 */ + 1, /* U+1D448 - U+1D44F : 0x11111111 */ + 1, /* U+1D450 - U+1D457 : 0x11111111 */ + 1, /* U+1D458 - U+1D45F : 0x11111111 */ + 1, /* U+1D460 - U+1D467 : 0x11111111 */ + 1, /* U+1D468 - U+1D46F : 0x11111111 */ + 1, /* U+1D470 - U+1D477 : 0x11111111 */ + 1, /* U+1D478 - U+1D47F : 0x11111111 */ + 1, /* U+1D480 - U+1D487 : 0x11111111 */ + 1, /* U+1D488 - U+1D48F : 0x11111111 */ + 1, /* U+1D490 - U+1D497 : 0x11111111 */ + 1, /* U+1D498 - U+1D49F : 0x11111111 */ + 1, /* U+1D4A0 - U+1D4A7 : 0x11111111 */ + 1, /* U+1D4A8 - U+1D4AF : 0x11111111 */ + 1, /* U+1D4B0 - U+1D4B7 : 0x11111111 */ + 1, /* U+1D4B8 - U+1D4BF : 0x11111111 */ + 1, /* U+1D4C0 - U+1D4C7 : 0x11111111 */ + 1, /* U+1D4C8 - U+1D4CF : 0x11111111 */ + 1, /* U+1D4D0 - U+1D4D7 : 0x11111111 */ + 1, /* U+1D4D8 - U+1D4DF : 0x11111111 */ + 1, /* U+1D4E0 - U+1D4E7 : 0x11111111 */ + 1, /* U+1D4E8 - U+1D4EF : 0x11111111 */ + 1, /* U+1D4F0 - U+1D4F7 : 0x11111111 */ + 1, /* U+1D4F8 - U+1D4FF : 0x11111111 */ + 1, /* U+1D500 - U+1D507 : 0x11111111 */ + 1, /* U+1D508 - U+1D50F : 0x11111111 */ + 1, /* U+1D510 - U+1D517 : 0x11111111 */ + 1, /* U+1D518 - U+1D51F : 0x11111111 */ + 1, /* U+1D520 - U+1D527 : 0x11111111 */ + 1, /* U+1D528 - U+1D52F : 0x11111111 */ + 1, /* U+1D530 - U+1D537 : 0x11111111 */ + 1, /* U+1D538 - U+1D53F : 0x11111111 */ + 1, /* U+1D540 - U+1D547 : 0x11111111 */ + 1, /* U+1D548 - U+1D54F : 0x11111111 */ + 1, /* U+1D550 - U+1D557 : 0x11111111 */ + 1, /* U+1D558 - U+1D55F : 0x11111111 */ + 1, /* U+1D560 - U+1D567 : 0x11111111 */ + 1, /* U+1D568 - U+1D56F : 0x11111111 */ + 1, /* U+1D570 - U+1D577 : 0x11111111 */ + 1, /* U+1D578 - U+1D57F : 0x11111111 */ + 1, /* U+1D580 - U+1D587 : 0x11111111 */ + 1, /* U+1D588 - U+1D58F : 0x11111111 */ + 1, /* U+1D590 - U+1D597 : 0x11111111 */ + 1, /* U+1D598 - U+1D59F : 0x11111111 */ + 1, /* U+1D5A0 - U+1D5A7 : 0x11111111 */ + 1, /* U+1D5A8 - U+1D5AF : 0x11111111 */ + 1, /* U+1D5B0 - U+1D5B7 : 0x11111111 */ + 1, /* U+1D5B8 - U+1D5BF : 0x11111111 */ + 1, /* U+1D5C0 - U+1D5C7 : 0x11111111 */ + 1, /* U+1D5C8 - U+1D5CF : 0x11111111 */ + 1, /* U+1D5D0 - U+1D5D7 : 0x11111111 */ + 1, /* U+1D5D8 - U+1D5DF : 0x11111111 */ + 1, /* U+1D5E0 - U+1D5E7 : 0x11111111 */ + 1, /* U+1D5E8 - U+1D5EF : 0x11111111 */ + 1, /* U+1D5F0 - U+1D5F7 : 0x11111111 */ + 1, /* U+1D5F8 - U+1D5FF : 0x11111111 */ + 1, /* U+1D600 - U+1D607 : 0x11111111 */ + 1, /* U+1D608 - U+1D60F : 0x11111111 */ + 1, /* U+1D610 - U+1D617 : 0x11111111 */ + 1, /* U+1D618 - U+1D61F : 0x11111111 */ + 1, /* U+1D620 - U+1D627 : 0x11111111 */ + 1, /* U+1D628 - U+1D62F : 0x11111111 */ + 1, /* U+1D630 - U+1D637 : 0x11111111 */ + 1, /* U+1D638 - U+1D63F : 0x11111111 */ + 1, /* U+1D640 - U+1D647 : 0x11111111 */ + 1, /* U+1D648 - U+1D64F : 0x11111111 */ + 1, /* U+1D650 - U+1D657 : 0x11111111 */ + 1, /* U+1D658 - U+1D65F : 0x11111111 */ + 1, /* U+1D660 - U+1D667 : 0x11111111 */ + 1, /* U+1D668 - U+1D66F : 0x11111111 */ + 1, /* U+1D670 - U+1D677 : 0x11111111 */ + 1, /* U+1D678 - U+1D67F : 0x11111111 */ + 1, /* U+1D680 - U+1D687 : 0x11111111 */ + 1, /* U+1D688 - U+1D68F : 0x11111111 */ + 1, /* U+1D690 - U+1D697 : 0x11111111 */ + 1, /* U+1D698 - U+1D69F : 0x11111111 */ + 1, /* U+1D6A0 - U+1D6A7 : 0x11111111 */ + 1, /* U+1D6A8 - U+1D6AF : 0x11111111 */ + 1, /* U+1D6B0 - U+1D6B7 : 0x11111111 */ + 1, /* U+1D6B8 - U+1D6BF : 0x11111111 */ + 1, /* U+1D6C0 - U+1D6C7 : 0x11111111 */ + 1, /* U+1D6C8 - U+1D6CF : 0x11111111 */ + 1, /* U+1D6D0 - U+1D6D7 : 0x11111111 */ + 1, /* U+1D6D8 - U+1D6DF : 0x11111111 */ + 1, /* U+1D6E0 - U+1D6E7 : 0x11111111 */ + 1, /* U+1D6E8 - U+1D6EF : 0x11111111 */ + 1, /* U+1D6F0 - U+1D6F7 : 0x11111111 */ + 1, /* U+1D6F8 - U+1D6FF : 0x11111111 */ + 1, /* U+1D700 - U+1D707 : 0x11111111 */ + 1, /* U+1D708 - U+1D70F : 0x11111111 */ + 1, /* U+1D710 - U+1D717 : 0x11111111 */ + 1, /* U+1D718 - U+1D71F : 0x11111111 */ + 1, /* U+1D720 - U+1D727 : 0x11111111 */ + 1, /* U+1D728 - U+1D72F : 0x11111111 */ + 1, /* U+1D730 - U+1D737 : 0x11111111 */ + 1, /* U+1D738 - U+1D73F : 0x11111111 */ + 1, /* U+1D740 - U+1D747 : 0x11111111 */ + 1, /* U+1D748 - U+1D74F : 0x11111111 */ + 1, /* U+1D750 - U+1D757 : 0x11111111 */ + 1, /* U+1D758 - U+1D75F : 0x11111111 */ + 1, /* U+1D760 - U+1D767 : 0x11111111 */ + 1, /* U+1D768 - U+1D76F : 0x11111111 */ + 1, /* U+1D770 - U+1D777 : 0x11111111 */ + 1, /* U+1D778 - U+1D77F : 0x11111111 */ + 1, /* U+1D780 - U+1D787 : 0x11111111 */ + 1, /* U+1D788 - U+1D78F : 0x11111111 */ + 1, /* U+1D790 - U+1D797 : 0x11111111 */ + 1, /* U+1D798 - U+1D79F : 0x11111111 */ + 1, /* U+1D7A0 - U+1D7A7 : 0x11111111 */ + 1, /* U+1D7A8 - U+1D7AF : 0x11111111 */ + 1, /* U+1D7B0 - U+1D7B7 : 0x11111111 */ + 1, /* U+1D7B8 - U+1D7BF : 0x11111111 */ + 1, /* U+1D7C0 - U+1D7C7 : 0x11111111 */ + 159, /* U+1D7C8 - U+1D7CF : 0x55111111 */ + 5, /* U+1D7D0 - U+1D7D7 : 0x55555555 */ + 5, /* U+1D7D8 - U+1D7DF : 0x55555555 */ + 5, /* U+1D7E0 - U+1D7E7 : 0x55555555 */ + 5, /* U+1D7E8 - U+1D7EF : 0x55555555 */ + 5, /* U+1D7F0 - U+1D7F7 : 0x55555555 */ + 5, /* U+1D7F8 - U+1D7FF : 0x55555555 */ +}; + +static PRUint8 gBidiCatIdx12[68] = { + 1, /* U+2F800 - U+2F807 : 0x11111111 */ + 1, /* U+2F808 - U+2F80F : 0x11111111 */ + 1, /* U+2F810 - U+2F817 : 0x11111111 */ + 1, /* U+2F818 - U+2F81F : 0x11111111 */ + 1, /* U+2F820 - U+2F827 : 0x11111111 */ + 1, /* U+2F828 - U+2F82F : 0x11111111 */ + 1, /* U+2F830 - U+2F837 : 0x11111111 */ + 1, /* U+2F838 - U+2F83F : 0x11111111 */ + 1, /* U+2F840 - U+2F847 : 0x11111111 */ + 1, /* U+2F848 - U+2F84F : 0x11111111 */ + 1, /* U+2F850 - U+2F857 : 0x11111111 */ + 1, /* U+2F858 - U+2F85F : 0x11111111 */ + 1, /* U+2F860 - U+2F867 : 0x11111111 */ + 1, /* U+2F868 - U+2F86F : 0x11111111 */ + 1, /* U+2F870 - U+2F877 : 0x11111111 */ + 1, /* U+2F878 - U+2F87F : 0x11111111 */ + 1, /* U+2F880 - U+2F887 : 0x11111111 */ + 1, /* U+2F888 - U+2F88F : 0x11111111 */ + 1, /* U+2F890 - U+2F897 : 0x11111111 */ + 1, /* U+2F898 - U+2F89F : 0x11111111 */ + 1, /* U+2F8A0 - U+2F8A7 : 0x11111111 */ + 1, /* U+2F8A8 - U+2F8AF : 0x11111111 */ + 1, /* U+2F8B0 - U+2F8B7 : 0x11111111 */ + 1, /* U+2F8B8 - U+2F8BF : 0x11111111 */ + 1, /* U+2F8C0 - U+2F8C7 : 0x11111111 */ + 1, /* U+2F8C8 - U+2F8CF : 0x11111111 */ + 1, /* U+2F8D0 - U+2F8D7 : 0x11111111 */ + 1, /* U+2F8D8 - U+2F8DF : 0x11111111 */ + 1, /* U+2F8E0 - U+2F8E7 : 0x11111111 */ + 1, /* U+2F8E8 - U+2F8EF : 0x11111111 */ + 1, /* U+2F8F0 - U+2F8F7 : 0x11111111 */ + 1, /* U+2F8F8 - U+2F8FF : 0x11111111 */ + 1, /* U+2F900 - U+2F907 : 0x11111111 */ + 1, /* U+2F908 - U+2F90F : 0x11111111 */ + 1, /* U+2F910 - U+2F917 : 0x11111111 */ + 1, /* U+2F918 - U+2F91F : 0x11111111 */ + 1, /* U+2F920 - U+2F927 : 0x11111111 */ + 1, /* U+2F928 - U+2F92F : 0x11111111 */ + 1, /* U+2F930 - U+2F937 : 0x11111111 */ + 1, /* U+2F938 - U+2F93F : 0x11111111 */ + 1, /* U+2F940 - U+2F947 : 0x11111111 */ + 1, /* U+2F948 - U+2F94F : 0x11111111 */ + 1, /* U+2F950 - U+2F957 : 0x11111111 */ + 1, /* U+2F958 - U+2F95F : 0x11111111 */ + 1, /* U+2F960 - U+2F967 : 0x11111111 */ + 1, /* U+2F968 - U+2F96F : 0x11111111 */ + 1, /* U+2F970 - U+2F977 : 0x11111111 */ + 1, /* U+2F978 - U+2F97F : 0x11111111 */ + 1, /* U+2F980 - U+2F987 : 0x11111111 */ + 1, /* U+2F988 - U+2F98F : 0x11111111 */ + 1, /* U+2F990 - U+2F997 : 0x11111111 */ + 1, /* U+2F998 - U+2F99F : 0x11111111 */ + 1, /* U+2F9A0 - U+2F9A7 : 0x11111111 */ + 1, /* U+2F9A8 - U+2F9AF : 0x11111111 */ + 1, /* U+2F9B0 - U+2F9B7 : 0x11111111 */ + 1, /* U+2F9B8 - U+2F9BF : 0x11111111 */ + 1, /* U+2F9C0 - U+2F9C7 : 0x11111111 */ + 1, /* U+2F9C8 - U+2F9CF : 0x11111111 */ + 1, /* U+2F9D0 - U+2F9D7 : 0x11111111 */ + 1, /* U+2F9D8 - U+2F9DF : 0x11111111 */ + 1, /* U+2F9E0 - U+2F9E7 : 0x11111111 */ + 1, /* U+2F9E8 - U+2F9EF : 0x11111111 */ + 1, /* U+2F9F0 - U+2F9F7 : 0x11111111 */ + 1, /* U+2F9F8 - U+2F9FF : 0x11111111 */ + 1, /* U+2FA00 - U+2FA07 : 0x11111111 */ + 1, /* U+2FA08 - U+2FA0F : 0x11111111 */ + 1, /* U+2FA10 - U+2FA17 : 0x11111111 */ + 1, /* U+2FA18 - U+2FA1F : 0x11111111 */ +}; + +static PRUint8 gBidiCatIdx13[64] = { + 160, /* U+E0000 - U+E0007 : 0x111111B1 */ + 1, /* U+E0008 - U+E000F : 0x11111111 */ + 1, /* U+E0010 - U+E0017 : 0x11111111 */ + 1, /* U+E0018 - U+E001F : 0x11111111 */ + 11, /* U+E0020 - U+E0027 : 0xBBBBBBBB */ + 11, /* U+E0028 - U+E002F : 0xBBBBBBBB */ + 11, /* U+E0030 - U+E0037 : 0xBBBBBBBB */ + 11, /* U+E0038 - U+E003F : 0xBBBBBBBB */ + 11, /* U+E0040 - U+E0047 : 0xBBBBBBBB */ + 11, /* U+E0048 - U+E004F : 0xBBBBBBBB */ + 11, /* U+E0050 - U+E0057 : 0xBBBBBBBB */ + 11, /* U+E0058 - U+E005F : 0xBBBBBBBB */ + 11, /* U+E0060 - U+E0067 : 0xBBBBBBBB */ + 11, /* U+E0068 - U+E006F : 0xBBBBBBBB */ + 11, /* U+E0070 - U+E0077 : 0xBBBBBBBB */ + 11, /* U+E0078 - U+E007F : 0xBBBBBBBB */ + 1, /* U+E0080 - U+E0087 : 0x11111111 */ + 1, /* U+E0088 - U+E008F : 0x11111111 */ + 1, /* U+E0090 - U+E0097 : 0x11111111 */ + 1, /* U+E0098 - U+E009F : 0x11111111 */ + 1, /* U+E00A0 - U+E00A7 : 0x11111111 */ + 1, /* U+E00A8 - U+E00AF : 0x11111111 */ + 1, /* U+E00B0 - U+E00B7 : 0x11111111 */ + 1, /* U+E00B8 - U+E00BF : 0x11111111 */ + 1, /* U+E00C0 - U+E00C7 : 0x11111111 */ + 1, /* U+E00C8 - U+E00CF : 0x11111111 */ + 1, /* U+E00D0 - U+E00D7 : 0x11111111 */ + 1, /* U+E00D8 - U+E00DF : 0x11111111 */ + 1, /* U+E00E0 - U+E00E7 : 0x11111111 */ + 1, /* U+E00E8 - U+E00EF : 0x11111111 */ + 1, /* U+E00F0 - U+E00F7 : 0x11111111 */ + 1, /* U+E00F8 - U+E00FF : 0x11111111 */ + 10, /* U+E0100 - U+E0107 : 0xAAAAAAAA */ + 10, /* U+E0108 - U+E010F : 0xAAAAAAAA */ + 10, /* U+E0110 - U+E0117 : 0xAAAAAAAA */ + 10, /* U+E0118 - U+E011F : 0xAAAAAAAA */ + 10, /* U+E0120 - U+E0127 : 0xAAAAAAAA */ + 10, /* U+E0128 - U+E012F : 0xAAAAAAAA */ + 10, /* U+E0130 - U+E0137 : 0xAAAAAAAA */ + 10, /* U+E0138 - U+E013F : 0xAAAAAAAA */ + 10, /* U+E0140 - U+E0147 : 0xAAAAAAAA */ + 10, /* U+E0148 - U+E014F : 0xAAAAAAAA */ + 10, /* U+E0150 - U+E0157 : 0xAAAAAAAA */ + 10, /* U+E0158 - U+E015F : 0xAAAAAAAA */ + 10, /* U+E0160 - U+E0167 : 0xAAAAAAAA */ + 10, /* U+E0168 - U+E016F : 0xAAAAAAAA */ + 10, /* U+E0170 - U+E0177 : 0xAAAAAAAA */ + 10, /* U+E0178 - U+E017F : 0xAAAAAAAA */ + 10, /* U+E0180 - U+E0187 : 0xAAAAAAAA */ + 10, /* U+E0188 - U+E018F : 0xAAAAAAAA */ + 10, /* U+E0190 - U+E0197 : 0xAAAAAAAA */ + 10, /* U+E0198 - U+E019F : 0xAAAAAAAA */ + 10, /* U+E01A0 - U+E01A7 : 0xAAAAAAAA */ + 10, /* U+E01A8 - U+E01AF : 0xAAAAAAAA */ + 10, /* U+E01B0 - U+E01B7 : 0xAAAAAAAA */ + 10, /* U+E01B8 - U+E01BF : 0xAAAAAAAA */ + 10, /* U+E01C0 - U+E01C7 : 0xAAAAAAAA */ + 10, /* U+E01C8 - U+E01CF : 0xAAAAAAAA */ + 10, /* U+E01D0 - U+E01D7 : 0xAAAAAAAA */ + 10, /* U+E01D8 - U+E01DF : 0xAAAAAAAA */ + 10, /* U+E01E0 - U+E01E7 : 0xAAAAAAAA */ + 10, /* U+E01E8 - U+E01EF : 0xAAAAAAAA */ + 1, /* U+E01F0 - U+E01F7 : 0x11111111 */ + 1, /* U+E01F8 - U+E01FF : 0x11111111 */ +}; + +static PRUint32 gBidiCatPat[161] = { 0x00000000, /* 0 */ 0x11111111, /* 1 */ 0x22222222, /* 2 */ @@ -2047,9 +2553,16 @@ static PRUint32 gBidiCatPat[154] = { 0x68787999, /* 151 */ 0x17799977, /* 152 */ 0x11999991, /* 153 */ + 0x11111191, /* 154 */ + 0xBBBBB111, /* 155 */ + 0xAAAAABBB, /* 156 */ + 0xAAA11AAA, /* 157 */ + 0x11AAAA11, /* 158 */ + 0x55111111, /* 159 */ + 0x111111B1, /* 160 */ }; -static eBidiCategory GetBidiCat(PRUnichar u) +static eBidiCategory GetBidiCat(PRUint32 u) { PRUint32 pat; PRUint16 patidx; @@ -2057,82 +2570,80 @@ static eBidiCategory GetBidiCat(PRUnichar u) /* Handle blocks which use index table mapping */ /* Handle U+0000 to U+07FF */ - if (u<=((PRUnichar)0x07FF)) { + if (u<=((PRUint32)0x07FF)) { patidx = gBidiCatIdx1 [( u >> 3 )]; - if (patidx < 0x10) - return (eBidiCategory)patidx; - else { - pat = gBidiCatPat[patidx]; - return (eBidiCategory)((pat >> ((u % 8) * 4)) & 0x0F); - } } /* Handle U+0900 to U+19FF */ - if ((((PRUnichar)0x0900)<=u)&&(u<=((PRUnichar)0x19FF))) { - patidx = gBidiCatIdx2 [( (u -(PRUnichar) 0x0900) >> 3 )]; - if (patidx < 0x10) - return (eBidiCategory)patidx; - else { - pat = gBidiCatPat[patidx]; - return (eBidiCategory)((pat >> ((u % 8) * 4)) & 0x0F); - } + else if ((((PRUint32)0x0900)<=u)&&(u<=((PRUint32)0x19FF))) { + patidx = gBidiCatIdx2 [( (u -(PRUint32) 0x0900) >> 3 )]; } /* Handle U+1D00 to U+2BFF */ - if ((((PRUnichar)0x1D00)<=u)&&(u<=((PRUnichar)0x2BFF))) { - patidx = gBidiCatIdx3 [( (u -(PRUnichar) 0x1D00) >> 3 )]; - if (patidx < 0x10) - return (eBidiCategory)patidx; - else { - pat = gBidiCatPat[patidx]; - return (eBidiCategory)((pat >> ((u % 8) * 4)) & 0x0F); - } + else if ((((PRUint32)0x1D00)<=u)&&(u<=((PRUint32)0x2BFF))) { + patidx = gBidiCatIdx3 [( (u -(PRUint32) 0x1D00) >> 3 )]; } /* Handle U+2E80 to U+33FF */ - if ((((PRUnichar)0x2E80)<=u)&&(u<=((PRUnichar)0x33FF))) { - patidx = gBidiCatIdx4 [( (u -(PRUnichar) 0x2E80) >> 3 )]; - if (patidx < 0x10) - return (eBidiCategory)patidx; - else { - pat = gBidiCatPat[patidx]; - return (eBidiCategory)((pat >> ((u % 8) * 4)) & 0x0F); - } + else if ((((PRUint32)0x2E80)<=u)&&(u<=((PRUint32)0x33FF))) { + patidx = gBidiCatIdx4 [( (u -(PRUint32) 0x2E80) >> 3 )]; } /* Handle U+4DC0 to U+4DFF */ - if ((((PRUnichar)0x4DC0)<=u)&&(u<=((PRUnichar)0x4DFF))) { - patidx = gBidiCatIdx5 [( (u -(PRUnichar) 0x4DC0) >> 3 )]; - if (patidx < 0x10) - return (eBidiCategory)patidx; - else { - pat = gBidiCatPat[patidx]; - return (eBidiCategory)((pat >> ((u % 8) * 4)) & 0x0F); - } + else if ((((PRUint32)0x4DC0)<=u)&&(u<=((PRUint32)0x4DFF))) { + patidx = gBidiCatIdx5 [( (u -(PRUint32) 0x4DC0) >> 3 )]; } /* Handle U+A000 to U+A4FF */ - if ((((PRUnichar)0xA000)<=u)&&(u<=((PRUnichar)0xA4FF))) { - patidx = gBidiCatIdx6 [( (u -(PRUnichar) 0xA000) >> 3 )]; - if (patidx < 0x10) - return (eBidiCategory)patidx; - else { - pat = gBidiCatPat[patidx]; - return (eBidiCategory)((pat >> ((u % 8) * 4)) & 0x0F); - } + else if ((((PRUint32)0xA000)<=u)&&(u<=((PRUint32)0xA4FF))) { + patidx = gBidiCatIdx6 [( (u -(PRUint32) 0xA000) >> 3 )]; } - /* Handle U+F900 to U+FFFF */ - if (((PRUnichar)0xF900)<=u) { - patidx = gBidiCatIdx7 [( (u -(PRUnichar) 0xF900) >> 3 )]; - if (patidx < 0x10) - return (eBidiCategory)patidx; - else { - pat = gBidiCatPat[patidx]; - return (eBidiCategory)((pat >> ((u % 8) * 4)) & 0x0F); - } + /* Handle U+F900 to U+1013F */ + else if ((((PRUint32)0xF900)<=u)&&(u<=((PRUint32)0x1013F))) { + patidx = gBidiCatIdx7 [( (u -(PRUint32) 0xF900) >> 3 )]; } - return eBidiCat_L; /* UNDEFINE = L */ + /* Handle U+10300 to U+104FF */ + else if ((((PRUint32)0x10300)<=u)&&(u<=((PRUint32)0x104FF))) { + patidx = gBidiCatIdx8 [( (u -(PRUint32) 0x10300) >> 3 )]; + } + + /* Handle U+10800 to U+1083F */ + else if ((((PRUint32)0x10800)<=u)&&(u<=((PRUint32)0x1083F))) { + patidx = gBidiCatIdx9 [( (u -(PRUint32) 0x10800) >> 3 )]; + } + + /* Handle U+1D000 to U+1D1FF */ + else if ((((PRUint32)0x1D000)<=u)&&(u<=((PRUint32)0x1D1FF))) { + patidx = gBidiCatIdx10 [( (u -(PRUint32) 0x1D000) >> 3 )]; + } + + /* Handle U+1D300 to U+1D7FF */ + else if ((((PRUint32)0x1D300)<=u)&&(u<=((PRUint32)0x1D7FF))) { + patidx = gBidiCatIdx11 [( (u -(PRUint32) 0x1D300) >> 3 )]; + } + + /* Handle U+2F800 to U+2FA1F */ + else if ((((PRUint32)0x2F800)<=u)&&(u<=((PRUint32)0x2FA1F))) { + patidx = gBidiCatIdx12 [( (u -(PRUint32) 0x2F800) >> 3 )]; + } + + /* Handle U+E0000 to U+E01FF */ + else if ((((PRUint32)0xE0000)<=u)&&(u<=((PRUint32)0xE01FF))) { + patidx = gBidiCatIdx13 [( (u -(PRUint32) 0xE0000) >> 3 )]; + } + + else { + return eBidiCat_L; /* UNDEFINE = L */ + } + + if (patidx < 0x10) + return (eBidiCategory)patidx; + else { + pat = gBidiCatPat[patidx]; + return (eBidiCategory)((pat >> ((u % 8) * 4)) & 0x0F); + } } -/* total data size = 2464 */ + +/* total data size = 2960 */ diff --git a/mozilla/layout/base/nsBidi.cpp b/mozilla/layout/base/nsBidi.cpp index e751b7dfd90..eea27dd04eb 100644 --- a/mozilla/layout/base/nsBidi.cpp +++ b/mozilla/layout/base/nsBidi.cpp @@ -518,7 +518,7 @@ void nsBidi::GetDirProps(const PRUnichar *aText) uchar=aText[i]; if(!IS_FIRST_SURROGATE(uchar) || i+1==length || !IS_SECOND_SURROGATE(aText[i+1])) { /* not a surrogate pair */ - flags|=DIRPROP_FLAG(dirProps[i]=dirProp=GetCharType(uchar)); + flags|=DIRPROP_FLAG(dirProps[i]=dirProp=GetCharType((PRUint32)uchar)); } else { /* a surrogate pair */ dirProps[i++]=BN; /* first surrogate in the pair gets the BN type */ @@ -548,7 +548,7 @@ void nsBidi::GetDirProps(const PRUnichar *aText) uchar=aText[i]; if(!IS_FIRST_SURROGATE(uchar) || i+1==length || !IS_SECOND_SURROGATE(aText[i+1])) { /* not a surrogate pair */ - flags|=DIRPROP_FLAG(dirProps[i]=GetCharType(uchar)); + flags|=DIRPROP_FLAG(dirProps[i]=GetCharType((PRUint32)uchar)); } else { /* a surrogate pair */ dirProps[i++]=BN; /* second surrogate in the pair gets the BN type */ @@ -2236,7 +2236,7 @@ PRInt32 nsBidi::doWriteReverse(const PRUnichar *src, PRInt32 srcLength, i=0; do { ch=*src++; - if (!IsBidiControl(ch)) { + if (!IsBidiControl((PRUint32)ch)) { ++i; } } while(--length>0); @@ -2304,7 +2304,7 @@ nsresult nsBidi::WriteReverse(const PRUnichar *aSrc, PRInt32 aSrcLength, PRUnich return NS_OK; } -eBidiCategory nsBidi::GetBidiCategory(PRUnichar aChar) +eBidiCategory nsBidi::GetBidiCategory(PRUint32 aChar) { eBidiCategory oResult = GetBidiCat(aChar); if (eBidiCat_CC == oResult) @@ -2312,21 +2312,21 @@ eBidiCategory nsBidi::GetBidiCategory(PRUnichar aChar) return oResult; } -PRBool nsBidi::IsBidiCategory(PRUnichar aChar, eBidiCategory aBidiCategory) +PRBool nsBidi::IsBidiCategory(PRUint32 aChar, eBidiCategory aBidiCategory) { return (GetBidiCategory(aChar) == aBidiCategory); } #define ZWNJ 0x200c -PRBool nsBidi::IsBidiControl(PRUnichar aChar) +PRBool nsBidi::IsBidiControl(PRUint32 aChar) { // This method is used when stripping Bidi control characters for // display, so it will return TRUE for LRM, RLM, ZWJ and ZWNJ as // well as the characters with category eBidiCat_CC - return (eBidiCat_CC == GetBidiCat(aChar) || ((aChar)&0xfffc)==ZWNJ); + return (eBidiCat_CC == GetBidiCat(aChar) || ((aChar)&0xfffffc)==ZWNJ); } -nsCharType nsBidi::GetCharType(PRUnichar aChar) +nsCharType nsBidi::GetCharType(PRUint32 aChar) { nsCharType oResult; eBidiCategory bCat = GetBidiCat(aChar); diff --git a/mozilla/layout/base/nsBidi.h b/mozilla/layout/base/nsBidi.h index 5e18648b647..515c67bdedb 100644 --- a/mozilla/layout/base/nsBidi.h +++ b/mozilla/layout/base/nsBidi.h @@ -957,11 +957,11 @@ public: nsresult WriteReverse(const PRUnichar *aSrc, PRInt32 aSrcLength, PRUnichar *aDest, PRUint16 aOptions, PRInt32 *aDestSize); /** - * Give a Unichar - * return PR_TRUE if the Unichar is a Bidi control character (LRE, RLE, PDF, LRO, RLO, LRM, RLM) + * Give a UTF-32 codepoint + * return PR_TRUE if the codepoint is a Bidi control character (LRE, RLE, PDF, LRO, RLO, LRM, RLM) * return PR_FALSE, otherwise */ - PRBool IsBidiControl(PRUnichar aChar); + PRBool IsBidiControl(PRUint32 aChar); protected: /** length of the current text */ @@ -1031,21 +1031,21 @@ private: PRBool PrepareReorder(const nsBidiLevel *aLevels, PRInt32 aLength, PRInt32 *aIndexMap, nsBidiLevel *aMinLevel, nsBidiLevel *aMaxLevel); /** - * Give a Unichar, return an eBidiCategory + * Give a UTF-32 codepoint, return an eBidiCategory */ - eBidiCategory GetBidiCategory(PRUnichar aChar); + eBidiCategory GetBidiCategory(PRUint32 aChar); /** - * Give a Unichar, and a eBidiCategory, - * return PR_TRUE if the Unichar is in that category, + * Give a UTF-32 codepoint and an eBidiCategory, + * return PR_TRUE if the codepoint is in that category, * return PR_FALSE, otherwise */ - PRBool IsBidiCategory(PRUnichar aChar, eBidiCategory aBidiCategory); + PRBool IsBidiCategory(PRUint32 aChar, eBidiCategory aBidiCategory); /** - * Give a Unichar, return a nsCharType (compatible with ICU) + * Give a UTF-32 codepoint, return a nsCharType (compatible with ICU) */ - nsCharType GetCharType(PRUnichar aChar); + nsCharType GetCharType(PRUint32 aChar); /** * Give a Unicode character, return the symmetric equivalent diff --git a/mozilla/layout/base/nsBidiPresUtils.cpp b/mozilla/layout/base/nsBidiPresUtils.cpp index 71b33cc4a09..052ff5bff8d 100644 --- a/mozilla/layout/base/nsBidiPresUtils.cpp +++ b/mozilla/layout/base/nsBidiPresUtils.cpp @@ -932,7 +932,9 @@ nsBidiPresUtils::StripBidiControlCharacters(PRUnichar* aText, PRInt32 stripLen = 0; for (PRInt32 i = 0; i < aTextLength; i++) { - if (mBidiEngine->IsBidiControl(aText[i])) { + // XXX: This silently ignores surrogate characters. + // As of Unicode 4.0, all Bidi control characters are within the BMP. + if (mBidiEngine->IsBidiControl((PRUint32)aText[i])) { ++stripLen; } else { diff --git a/mozilla/layout/base/nsBidiUtils.h b/mozilla/layout/base/nsBidiUtils.h index 1cb135f6127..9e7b6f98085 100644 --- a/mozilla/layout/base/nsBidiUtils.h +++ b/mozilla/layout/base/nsBidiUtils.h @@ -233,7 +233,9 @@ #define IS_ARABIC_CHAR(c) ((0x0600 <= (c)) && ((c)<= 0x06FF)) #define IS_ARABIC_ALPHABETIC(c) (IS_ARABIC_CHAR(c) && \ !(IS_HINDI_DIGIT(c) || IS_FARSI_DIGIT(c) || IS_ARABIC_SEPARATOR(c))) +#define IS_CYPRIOT_CHAR(c) ((0x10800 <= (c)) && ((c) <=0x1083F)) #define CHAR_IS_BIDI(c) ( (IS_HINDI_DIGIT(c) ) || (IS_HEBREW_CHAR(c) ) \ - || (IS_06_CHAR(c) ) || (IS_FE_CHAR(c) ) ) + || (IS_06_CHAR(c) ) || (IS_FE_CHAR(c) ) \ + || (IS_CYPRIOT_CHAR(c) ) ) #endif /* nsBidiUtils_h__ */ diff --git a/mozilla/layout/base/public/nsBidi.h b/mozilla/layout/base/public/nsBidi.h index 5e18648b647..515c67bdedb 100644 --- a/mozilla/layout/base/public/nsBidi.h +++ b/mozilla/layout/base/public/nsBidi.h @@ -957,11 +957,11 @@ public: nsresult WriteReverse(const PRUnichar *aSrc, PRInt32 aSrcLength, PRUnichar *aDest, PRUint16 aOptions, PRInt32 *aDestSize); /** - * Give a Unichar - * return PR_TRUE if the Unichar is a Bidi control character (LRE, RLE, PDF, LRO, RLO, LRM, RLM) + * Give a UTF-32 codepoint + * return PR_TRUE if the codepoint is a Bidi control character (LRE, RLE, PDF, LRO, RLO, LRM, RLM) * return PR_FALSE, otherwise */ - PRBool IsBidiControl(PRUnichar aChar); + PRBool IsBidiControl(PRUint32 aChar); protected: /** length of the current text */ @@ -1031,21 +1031,21 @@ private: PRBool PrepareReorder(const nsBidiLevel *aLevels, PRInt32 aLength, PRInt32 *aIndexMap, nsBidiLevel *aMinLevel, nsBidiLevel *aMaxLevel); /** - * Give a Unichar, return an eBidiCategory + * Give a UTF-32 codepoint, return an eBidiCategory */ - eBidiCategory GetBidiCategory(PRUnichar aChar); + eBidiCategory GetBidiCategory(PRUint32 aChar); /** - * Give a Unichar, and a eBidiCategory, - * return PR_TRUE if the Unichar is in that category, + * Give a UTF-32 codepoint and an eBidiCategory, + * return PR_TRUE if the codepoint is in that category, * return PR_FALSE, otherwise */ - PRBool IsBidiCategory(PRUnichar aChar, eBidiCategory aBidiCategory); + PRBool IsBidiCategory(PRUint32 aChar, eBidiCategory aBidiCategory); /** - * Give a Unichar, return a nsCharType (compatible with ICU) + * Give a UTF-32 codepoint, return a nsCharType (compatible with ICU) */ - nsCharType GetCharType(PRUnichar aChar); + nsCharType GetCharType(PRUint32 aChar); /** * Give a Unicode character, return the symmetric equivalent diff --git a/mozilla/layout/base/src/bidicattable.h b/mozilla/layout/base/src/bidicattable.h index 3083e59d72d..55ad0484dc7 100644 --- a/mozilla/layout/base/src/bidicattable.h +++ b/mozilla/layout/base/src/bidicattable.h @@ -1,20 +1,40 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- * - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "MPL"); you may not use this file except in - * compliance with the MPL. You may obtain a copy of the MPL at + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * - * Software distributed under the MPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the - * MPL. + * License. * - * The Initial Developer of the Original Code is IBM - * Corporation. Portions created by IBM are - * Copyright (C) 2000 IBM Corporation. All - * Rights Reserved. - */ + * The Original Code is mozilla.org Code. + * + * The Initial Developer of the Original Code is + * IBM Corporation. + * Portions created by the Initial Developer are Copyright (C) 2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ /* DO NOT EDIT THIS DOCUMENT !!! THIS DOCUMENT IS GENERATED BY mozilla/layout/tools/genbidicattable.pl @@ -272,14 +292,14 @@ static PRUint8 gBidiCatIdx1[256] = { 10, /* U+07A8 - U+07AF : 0xAAAAAAAA */ 48, /* U+07B0 - U+07B7 : 0x3333333A */ 3, /* U+07B8 - U+07BF : 0x33333333 */ - 1, /* U+07C0 - U+07C7 : 0x11111111 */ - 1, /* U+07C8 - U+07CF : 0x11111111 */ - 1, /* U+07D0 - U+07D7 : 0x11111111 */ - 1, /* U+07D8 - U+07DF : 0x11111111 */ - 1, /* U+07E0 - U+07E7 : 0x11111111 */ - 1, /* U+07E8 - U+07EF : 0x11111111 */ - 1, /* U+07F0 - U+07F7 : 0x11111111 */ - 1, /* U+07F8 - U+07FF : 0x11111111 */ + 2, /* U+07C0 - U+07C7 : 0x22222222 */ + 2, /* U+07C8 - U+07CF : 0x22222222 */ + 2, /* U+07D0 - U+07D7 : 0x22222222 */ + 2, /* U+07D8 - U+07DF : 0x22222222 */ + 2, /* U+07E0 - U+07E7 : 0x22222222 */ + 2, /* U+07E8 - U+07EF : 0x22222222 */ + 2, /* U+07F0 - U+07F7 : 0x22222222 */ + 2, /* U+07F8 - U+07FF : 0x22222222 */ }; static PRUint8 gBidiCatIdx2[544] = { @@ -1665,7 +1685,7 @@ static PRUint8 gBidiCatIdx6[160] = { 1, /* U+A4F8 - U+A4FF : 0x11111111 */ }; -static PRUint8 gBidiCatIdx7[224] = { +static PRUint8 gBidiCatIdx7[264] = { 1, /* U+F900 - U+F907 : 0x11111111 */ 1, /* U+F908 - U+F90F : 0x11111111 */ 1, /* U+F910 - U+F917 : 0x11111111 */ @@ -1820,10 +1840,10 @@ static PRUint8 gBidiCatIdx7[224] = { 3, /* U+FDB8 - U+FDBF : 0x33333333 */ 3, /* U+FDC0 - U+FDC7 : 0x33333333 */ 3, /* U+FDC8 - U+FDCF : 0x33333333 */ - 3, /* U+FDD0 - U+FDD7 : 0x33333333 */ - 3, /* U+FDD8 - U+FDDF : 0x33333333 */ - 3, /* U+FDE0 - U+FDE7 : 0x33333333 */ - 3, /* U+FDE8 - U+FDEF : 0x33333333 */ + 1, /* U+FDD0 - U+FDD7 : 0x11111111 */ + 1, /* U+FDD8 - U+FDDF : 0x11111111 */ + 1, /* U+FDE0 - U+FDE7 : 0x11111111 */ + 1, /* U+FDE8 - U+FDEF : 0x11111111 */ 3, /* U+FDF0 - U+FDF7 : 0x33333333 */ 145, /* U+FDF8 - U+FDFF : 0x33933333 */ 10, /* U+FE00 - U+FE07 : 0xAAAAAAAA */ @@ -1890,9 +1910,495 @@ static PRUint8 gBidiCatIdx7[224] = { 127, /* U+FFE8 - U+FFEF : 0x19999999 */ 1, /* U+FFF0 - U+FFF7 : 0x11111111 */ 153, /* U+FFF8 - U+FFFF : 0x11999991 */ + 1, /* U+10000 - U+10007 : 0x11111111 */ + 1, /* U+10008 - U+1000F : 0x11111111 */ + 1, /* U+10010 - U+10017 : 0x11111111 */ + 1, /* U+10018 - U+1001F : 0x11111111 */ + 1, /* U+10020 - U+10027 : 0x11111111 */ + 1, /* U+10028 - U+1002F : 0x11111111 */ + 1, /* U+10030 - U+10037 : 0x11111111 */ + 1, /* U+10038 - U+1003F : 0x11111111 */ + 1, /* U+10040 - U+10047 : 0x11111111 */ + 1, /* U+10048 - U+1004F : 0x11111111 */ + 1, /* U+10050 - U+10057 : 0x11111111 */ + 1, /* U+10058 - U+1005F : 0x11111111 */ + 1, /* U+10060 - U+10067 : 0x11111111 */ + 1, /* U+10068 - U+1006F : 0x11111111 */ + 1, /* U+10070 - U+10077 : 0x11111111 */ + 1, /* U+10078 - U+1007F : 0x11111111 */ + 1, /* U+10080 - U+10087 : 0x11111111 */ + 1, /* U+10088 - U+1008F : 0x11111111 */ + 1, /* U+10090 - U+10097 : 0x11111111 */ + 1, /* U+10098 - U+1009F : 0x11111111 */ + 1, /* U+100A0 - U+100A7 : 0x11111111 */ + 1, /* U+100A8 - U+100AF : 0x11111111 */ + 1, /* U+100B0 - U+100B7 : 0x11111111 */ + 1, /* U+100B8 - U+100BF : 0x11111111 */ + 1, /* U+100C0 - U+100C7 : 0x11111111 */ + 1, /* U+100C8 - U+100CF : 0x11111111 */ + 1, /* U+100D0 - U+100D7 : 0x11111111 */ + 1, /* U+100D8 - U+100DF : 0x11111111 */ + 1, /* U+100E0 - U+100E7 : 0x11111111 */ + 1, /* U+100E8 - U+100EF : 0x11111111 */ + 1, /* U+100F0 - U+100F7 : 0x11111111 */ + 1, /* U+100F8 - U+100FF : 0x11111111 */ + 154, /* U+10100 - U+10107 : 0x11111191 */ + 1, /* U+10108 - U+1010F : 0x11111111 */ + 1, /* U+10110 - U+10117 : 0x11111111 */ + 1, /* U+10118 - U+1011F : 0x11111111 */ + 1, /* U+10120 - U+10127 : 0x11111111 */ + 1, /* U+10128 - U+1012F : 0x11111111 */ + 1, /* U+10130 - U+10137 : 0x11111111 */ + 1, /* U+10138 - U+1013F : 0x11111111 */ }; -static PRUint32 gBidiCatPat[154] = { +static PRUint8 gBidiCatIdx8[64] = { + 1, /* U+10300 - U+10307 : 0x11111111 */ + 1, /* U+10308 - U+1030F : 0x11111111 */ + 1, /* U+10310 - U+10317 : 0x11111111 */ + 1, /* U+10318 - U+1031F : 0x11111111 */ + 1, /* U+10320 - U+10327 : 0x11111111 */ + 1, /* U+10328 - U+1032F : 0x11111111 */ + 1, /* U+10330 - U+10337 : 0x11111111 */ + 1, /* U+10338 - U+1033F : 0x11111111 */ + 1, /* U+10340 - U+10347 : 0x11111111 */ + 1, /* U+10348 - U+1034F : 0x11111111 */ + 1, /* U+10350 - U+10357 : 0x11111111 */ + 1, /* U+10358 - U+1035F : 0x11111111 */ + 1, /* U+10360 - U+10367 : 0x11111111 */ + 1, /* U+10368 - U+1036F : 0x11111111 */ + 1, /* U+10370 - U+10377 : 0x11111111 */ + 1, /* U+10378 - U+1037F : 0x11111111 */ + 1, /* U+10380 - U+10387 : 0x11111111 */ + 1, /* U+10388 - U+1038F : 0x11111111 */ + 1, /* U+10390 - U+10397 : 0x11111111 */ + 1, /* U+10398 - U+1039F : 0x11111111 */ + 1, /* U+103A0 - U+103A7 : 0x11111111 */ + 1, /* U+103A8 - U+103AF : 0x11111111 */ + 1, /* U+103B0 - U+103B7 : 0x11111111 */ + 1, /* U+103B8 - U+103BF : 0x11111111 */ + 1, /* U+103C0 - U+103C7 : 0x11111111 */ + 1, /* U+103C8 - U+103CF : 0x11111111 */ + 1, /* U+103D0 - U+103D7 : 0x11111111 */ + 1, /* U+103D8 - U+103DF : 0x11111111 */ + 1, /* U+103E0 - U+103E7 : 0x11111111 */ + 1, /* U+103E8 - U+103EF : 0x11111111 */ + 1, /* U+103F0 - U+103F7 : 0x11111111 */ + 1, /* U+103F8 - U+103FF : 0x11111111 */ + 1, /* U+10400 - U+10407 : 0x11111111 */ + 1, /* U+10408 - U+1040F : 0x11111111 */ + 1, /* U+10410 - U+10417 : 0x11111111 */ + 1, /* U+10418 - U+1041F : 0x11111111 */ + 1, /* U+10420 - U+10427 : 0x11111111 */ + 1, /* U+10428 - U+1042F : 0x11111111 */ + 1, /* U+10430 - U+10437 : 0x11111111 */ + 1, /* U+10438 - U+1043F : 0x11111111 */ + 1, /* U+10440 - U+10447 : 0x11111111 */ + 1, /* U+10448 - U+1044F : 0x11111111 */ + 1, /* U+10450 - U+10457 : 0x11111111 */ + 1, /* U+10458 - U+1045F : 0x11111111 */ + 1, /* U+10460 - U+10467 : 0x11111111 */ + 1, /* U+10468 - U+1046F : 0x11111111 */ + 1, /* U+10470 - U+10477 : 0x11111111 */ + 1, /* U+10478 - U+1047F : 0x11111111 */ + 1, /* U+10480 - U+10487 : 0x11111111 */ + 1, /* U+10488 - U+1048F : 0x11111111 */ + 1, /* U+10490 - U+10497 : 0x11111111 */ + 1, /* U+10498 - U+1049F : 0x11111111 */ + 1, /* U+104A0 - U+104A7 : 0x11111111 */ + 1, /* U+104A8 - U+104AF : 0x11111111 */ + 1, /* U+104B0 - U+104B7 : 0x11111111 */ + 1, /* U+104B8 - U+104BF : 0x11111111 */ + 1, /* U+104C0 - U+104C7 : 0x11111111 */ + 1, /* U+104C8 - U+104CF : 0x11111111 */ + 1, /* U+104D0 - U+104D7 : 0x11111111 */ + 1, /* U+104D8 - U+104DF : 0x11111111 */ + 1, /* U+104E0 - U+104E7 : 0x11111111 */ + 1, /* U+104E8 - U+104EF : 0x11111111 */ + 1, /* U+104F0 - U+104F7 : 0x11111111 */ + 1, /* U+104F8 - U+104FF : 0x11111111 */ +}; + +static PRUint8 gBidiCatIdx9[8] = { + 2, /* U+10800 - U+10807 : 0x22222222 */ + 2, /* U+10808 - U+1080F : 0x22222222 */ + 2, /* U+10810 - U+10817 : 0x22222222 */ + 2, /* U+10818 - U+1081F : 0x22222222 */ + 2, /* U+10820 - U+10827 : 0x22222222 */ + 2, /* U+10828 - U+1082F : 0x22222222 */ + 2, /* U+10830 - U+10837 : 0x22222222 */ + 2, /* U+10838 - U+1083F : 0x22222222 */ +}; + +static PRUint8 gBidiCatIdx10[64] = { + 1, /* U+1D000 - U+1D007 : 0x11111111 */ + 1, /* U+1D008 - U+1D00F : 0x11111111 */ + 1, /* U+1D010 - U+1D017 : 0x11111111 */ + 1, /* U+1D018 - U+1D01F : 0x11111111 */ + 1, /* U+1D020 - U+1D027 : 0x11111111 */ + 1, /* U+1D028 - U+1D02F : 0x11111111 */ + 1, /* U+1D030 - U+1D037 : 0x11111111 */ + 1, /* U+1D038 - U+1D03F : 0x11111111 */ + 1, /* U+1D040 - U+1D047 : 0x11111111 */ + 1, /* U+1D048 - U+1D04F : 0x11111111 */ + 1, /* U+1D050 - U+1D057 : 0x11111111 */ + 1, /* U+1D058 - U+1D05F : 0x11111111 */ + 1, /* U+1D060 - U+1D067 : 0x11111111 */ + 1, /* U+1D068 - U+1D06F : 0x11111111 */ + 1, /* U+1D070 - U+1D077 : 0x11111111 */ + 1, /* U+1D078 - U+1D07F : 0x11111111 */ + 1, /* U+1D080 - U+1D087 : 0x11111111 */ + 1, /* U+1D088 - U+1D08F : 0x11111111 */ + 1, /* U+1D090 - U+1D097 : 0x11111111 */ + 1, /* U+1D098 - U+1D09F : 0x11111111 */ + 1, /* U+1D0A0 - U+1D0A7 : 0x11111111 */ + 1, /* U+1D0A8 - U+1D0AF : 0x11111111 */ + 1, /* U+1D0B0 - U+1D0B7 : 0x11111111 */ + 1, /* U+1D0B8 - U+1D0BF : 0x11111111 */ + 1, /* U+1D0C0 - U+1D0C7 : 0x11111111 */ + 1, /* U+1D0C8 - U+1D0CF : 0x11111111 */ + 1, /* U+1D0D0 - U+1D0D7 : 0x11111111 */ + 1, /* U+1D0D8 - U+1D0DF : 0x11111111 */ + 1, /* U+1D0E0 - U+1D0E7 : 0x11111111 */ + 1, /* U+1D0E8 - U+1D0EF : 0x11111111 */ + 1, /* U+1D0F0 - U+1D0F7 : 0x11111111 */ + 1, /* U+1D0F8 - U+1D0FF : 0x11111111 */ + 1, /* U+1D100 - U+1D107 : 0x11111111 */ + 1, /* U+1D108 - U+1D10F : 0x11111111 */ + 1, /* U+1D110 - U+1D117 : 0x11111111 */ + 1, /* U+1D118 - U+1D11F : 0x11111111 */ + 1, /* U+1D120 - U+1D127 : 0x11111111 */ + 1, /* U+1D128 - U+1D12F : 0x11111111 */ + 1, /* U+1D130 - U+1D137 : 0x11111111 */ + 1, /* U+1D138 - U+1D13F : 0x11111111 */ + 1, /* U+1D140 - U+1D147 : 0x11111111 */ + 1, /* U+1D148 - U+1D14F : 0x11111111 */ + 1, /* U+1D150 - U+1D157 : 0x11111111 */ + 1, /* U+1D158 - U+1D15F : 0x11111111 */ + 85, /* U+1D160 - U+1D167 : 0xA1111111 */ + 39, /* U+1D168 - U+1D16F : 0x111111AA */ + 155, /* U+1D170 - U+1D177 : 0xBBBBB111 */ + 156, /* U+1D178 - U+1D17F : 0xAAAAABBB */ + 157, /* U+1D180 - U+1D187 : 0xAAA11AAA */ + 97, /* U+1D188 - U+1D18F : 0x1111AAAA */ + 1, /* U+1D190 - U+1D197 : 0x11111111 */ + 1, /* U+1D198 - U+1D19F : 0x11111111 */ + 1, /* U+1D1A0 - U+1D1A7 : 0x11111111 */ + 158, /* U+1D1A8 - U+1D1AF : 0x11AAAA11 */ + 1, /* U+1D1B0 - U+1D1B7 : 0x11111111 */ + 1, /* U+1D1B8 - U+1D1BF : 0x11111111 */ + 1, /* U+1D1C0 - U+1D1C7 : 0x11111111 */ + 1, /* U+1D1C8 - U+1D1CF : 0x11111111 */ + 1, /* U+1D1D0 - U+1D1D7 : 0x11111111 */ + 1, /* U+1D1D8 - U+1D1DF : 0x11111111 */ + 1, /* U+1D1E0 - U+1D1E7 : 0x11111111 */ + 1, /* U+1D1E8 - U+1D1EF : 0x11111111 */ + 1, /* U+1D1F0 - U+1D1F7 : 0x11111111 */ + 1, /* U+1D1F8 - U+1D1FF : 0x11111111 */ +}; + +static PRUint8 gBidiCatIdx11[160] = { + 9, /* U+1D300 - U+1D307 : 0x99999999 */ + 9, /* U+1D308 - U+1D30F : 0x99999999 */ + 9, /* U+1D310 - U+1D317 : 0x99999999 */ + 9, /* U+1D318 - U+1D31F : 0x99999999 */ + 9, /* U+1D320 - U+1D327 : 0x99999999 */ + 9, /* U+1D328 - U+1D32F : 0x99999999 */ + 9, /* U+1D330 - U+1D337 : 0x99999999 */ + 9, /* U+1D338 - U+1D33F : 0x99999999 */ + 9, /* U+1D340 - U+1D347 : 0x99999999 */ + 9, /* U+1D348 - U+1D34F : 0x99999999 */ + 127, /* U+1D350 - U+1D357 : 0x19999999 */ + 1, /* U+1D358 - U+1D35F : 0x11111111 */ + 1, /* U+1D360 - U+1D367 : 0x11111111 */ + 1, /* U+1D368 - U+1D36F : 0x11111111 */ + 1, /* U+1D370 - U+1D377 : 0x11111111 */ + 1, /* U+1D378 - U+1D37F : 0x11111111 */ + 1, /* U+1D380 - U+1D387 : 0x11111111 */ + 1, /* U+1D388 - U+1D38F : 0x11111111 */ + 1, /* U+1D390 - U+1D397 : 0x11111111 */ + 1, /* U+1D398 - U+1D39F : 0x11111111 */ + 1, /* U+1D3A0 - U+1D3A7 : 0x11111111 */ + 1, /* U+1D3A8 - U+1D3AF : 0x11111111 */ + 1, /* U+1D3B0 - U+1D3B7 : 0x11111111 */ + 1, /* U+1D3B8 - U+1D3BF : 0x11111111 */ + 1, /* U+1D3C0 - U+1D3C7 : 0x11111111 */ + 1, /* U+1D3C8 - U+1D3CF : 0x11111111 */ + 1, /* U+1D3D0 - U+1D3D7 : 0x11111111 */ + 1, /* U+1D3D8 - U+1D3DF : 0x11111111 */ + 1, /* U+1D3E0 - U+1D3E7 : 0x11111111 */ + 1, /* U+1D3E8 - U+1D3EF : 0x11111111 */ + 1, /* U+1D3F0 - U+1D3F7 : 0x11111111 */ + 1, /* U+1D3F8 - U+1D3FF : 0x11111111 */ + 1, /* U+1D400 - U+1D407 : 0x11111111 */ + 1, /* U+1D408 - U+1D40F : 0x11111111 */ + 1, /* U+1D410 - U+1D417 : 0x11111111 */ + 1, /* U+1D418 - U+1D41F : 0x11111111 */ + 1, /* U+1D420 - U+1D427 : 0x11111111 */ + 1, /* U+1D428 - U+1D42F : 0x11111111 */ + 1, /* U+1D430 - U+1D437 : 0x11111111 */ + 1, /* U+1D438 - U+1D43F : 0x11111111 */ + 1, /* U+1D440 - U+1D447 : 0x11111111 */ + 1, /* U+1D448 - U+1D44F : 0x11111111 */ + 1, /* U+1D450 - U+1D457 : 0x11111111 */ + 1, /* U+1D458 - U+1D45F : 0x11111111 */ + 1, /* U+1D460 - U+1D467 : 0x11111111 */ + 1, /* U+1D468 - U+1D46F : 0x11111111 */ + 1, /* U+1D470 - U+1D477 : 0x11111111 */ + 1, /* U+1D478 - U+1D47F : 0x11111111 */ + 1, /* U+1D480 - U+1D487 : 0x11111111 */ + 1, /* U+1D488 - U+1D48F : 0x11111111 */ + 1, /* U+1D490 - U+1D497 : 0x11111111 */ + 1, /* U+1D498 - U+1D49F : 0x11111111 */ + 1, /* U+1D4A0 - U+1D4A7 : 0x11111111 */ + 1, /* U+1D4A8 - U+1D4AF : 0x11111111 */ + 1, /* U+1D4B0 - U+1D4B7 : 0x11111111 */ + 1, /* U+1D4B8 - U+1D4BF : 0x11111111 */ + 1, /* U+1D4C0 - U+1D4C7 : 0x11111111 */ + 1, /* U+1D4C8 - U+1D4CF : 0x11111111 */ + 1, /* U+1D4D0 - U+1D4D7 : 0x11111111 */ + 1, /* U+1D4D8 - U+1D4DF : 0x11111111 */ + 1, /* U+1D4E0 - U+1D4E7 : 0x11111111 */ + 1, /* U+1D4E8 - U+1D4EF : 0x11111111 */ + 1, /* U+1D4F0 - U+1D4F7 : 0x11111111 */ + 1, /* U+1D4F8 - U+1D4FF : 0x11111111 */ + 1, /* U+1D500 - U+1D507 : 0x11111111 */ + 1, /* U+1D508 - U+1D50F : 0x11111111 */ + 1, /* U+1D510 - U+1D517 : 0x11111111 */ + 1, /* U+1D518 - U+1D51F : 0x11111111 */ + 1, /* U+1D520 - U+1D527 : 0x11111111 */ + 1, /* U+1D528 - U+1D52F : 0x11111111 */ + 1, /* U+1D530 - U+1D537 : 0x11111111 */ + 1, /* U+1D538 - U+1D53F : 0x11111111 */ + 1, /* U+1D540 - U+1D547 : 0x11111111 */ + 1, /* U+1D548 - U+1D54F : 0x11111111 */ + 1, /* U+1D550 - U+1D557 : 0x11111111 */ + 1, /* U+1D558 - U+1D55F : 0x11111111 */ + 1, /* U+1D560 - U+1D567 : 0x11111111 */ + 1, /* U+1D568 - U+1D56F : 0x11111111 */ + 1, /* U+1D570 - U+1D577 : 0x11111111 */ + 1, /* U+1D578 - U+1D57F : 0x11111111 */ + 1, /* U+1D580 - U+1D587 : 0x11111111 */ + 1, /* U+1D588 - U+1D58F : 0x11111111 */ + 1, /* U+1D590 - U+1D597 : 0x11111111 */ + 1, /* U+1D598 - U+1D59F : 0x11111111 */ + 1, /* U+1D5A0 - U+1D5A7 : 0x11111111 */ + 1, /* U+1D5A8 - U+1D5AF : 0x11111111 */ + 1, /* U+1D5B0 - U+1D5B7 : 0x11111111 */ + 1, /* U+1D5B8 - U+1D5BF : 0x11111111 */ + 1, /* U+1D5C0 - U+1D5C7 : 0x11111111 */ + 1, /* U+1D5C8 - U+1D5CF : 0x11111111 */ + 1, /* U+1D5D0 - U+1D5D7 : 0x11111111 */ + 1, /* U+1D5D8 - U+1D5DF : 0x11111111 */ + 1, /* U+1D5E0 - U+1D5E7 : 0x11111111 */ + 1, /* U+1D5E8 - U+1D5EF : 0x11111111 */ + 1, /* U+1D5F0 - U+1D5F7 : 0x11111111 */ + 1, /* U+1D5F8 - U+1D5FF : 0x11111111 */ + 1, /* U+1D600 - U+1D607 : 0x11111111 */ + 1, /* U+1D608 - U+1D60F : 0x11111111 */ + 1, /* U+1D610 - U+1D617 : 0x11111111 */ + 1, /* U+1D618 - U+1D61F : 0x11111111 */ + 1, /* U+1D620 - U+1D627 : 0x11111111 */ + 1, /* U+1D628 - U+1D62F : 0x11111111 */ + 1, /* U+1D630 - U+1D637 : 0x11111111 */ + 1, /* U+1D638 - U+1D63F : 0x11111111 */ + 1, /* U+1D640 - U+1D647 : 0x11111111 */ + 1, /* U+1D648 - U+1D64F : 0x11111111 */ + 1, /* U+1D650 - U+1D657 : 0x11111111 */ + 1, /* U+1D658 - U+1D65F : 0x11111111 */ + 1, /* U+1D660 - U+1D667 : 0x11111111 */ + 1, /* U+1D668 - U+1D66F : 0x11111111 */ + 1, /* U+1D670 - U+1D677 : 0x11111111 */ + 1, /* U+1D678 - U+1D67F : 0x11111111 */ + 1, /* U+1D680 - U+1D687 : 0x11111111 */ + 1, /* U+1D688 - U+1D68F : 0x11111111 */ + 1, /* U+1D690 - U+1D697 : 0x11111111 */ + 1, /* U+1D698 - U+1D69F : 0x11111111 */ + 1, /* U+1D6A0 - U+1D6A7 : 0x11111111 */ + 1, /* U+1D6A8 - U+1D6AF : 0x11111111 */ + 1, /* U+1D6B0 - U+1D6B7 : 0x11111111 */ + 1, /* U+1D6B8 - U+1D6BF : 0x11111111 */ + 1, /* U+1D6C0 - U+1D6C7 : 0x11111111 */ + 1, /* U+1D6C8 - U+1D6CF : 0x11111111 */ + 1, /* U+1D6D0 - U+1D6D7 : 0x11111111 */ + 1, /* U+1D6D8 - U+1D6DF : 0x11111111 */ + 1, /* U+1D6E0 - U+1D6E7 : 0x11111111 */ + 1, /* U+1D6E8 - U+1D6EF : 0x11111111 */ + 1, /* U+1D6F0 - U+1D6F7 : 0x11111111 */ + 1, /* U+1D6F8 - U+1D6FF : 0x11111111 */ + 1, /* U+1D700 - U+1D707 : 0x11111111 */ + 1, /* U+1D708 - U+1D70F : 0x11111111 */ + 1, /* U+1D710 - U+1D717 : 0x11111111 */ + 1, /* U+1D718 - U+1D71F : 0x11111111 */ + 1, /* U+1D720 - U+1D727 : 0x11111111 */ + 1, /* U+1D728 - U+1D72F : 0x11111111 */ + 1, /* U+1D730 - U+1D737 : 0x11111111 */ + 1, /* U+1D738 - U+1D73F : 0x11111111 */ + 1, /* U+1D740 - U+1D747 : 0x11111111 */ + 1, /* U+1D748 - U+1D74F : 0x11111111 */ + 1, /* U+1D750 - U+1D757 : 0x11111111 */ + 1, /* U+1D758 - U+1D75F : 0x11111111 */ + 1, /* U+1D760 - U+1D767 : 0x11111111 */ + 1, /* U+1D768 - U+1D76F : 0x11111111 */ + 1, /* U+1D770 - U+1D777 : 0x11111111 */ + 1, /* U+1D778 - U+1D77F : 0x11111111 */ + 1, /* U+1D780 - U+1D787 : 0x11111111 */ + 1, /* U+1D788 - U+1D78F : 0x11111111 */ + 1, /* U+1D790 - U+1D797 : 0x11111111 */ + 1, /* U+1D798 - U+1D79F : 0x11111111 */ + 1, /* U+1D7A0 - U+1D7A7 : 0x11111111 */ + 1, /* U+1D7A8 - U+1D7AF : 0x11111111 */ + 1, /* U+1D7B0 - U+1D7B7 : 0x11111111 */ + 1, /* U+1D7B8 - U+1D7BF : 0x11111111 */ + 1, /* U+1D7C0 - U+1D7C7 : 0x11111111 */ + 159, /* U+1D7C8 - U+1D7CF : 0x55111111 */ + 5, /* U+1D7D0 - U+1D7D7 : 0x55555555 */ + 5, /* U+1D7D8 - U+1D7DF : 0x55555555 */ + 5, /* U+1D7E0 - U+1D7E7 : 0x55555555 */ + 5, /* U+1D7E8 - U+1D7EF : 0x55555555 */ + 5, /* U+1D7F0 - U+1D7F7 : 0x55555555 */ + 5, /* U+1D7F8 - U+1D7FF : 0x55555555 */ +}; + +static PRUint8 gBidiCatIdx12[68] = { + 1, /* U+2F800 - U+2F807 : 0x11111111 */ + 1, /* U+2F808 - U+2F80F : 0x11111111 */ + 1, /* U+2F810 - U+2F817 : 0x11111111 */ + 1, /* U+2F818 - U+2F81F : 0x11111111 */ + 1, /* U+2F820 - U+2F827 : 0x11111111 */ + 1, /* U+2F828 - U+2F82F : 0x11111111 */ + 1, /* U+2F830 - U+2F837 : 0x11111111 */ + 1, /* U+2F838 - U+2F83F : 0x11111111 */ + 1, /* U+2F840 - U+2F847 : 0x11111111 */ + 1, /* U+2F848 - U+2F84F : 0x11111111 */ + 1, /* U+2F850 - U+2F857 : 0x11111111 */ + 1, /* U+2F858 - U+2F85F : 0x11111111 */ + 1, /* U+2F860 - U+2F867 : 0x11111111 */ + 1, /* U+2F868 - U+2F86F : 0x11111111 */ + 1, /* U+2F870 - U+2F877 : 0x11111111 */ + 1, /* U+2F878 - U+2F87F : 0x11111111 */ + 1, /* U+2F880 - U+2F887 : 0x11111111 */ + 1, /* U+2F888 - U+2F88F : 0x11111111 */ + 1, /* U+2F890 - U+2F897 : 0x11111111 */ + 1, /* U+2F898 - U+2F89F : 0x11111111 */ + 1, /* U+2F8A0 - U+2F8A7 : 0x11111111 */ + 1, /* U+2F8A8 - U+2F8AF : 0x11111111 */ + 1, /* U+2F8B0 - U+2F8B7 : 0x11111111 */ + 1, /* U+2F8B8 - U+2F8BF : 0x11111111 */ + 1, /* U+2F8C0 - U+2F8C7 : 0x11111111 */ + 1, /* U+2F8C8 - U+2F8CF : 0x11111111 */ + 1, /* U+2F8D0 - U+2F8D7 : 0x11111111 */ + 1, /* U+2F8D8 - U+2F8DF : 0x11111111 */ + 1, /* U+2F8E0 - U+2F8E7 : 0x11111111 */ + 1, /* U+2F8E8 - U+2F8EF : 0x11111111 */ + 1, /* U+2F8F0 - U+2F8F7 : 0x11111111 */ + 1, /* U+2F8F8 - U+2F8FF : 0x11111111 */ + 1, /* U+2F900 - U+2F907 : 0x11111111 */ + 1, /* U+2F908 - U+2F90F : 0x11111111 */ + 1, /* U+2F910 - U+2F917 : 0x11111111 */ + 1, /* U+2F918 - U+2F91F : 0x11111111 */ + 1, /* U+2F920 - U+2F927 : 0x11111111 */ + 1, /* U+2F928 - U+2F92F : 0x11111111 */ + 1, /* U+2F930 - U+2F937 : 0x11111111 */ + 1, /* U+2F938 - U+2F93F : 0x11111111 */ + 1, /* U+2F940 - U+2F947 : 0x11111111 */ + 1, /* U+2F948 - U+2F94F : 0x11111111 */ + 1, /* U+2F950 - U+2F957 : 0x11111111 */ + 1, /* U+2F958 - U+2F95F : 0x11111111 */ + 1, /* U+2F960 - U+2F967 : 0x11111111 */ + 1, /* U+2F968 - U+2F96F : 0x11111111 */ + 1, /* U+2F970 - U+2F977 : 0x11111111 */ + 1, /* U+2F978 - U+2F97F : 0x11111111 */ + 1, /* U+2F980 - U+2F987 : 0x11111111 */ + 1, /* U+2F988 - U+2F98F : 0x11111111 */ + 1, /* U+2F990 - U+2F997 : 0x11111111 */ + 1, /* U+2F998 - U+2F99F : 0x11111111 */ + 1, /* U+2F9A0 - U+2F9A7 : 0x11111111 */ + 1, /* U+2F9A8 - U+2F9AF : 0x11111111 */ + 1, /* U+2F9B0 - U+2F9B7 : 0x11111111 */ + 1, /* U+2F9B8 - U+2F9BF : 0x11111111 */ + 1, /* U+2F9C0 - U+2F9C7 : 0x11111111 */ + 1, /* U+2F9C8 - U+2F9CF : 0x11111111 */ + 1, /* U+2F9D0 - U+2F9D7 : 0x11111111 */ + 1, /* U+2F9D8 - U+2F9DF : 0x11111111 */ + 1, /* U+2F9E0 - U+2F9E7 : 0x11111111 */ + 1, /* U+2F9E8 - U+2F9EF : 0x11111111 */ + 1, /* U+2F9F0 - U+2F9F7 : 0x11111111 */ + 1, /* U+2F9F8 - U+2F9FF : 0x11111111 */ + 1, /* U+2FA00 - U+2FA07 : 0x11111111 */ + 1, /* U+2FA08 - U+2FA0F : 0x11111111 */ + 1, /* U+2FA10 - U+2FA17 : 0x11111111 */ + 1, /* U+2FA18 - U+2FA1F : 0x11111111 */ +}; + +static PRUint8 gBidiCatIdx13[64] = { + 160, /* U+E0000 - U+E0007 : 0x111111B1 */ + 1, /* U+E0008 - U+E000F : 0x11111111 */ + 1, /* U+E0010 - U+E0017 : 0x11111111 */ + 1, /* U+E0018 - U+E001F : 0x11111111 */ + 11, /* U+E0020 - U+E0027 : 0xBBBBBBBB */ + 11, /* U+E0028 - U+E002F : 0xBBBBBBBB */ + 11, /* U+E0030 - U+E0037 : 0xBBBBBBBB */ + 11, /* U+E0038 - U+E003F : 0xBBBBBBBB */ + 11, /* U+E0040 - U+E0047 : 0xBBBBBBBB */ + 11, /* U+E0048 - U+E004F : 0xBBBBBBBB */ + 11, /* U+E0050 - U+E0057 : 0xBBBBBBBB */ + 11, /* U+E0058 - U+E005F : 0xBBBBBBBB */ + 11, /* U+E0060 - U+E0067 : 0xBBBBBBBB */ + 11, /* U+E0068 - U+E006F : 0xBBBBBBBB */ + 11, /* U+E0070 - U+E0077 : 0xBBBBBBBB */ + 11, /* U+E0078 - U+E007F : 0xBBBBBBBB */ + 1, /* U+E0080 - U+E0087 : 0x11111111 */ + 1, /* U+E0088 - U+E008F : 0x11111111 */ + 1, /* U+E0090 - U+E0097 : 0x11111111 */ + 1, /* U+E0098 - U+E009F : 0x11111111 */ + 1, /* U+E00A0 - U+E00A7 : 0x11111111 */ + 1, /* U+E00A8 - U+E00AF : 0x11111111 */ + 1, /* U+E00B0 - U+E00B7 : 0x11111111 */ + 1, /* U+E00B8 - U+E00BF : 0x11111111 */ + 1, /* U+E00C0 - U+E00C7 : 0x11111111 */ + 1, /* U+E00C8 - U+E00CF : 0x11111111 */ + 1, /* U+E00D0 - U+E00D7 : 0x11111111 */ + 1, /* U+E00D8 - U+E00DF : 0x11111111 */ + 1, /* U+E00E0 - U+E00E7 : 0x11111111 */ + 1, /* U+E00E8 - U+E00EF : 0x11111111 */ + 1, /* U+E00F0 - U+E00F7 : 0x11111111 */ + 1, /* U+E00F8 - U+E00FF : 0x11111111 */ + 10, /* U+E0100 - U+E0107 : 0xAAAAAAAA */ + 10, /* U+E0108 - U+E010F : 0xAAAAAAAA */ + 10, /* U+E0110 - U+E0117 : 0xAAAAAAAA */ + 10, /* U+E0118 - U+E011F : 0xAAAAAAAA */ + 10, /* U+E0120 - U+E0127 : 0xAAAAAAAA */ + 10, /* U+E0128 - U+E012F : 0xAAAAAAAA */ + 10, /* U+E0130 - U+E0137 : 0xAAAAAAAA */ + 10, /* U+E0138 - U+E013F : 0xAAAAAAAA */ + 10, /* U+E0140 - U+E0147 : 0xAAAAAAAA */ + 10, /* U+E0148 - U+E014F : 0xAAAAAAAA */ + 10, /* U+E0150 - U+E0157 : 0xAAAAAAAA */ + 10, /* U+E0158 - U+E015F : 0xAAAAAAAA */ + 10, /* U+E0160 - U+E0167 : 0xAAAAAAAA */ + 10, /* U+E0168 - U+E016F : 0xAAAAAAAA */ + 10, /* U+E0170 - U+E0177 : 0xAAAAAAAA */ + 10, /* U+E0178 - U+E017F : 0xAAAAAAAA */ + 10, /* U+E0180 - U+E0187 : 0xAAAAAAAA */ + 10, /* U+E0188 - U+E018F : 0xAAAAAAAA */ + 10, /* U+E0190 - U+E0197 : 0xAAAAAAAA */ + 10, /* U+E0198 - U+E019F : 0xAAAAAAAA */ + 10, /* U+E01A0 - U+E01A7 : 0xAAAAAAAA */ + 10, /* U+E01A8 - U+E01AF : 0xAAAAAAAA */ + 10, /* U+E01B0 - U+E01B7 : 0xAAAAAAAA */ + 10, /* U+E01B8 - U+E01BF : 0xAAAAAAAA */ + 10, /* U+E01C0 - U+E01C7 : 0xAAAAAAAA */ + 10, /* U+E01C8 - U+E01CF : 0xAAAAAAAA */ + 10, /* U+E01D0 - U+E01D7 : 0xAAAAAAAA */ + 10, /* U+E01D8 - U+E01DF : 0xAAAAAAAA */ + 10, /* U+E01E0 - U+E01E7 : 0xAAAAAAAA */ + 10, /* U+E01E8 - U+E01EF : 0xAAAAAAAA */ + 1, /* U+E01F0 - U+E01F7 : 0x11111111 */ + 1, /* U+E01F8 - U+E01FF : 0x11111111 */ +}; + +static PRUint32 gBidiCatPat[161] = { 0x00000000, /* 0 */ 0x11111111, /* 1 */ 0x22222222, /* 2 */ @@ -2047,9 +2553,16 @@ static PRUint32 gBidiCatPat[154] = { 0x68787999, /* 151 */ 0x17799977, /* 152 */ 0x11999991, /* 153 */ + 0x11111191, /* 154 */ + 0xBBBBB111, /* 155 */ + 0xAAAAABBB, /* 156 */ + 0xAAA11AAA, /* 157 */ + 0x11AAAA11, /* 158 */ + 0x55111111, /* 159 */ + 0x111111B1, /* 160 */ }; -static eBidiCategory GetBidiCat(PRUnichar u) +static eBidiCategory GetBidiCat(PRUint32 u) { PRUint32 pat; PRUint16 patidx; @@ -2057,82 +2570,80 @@ static eBidiCategory GetBidiCat(PRUnichar u) /* Handle blocks which use index table mapping */ /* Handle U+0000 to U+07FF */ - if (u<=((PRUnichar)0x07FF)) { + if (u<=((PRUint32)0x07FF)) { patidx = gBidiCatIdx1 [( u >> 3 )]; - if (patidx < 0x10) - return (eBidiCategory)patidx; - else { - pat = gBidiCatPat[patidx]; - return (eBidiCategory)((pat >> ((u % 8) * 4)) & 0x0F); - } } /* Handle U+0900 to U+19FF */ - if ((((PRUnichar)0x0900)<=u)&&(u<=((PRUnichar)0x19FF))) { - patidx = gBidiCatIdx2 [( (u -(PRUnichar) 0x0900) >> 3 )]; - if (patidx < 0x10) - return (eBidiCategory)patidx; - else { - pat = gBidiCatPat[patidx]; - return (eBidiCategory)((pat >> ((u % 8) * 4)) & 0x0F); - } + else if ((((PRUint32)0x0900)<=u)&&(u<=((PRUint32)0x19FF))) { + patidx = gBidiCatIdx2 [( (u -(PRUint32) 0x0900) >> 3 )]; } /* Handle U+1D00 to U+2BFF */ - if ((((PRUnichar)0x1D00)<=u)&&(u<=((PRUnichar)0x2BFF))) { - patidx = gBidiCatIdx3 [( (u -(PRUnichar) 0x1D00) >> 3 )]; - if (patidx < 0x10) - return (eBidiCategory)patidx; - else { - pat = gBidiCatPat[patidx]; - return (eBidiCategory)((pat >> ((u % 8) * 4)) & 0x0F); - } + else if ((((PRUint32)0x1D00)<=u)&&(u<=((PRUint32)0x2BFF))) { + patidx = gBidiCatIdx3 [( (u -(PRUint32) 0x1D00) >> 3 )]; } /* Handle U+2E80 to U+33FF */ - if ((((PRUnichar)0x2E80)<=u)&&(u<=((PRUnichar)0x33FF))) { - patidx = gBidiCatIdx4 [( (u -(PRUnichar) 0x2E80) >> 3 )]; - if (patidx < 0x10) - return (eBidiCategory)patidx; - else { - pat = gBidiCatPat[patidx]; - return (eBidiCategory)((pat >> ((u % 8) * 4)) & 0x0F); - } + else if ((((PRUint32)0x2E80)<=u)&&(u<=((PRUint32)0x33FF))) { + patidx = gBidiCatIdx4 [( (u -(PRUint32) 0x2E80) >> 3 )]; } /* Handle U+4DC0 to U+4DFF */ - if ((((PRUnichar)0x4DC0)<=u)&&(u<=((PRUnichar)0x4DFF))) { - patidx = gBidiCatIdx5 [( (u -(PRUnichar) 0x4DC0) >> 3 )]; - if (patidx < 0x10) - return (eBidiCategory)patidx; - else { - pat = gBidiCatPat[patidx]; - return (eBidiCategory)((pat >> ((u % 8) * 4)) & 0x0F); - } + else if ((((PRUint32)0x4DC0)<=u)&&(u<=((PRUint32)0x4DFF))) { + patidx = gBidiCatIdx5 [( (u -(PRUint32) 0x4DC0) >> 3 )]; } /* Handle U+A000 to U+A4FF */ - if ((((PRUnichar)0xA000)<=u)&&(u<=((PRUnichar)0xA4FF))) { - patidx = gBidiCatIdx6 [( (u -(PRUnichar) 0xA000) >> 3 )]; - if (patidx < 0x10) - return (eBidiCategory)patidx; - else { - pat = gBidiCatPat[patidx]; - return (eBidiCategory)((pat >> ((u % 8) * 4)) & 0x0F); - } + else if ((((PRUint32)0xA000)<=u)&&(u<=((PRUint32)0xA4FF))) { + patidx = gBidiCatIdx6 [( (u -(PRUint32) 0xA000) >> 3 )]; } - /* Handle U+F900 to U+FFFF */ - if (((PRUnichar)0xF900)<=u) { - patidx = gBidiCatIdx7 [( (u -(PRUnichar) 0xF900) >> 3 )]; - if (patidx < 0x10) - return (eBidiCategory)patidx; - else { - pat = gBidiCatPat[patidx]; - return (eBidiCategory)((pat >> ((u % 8) * 4)) & 0x0F); - } + /* Handle U+F900 to U+1013F */ + else if ((((PRUint32)0xF900)<=u)&&(u<=((PRUint32)0x1013F))) { + patidx = gBidiCatIdx7 [( (u -(PRUint32) 0xF900) >> 3 )]; } - return eBidiCat_L; /* UNDEFINE = L */ + /* Handle U+10300 to U+104FF */ + else if ((((PRUint32)0x10300)<=u)&&(u<=((PRUint32)0x104FF))) { + patidx = gBidiCatIdx8 [( (u -(PRUint32) 0x10300) >> 3 )]; + } + + /* Handle U+10800 to U+1083F */ + else if ((((PRUint32)0x10800)<=u)&&(u<=((PRUint32)0x1083F))) { + patidx = gBidiCatIdx9 [( (u -(PRUint32) 0x10800) >> 3 )]; + } + + /* Handle U+1D000 to U+1D1FF */ + else if ((((PRUint32)0x1D000)<=u)&&(u<=((PRUint32)0x1D1FF))) { + patidx = gBidiCatIdx10 [( (u -(PRUint32) 0x1D000) >> 3 )]; + } + + /* Handle U+1D300 to U+1D7FF */ + else if ((((PRUint32)0x1D300)<=u)&&(u<=((PRUint32)0x1D7FF))) { + patidx = gBidiCatIdx11 [( (u -(PRUint32) 0x1D300) >> 3 )]; + } + + /* Handle U+2F800 to U+2FA1F */ + else if ((((PRUint32)0x2F800)<=u)&&(u<=((PRUint32)0x2FA1F))) { + patidx = gBidiCatIdx12 [( (u -(PRUint32) 0x2F800) >> 3 )]; + } + + /* Handle U+E0000 to U+E01FF */ + else if ((((PRUint32)0xE0000)<=u)&&(u<=((PRUint32)0xE01FF))) { + patidx = gBidiCatIdx13 [( (u -(PRUint32) 0xE0000) >> 3 )]; + } + + else { + return eBidiCat_L; /* UNDEFINE = L */ + } + + if (patidx < 0x10) + return (eBidiCategory)patidx; + else { + pat = gBidiCatPat[patidx]; + return (eBidiCategory)((pat >> ((u % 8) * 4)) & 0x0F); + } } -/* total data size = 2464 */ + +/* total data size = 2960 */ diff --git a/mozilla/layout/base/src/nsBidi.cpp b/mozilla/layout/base/src/nsBidi.cpp index e751b7dfd90..eea27dd04eb 100644 --- a/mozilla/layout/base/src/nsBidi.cpp +++ b/mozilla/layout/base/src/nsBidi.cpp @@ -518,7 +518,7 @@ void nsBidi::GetDirProps(const PRUnichar *aText) uchar=aText[i]; if(!IS_FIRST_SURROGATE(uchar) || i+1==length || !IS_SECOND_SURROGATE(aText[i+1])) { /* not a surrogate pair */ - flags|=DIRPROP_FLAG(dirProps[i]=dirProp=GetCharType(uchar)); + flags|=DIRPROP_FLAG(dirProps[i]=dirProp=GetCharType((PRUint32)uchar)); } else { /* a surrogate pair */ dirProps[i++]=BN; /* first surrogate in the pair gets the BN type */ @@ -548,7 +548,7 @@ void nsBidi::GetDirProps(const PRUnichar *aText) uchar=aText[i]; if(!IS_FIRST_SURROGATE(uchar) || i+1==length || !IS_SECOND_SURROGATE(aText[i+1])) { /* not a surrogate pair */ - flags|=DIRPROP_FLAG(dirProps[i]=GetCharType(uchar)); + flags|=DIRPROP_FLAG(dirProps[i]=GetCharType((PRUint32)uchar)); } else { /* a surrogate pair */ dirProps[i++]=BN; /* second surrogate in the pair gets the BN type */ @@ -2236,7 +2236,7 @@ PRInt32 nsBidi::doWriteReverse(const PRUnichar *src, PRInt32 srcLength, i=0; do { ch=*src++; - if (!IsBidiControl(ch)) { + if (!IsBidiControl((PRUint32)ch)) { ++i; } } while(--length>0); @@ -2304,7 +2304,7 @@ nsresult nsBidi::WriteReverse(const PRUnichar *aSrc, PRInt32 aSrcLength, PRUnich return NS_OK; } -eBidiCategory nsBidi::GetBidiCategory(PRUnichar aChar) +eBidiCategory nsBidi::GetBidiCategory(PRUint32 aChar) { eBidiCategory oResult = GetBidiCat(aChar); if (eBidiCat_CC == oResult) @@ -2312,21 +2312,21 @@ eBidiCategory nsBidi::GetBidiCategory(PRUnichar aChar) return oResult; } -PRBool nsBidi::IsBidiCategory(PRUnichar aChar, eBidiCategory aBidiCategory) +PRBool nsBidi::IsBidiCategory(PRUint32 aChar, eBidiCategory aBidiCategory) { return (GetBidiCategory(aChar) == aBidiCategory); } #define ZWNJ 0x200c -PRBool nsBidi::IsBidiControl(PRUnichar aChar) +PRBool nsBidi::IsBidiControl(PRUint32 aChar) { // This method is used when stripping Bidi control characters for // display, so it will return TRUE for LRM, RLM, ZWJ and ZWNJ as // well as the characters with category eBidiCat_CC - return (eBidiCat_CC == GetBidiCat(aChar) || ((aChar)&0xfffc)==ZWNJ); + return (eBidiCat_CC == GetBidiCat(aChar) || ((aChar)&0xfffffc)==ZWNJ); } -nsCharType nsBidi::GetCharType(PRUnichar aChar) +nsCharType nsBidi::GetCharType(PRUint32 aChar) { nsCharType oResult; eBidiCategory bCat = GetBidiCat(aChar); diff --git a/mozilla/layout/base/src/nsBidiPresUtils.cpp b/mozilla/layout/base/src/nsBidiPresUtils.cpp index 71b33cc4a09..052ff5bff8d 100644 --- a/mozilla/layout/base/src/nsBidiPresUtils.cpp +++ b/mozilla/layout/base/src/nsBidiPresUtils.cpp @@ -932,7 +932,9 @@ nsBidiPresUtils::StripBidiControlCharacters(PRUnichar* aText, PRInt32 stripLen = 0; for (PRInt32 i = 0; i < aTextLength; i++) { - if (mBidiEngine->IsBidiControl(aText[i])) { + // XXX: This silently ignores surrogate characters. + // As of Unicode 4.0, all Bidi control characters are within the BMP. + if (mBidiEngine->IsBidiControl((PRUint32)aText[i])) { ++stripLen; } else { diff --git a/mozilla/layout/tools/genbidicattable.pl b/mozilla/layout/tools/genbidicattable.pl index 571419bc005..80f92cdaa57 100644 --- a/mozilla/layout/tools/genbidicattable.pl +++ b/mozilla/layout/tools/genbidicattable.pl @@ -93,21 +93,41 @@ open ( OUT , "> ../base/src/bidicattable.h") $npl = <) { # XXX - How can this be made more flexible as new blocks are added to the UCDB? @range = ( - 0x0000, 0x07ff, - 0x0900, 0x18ff, - 0x1e00, 0x28ff, - 0x2e80, 0x33ff, - 0xa000, 0xa4ff, - 0xf900, 0xffff + 0x0000, 0x07ff, + 0x0900, 0x19ff, + 0x1d00, 0x2bff, + 0x2e80, 0x33ff, + 0x4dc0, 0x4dff, + 0xa000, 0xa4ff, + 0xf900, 0x1013f, + 0x10300, 0x104ff, + 0x10800, 0x1083f, + 0x1d000, 0x1d1ff, + 0x1d300, 0x1d7ff, + 0x2f800, 0x2fa1f, + 0xe0000, 0xe01ff ); @@ -211,15 +238,19 @@ for($t = 1; $t <= $tt; $t++) for($j = 0; $j < 8 ; $j++) { - #defaults for unassigned characters -- see table 3.7 in the Unicode Bidi Algorithm + #defaults for unassigned characters + #see http://www.unicode.org/Public/UNIDATA/UCD.html#Bidi_Class $test = ($i << 3) + $j; - if ((($test >= 0x0590) && ($test <= 0x5FF)) - || (($test >= 0xFB1D) && ($test <= 0xFB4F))) + if ((($test >= 0x0590) && ($test <= 0x5FF)) || + (($test >= 0x07C0) && ($test <= 0x8FF)) || + (($test >= 0xFB1D) && ($test <= 0xFB4F)) || + (($test >= 0x10800) && ($test <=0x10FFF))) { $default = $map{"R"}; - } elsif ((($test >= 0x0600) && ($test <= 0x7BF)) - || (($test >= 0xFB50) && ($test <= 0xFDFF)) - || (($test >= 0xFE70) && ($test <= 0xFEFF))) + } elsif ((($test >= 0x0600) && ($test <= 0x7BF)) || + (($test >= 0xFB50) && ($test <= 0xFDCF)) || + (($test >= 0xFDF0) && ($test <= 0xFDFF)) || + (($test >= 0xFE70) && ($test <= 0xFEFE))) { $default = $map{"AL"}; } else @@ -296,35 +327,9 @@ for($i = 0 ; $i < $newidx; $i++) printf OUT "};\n\n"; $totaldata += $newidx * 4; -printf OUT "static eBidiCategory GetBidiCat(PRUnichar u)\n{\n"; +printf OUT "static eBidiCategory GetBidiCat(PRUint32 u)\n{\n"; printf OUT " PRUint32 pat;\n"; printf OUT " PRUint16 patidx;\n\n"; -printf OUT " /* Handle blocks which use index table mapping */ \n\n"; -for($t = 1; $t <= $tt; $t++) -{ - $tl = $range[($t-1) * 2]; - $th = $range[($t-1) * 2 + 1]; - if ($tl == 0) { - printf OUT " /* Handle U+%04X to U+%04X */\n", $tl, $th; - printf OUT " if (u<=((PRUnichar)0x%04X)) {\n", $th; - printf OUT " patidx = gBidiCatIdx%d [( u >> 3 )];\n", $t; - } elsif ($th == 0xFFFF) { - printf OUT " /* Handle U+%04X to U+%04X */\n", $tl, $th; - printf OUT " if (((PRUnichar)0x%04X)<=u) {\n", $tl; - printf OUT " patidx = gBidiCatIdx%d [( (u -(PRUnichar) 0x%04X) >> 3 )];\n", $t, $tl; - } else { - printf OUT " /* Handle U+%04X to U+%04X */\n", $tl, $th; - printf OUT " if ((((PRUnichar)0x%04X)<=u)&&(u<=((PRUnichar)0x%04X))) {\n", $tl, $th; - printf OUT " patidx = gBidiCatIdx%d [( (u -(PRUnichar) 0x%04X) >> 3 )];\n", $t, $tl; - } - printf OUT " if (patidx < 0x10)\n"; - printf OUT " return (eBidiCategory)patidx;\n"; - printf OUT " else {\n"; - printf OUT " pat = gBidiCatPat[patidx];\n"; - printf OUT " return (eBidiCategory)((pat >> ((u % 8) * 4)) & 0x0F);\n"; - printf OUT " }\n"; - printf OUT " }\n\n"; -} @special = keys(%sh); $sp = 0; @@ -337,14 +342,37 @@ foreach $s ( sort(@special) ) { printf OUT " /* Handle blocks which share the same category */\n\n"; } printf OUT " /* Handle %s block */\n", substr($s, 1); - printf OUT " if((((PRUnichar)0x%s)<=u)&&(u<=((PRUnichar)0x%s))) \n", $sl{$s}, $sh{$s}; + printf OUT " if((((PRUint32)0x%s)<=u)&&(u<=((PRUint32)0x%s))) \n", $sl{$s}, $sh{$s}; printf OUT " return eBidiCat_$by_value{$sc{$s}}; \n\n"; } } +printf OUT " /* Handle blocks which use index table mapping */ \n\n"; +for($t = 1; $t <= $tt; $t++) +{ + $tl = $range[($t-1) * 2]; + $th = $range[($t-1) * 2 + 1]; + if ($tl == 0) { + printf OUT " /* Handle U+%04X to U+%04X */\n", $tl, $th; + printf OUT " if (u<=((PRUint32)0x%04X)) {\n", $th; + printf OUT " patidx = gBidiCatIdx%d [( u >> 3 )];\n", $t; + } else { + printf OUT " /* Handle U+%04X to U+%04X */\n", $tl, $th; + printf OUT " else if ((((PRUint32)0x%04X)<=u)&&(u<=((PRUint32)0x%04X))) {\n", $tl, $th; + printf OUT " patidx = gBidiCatIdx%d [( (u -(PRUint32) 0x%04X) >> 3 )];\n", $t, $tl; + } + printf OUT " }\n\n"; +} +printf OUT " else {\n"; +printf OUT " return eBidiCat_L; /* UNDEFINE = L */\n"; +printf OUT " }\n\n"; - -printf OUT " return eBidiCat_L; /* UNDEFINE = L */\n}\n"; +printf OUT " if (patidx < 0x10)\n"; +printf OUT " return (eBidiCategory)patidx;\n"; +printf OUT " else {\n"; +printf OUT " pat = gBidiCatPat[patidx];\n"; +printf OUT " return (eBidiCategory)((pat >> ((u % 8) * 4)) & 0x0F);\n"; +printf OUT " }\n}\n\n"; printf OUT "/* total data size = $totaldata */\n"; print "total = $totaldata\n"; diff --git a/mozilla/layout/xul/base/src/nsTextBoxFrame.cpp b/mozilla/layout/xul/base/src/nsTextBoxFrame.cpp index f497f434b65..b8fd4d90b48 100644 --- a/mozilla/layout/xul/base/src/nsTextBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsTextBoxFrame.cpp @@ -507,7 +507,12 @@ nsTextBoxFrame::CalculateTitleForWidth(nsIPresContext* aPresContext, #ifdef IBMBIDI PRInt32 length = mTitle.Length(); for (PRInt32 i = 0; i < length; i++) { - if (CHAR_IS_BIDI(mTitle.CharAt(i) ) ) { + if ((CHAR_IS_BIDI(mTitle.CharAt(i)) ) || + ((IS_HIGH_SURROGATE(mTitle.CharAt(i))) && + (++i < length) && + (IS_LOW_SURROGATE(mTitle.CharAt(i))) && + (CHAR_IS_BIDI(SURROGATE_TO_UCS4(mTitle.CharAt(i-1), + mTitle.CharAt(i)))))) { mState |= NS_FRAME_IS_BIDI; break; } @@ -538,6 +543,7 @@ nsTextBoxFrame::CalculateTitleForWidth(nsIPresContext* aPresContext, aWidth -= ellipsisWidth; + // XXX: This whole block should probably take surrogates into account // ok crop things switch (mCropType) {