ICU-9014 make hasScript(c, sc) == sc in scx(c)
X-SVN-Rev: 31331
This commit is contained in:
parent
bf7701a030
commit
3fd6a0e7f2
@ -1027,18 +1027,18 @@ public final class UScript {
|
||||
}
|
||||
|
||||
/**
|
||||
* Is code point c used in script sc?
|
||||
* That is, does code point c have the Script property value sc,
|
||||
* or do code point c's Script_Extensions include script code sc?
|
||||
* Do the Script_Extensions of code point c contain script sc?
|
||||
* If c does not have explicit Script_Extensions, then this tests whether
|
||||
* c has the Script property value sc.
|
||||
*
|
||||
* Some characters are commonly used in multiple scripts.
|
||||
* <p>Some characters are commonly used in multiple scripts.
|
||||
* For more information, see UAX #24: http://www.unicode.org/reports/tr24/.
|
||||
*
|
||||
* The Script_Extensions property is provisional. It may be modified or removed
|
||||
* <p>The Script_Extensions property is provisional. It may be modified or removed
|
||||
* in future versions of the Unicode Standard, and thus in ICU.
|
||||
* @param c code point
|
||||
* @param sc script code
|
||||
* @return true if Script(c)==sc or sc is in Script_Extensions(c)
|
||||
* @return true if sc is in Script_Extensions(c)
|
||||
* @draft ICU 4.6
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
@ -1050,18 +1050,9 @@ public final class UScript {
|
||||
|
||||
char[] scriptExtensions=UCharacterProperty.INSTANCE.m_scriptExtensions_;
|
||||
int scx=scriptX&UCharacterProperty.SCRIPT_MASK_; // index into scriptExtensions
|
||||
int script;
|
||||
if(scriptX<UCharacterProperty.SCRIPT_X_WITH_INHERITED) {
|
||||
script=UScript.COMMON;
|
||||
} else if(scriptX<UCharacterProperty.SCRIPT_X_WITH_OTHER) {
|
||||
script=UScript.INHERITED;
|
||||
} else {
|
||||
script=scriptExtensions[scx];
|
||||
if(scriptX>=UCharacterProperty.SCRIPT_X_WITH_OTHER) {
|
||||
scx=scriptExtensions[scx+1];
|
||||
}
|
||||
if(sc==script) {
|
||||
return true;
|
||||
}
|
||||
if(sc>0x7fff) {
|
||||
// Guard against bogus input that would
|
||||
// make us go past the Script_Extensions terminator.
|
||||
|
@ -341,7 +341,7 @@ public class TestUScript extends TestFmwk {
|
||||
errln("UScript.hasScript(U+063F, ...) is wrong");
|
||||
}
|
||||
if(!(
|
||||
UScript.hasScript(0x0640, UScript.COMMON) && /* main Script value */
|
||||
!UScript.hasScript(0x0640, UScript.COMMON) && /* main Script value */
|
||||
UScript.hasScript(0x0640, UScript.ARABIC) &&
|
||||
UScript.hasScript(0x0640, UScript.SYRIAC) &&
|
||||
!UScript.hasScript(0x0640, UScript.THAANA))
|
||||
@ -349,7 +349,7 @@ public class TestUScript extends TestFmwk {
|
||||
errln("UScript.hasScript(U+0640, ...) is wrong");
|
||||
}
|
||||
if(!(
|
||||
UScript.hasScript(0x0650, UScript.INHERITED) && /* main Script value */
|
||||
!UScript.hasScript(0x0650, UScript.INHERITED) && /* main Script value */
|
||||
UScript.hasScript(0x0650, UScript.ARABIC) &&
|
||||
UScript.hasScript(0x0650, UScript.SYRIAC) &&
|
||||
!UScript.hasScript(0x0650, UScript.THAANA))
|
||||
@ -357,7 +357,7 @@ public class TestUScript extends TestFmwk {
|
||||
errln("UScript.hasScript(U+0650, ...) is wrong");
|
||||
}
|
||||
if(!(
|
||||
UScript.hasScript(0x0660, UScript.COMMON) && /* main Script value */
|
||||
!UScript.hasScript(0x0660, UScript.COMMON) && /* main Script value */
|
||||
UScript.hasScript(0x0660, UScript.ARABIC) &&
|
||||
!UScript.hasScript(0x0660, UScript.SYRIAC) &&
|
||||
UScript.hasScript(0x0660, UScript.THAANA))
|
||||
|
Loading…
Reference in New Issue
Block a user