ICU-11802 add 4 Emoji properties from emoji-data.txt 2.0

X-SVN-Rev: 38184
This commit is contained in:
Markus Scherer 2016-01-21 04:41:55 +00:00
parent c10fdc6e29
commit cbc1e34b7f
4 changed files with 64 additions and 8 deletions

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 1996-2015, International Business Machines Corporation and
* Copyright (C) 1996-2016, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*/
@ -384,6 +384,10 @@ public final class UCharacterProperty
return !Normalizer2Impl.UTF16Plus.equal(dest, src);
}
},
new BinaryProperty(2, 1<<PROPS_2_EMOJI),
new BinaryProperty(2, 1<<PROPS_2_EMOJI_PRESENTATION),
new BinaryProperty(2, 1<<PROPS_2_EMOJI_MODIFIER),
new BinaryProperty(2, 1<<PROPS_2_EMOJI_MODIFIER_BASE),
};
public boolean hasBinaryProperty(int c, int which) {
@ -1101,13 +1105,19 @@ public final class UCharacterProperty
/*
* Properties in vector word 2
* Bits
* 31..26 reserved
* 31..28 http://www.unicode.org/reports/tr51/#Emoji_Properties
* 27..26 reserved
* 25..20 Line Break
* 19..15 Sentence Break
* 14..10 Word Break
* 9.. 5 Grapheme Cluster Break
* 4.. 0 Decomposition Type
*/
private static final int PROPS_2_EMOJI = 28;
private static final int PROPS_2_EMOJI_PRESENTATION = 29;
private static final int PROPS_2_EMOJI_MODIFIER = 30;
private static final int PROPS_2_EMOJI_MODIFIER_BASE = 31;
private static final int LB_MASK = 0x03f00000;
private static final int LB_SHIFT = 20;

View file

@ -1,6 +1,6 @@
/**
*******************************************************************************
* Copyright (C) 1996-2014, International Business Machines Corporation and
* Copyright (C) 1996-2016, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*/
@ -512,12 +512,44 @@ public interface UProperty
* @stable ICU 4.4
*/
public static final int CHANGES_WHEN_NFKC_CASEFOLDED=56;
/**
* Binary property Emoji.
* See http://www.unicode.org/reports/tr51/#Emoji_Properties
*
* @draft ICU 57
* @provisional This API might change or be removed in a future release.
*/
public static final int EMOJI=57;
/**
* Binary property Emoji_Presentation.
* See http://www.unicode.org/reports/tr51/#Emoji_Properties
*
* @draft ICU 57
* @provisional This API might change or be removed in a future release.
*/
public static final int EMOJI_PRESENTATION=58;
/**
* Binary property Emoji_Modifier.
* See http://www.unicode.org/reports/tr51/#Emoji_Properties
*
* @draft ICU 57
* @provisional This API might change or be removed in a future release.
*/
public static final int EMOJI_MODIFIER=59;
/**
* Binary property Emoji_Modifier_Base.
* See http://www.unicode.org/reports/tr51/#Emoji_Properties
*
* @draft ICU 57
* @provisional This API might change or be removed in a future release.
*/
public static final int EMOJI_MODIFIER_BASE=60;
/**
/**
* One more than the last constant for binary Unicode properties.
* @stable ICU 2.6
*/
public static final int BINARY_LIMIT = 57;
public static final int BINARY_LIMIT = 61;
/**
* Enumerated property Bidi_Class.

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:626ed2484fc25dccca603b448372f479724a094a6006aa89be6764cc1af30fc4
size 11622359
oid sha256:3d7bedcc7a61859528568ec7a824629a67aad028319692cf798f89fd464ccc84
size 11622863

View file

@ -1,6 +1,6 @@
/**
*******************************************************************************
* Copyright (C) 1996-2015, International Business Machines Corporation and
* Copyright (C) 1996-2016, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*/
@ -2481,6 +2481,20 @@ public final class UCharacterTest extends TestFmwk
assertTrue("bpt=Close is a subset of Pe", pe.containsAll(bpt_close));
}
public void TestEmojiProperties() {
assertFalse("space is not Emoji", UCharacter.hasBinaryProperty(0x20, UProperty.EMOJI));
assertTrue("shooting star is Emoji", UCharacter.hasBinaryProperty(0x1F320, UProperty.EMOJI));
UnicodeSet emoji = new UnicodeSet("[:Emoji:]");
assertTrue("lots of Emoji", emoji.size() > 700);
assertTrue("shooting star is Emoji_Presentation",
UCharacter.hasBinaryProperty(0x1F320, UProperty.EMOJI_PRESENTATION));
assertTrue("Fitzpatrick 6 is Emoji_Modifier",
UCharacter.hasBinaryProperty(0x1F3FF, UProperty.EMOJI_MODIFIER));
assertTrue("happy person is Emoji_Modifier_Base",
UCharacter.hasBinaryProperty(0x1F64B, UProperty.EMOJI_MODIFIER_BASE));
}
public void TestIsBMP()
{
int ch[] = {0x0, -1, 0xffff, 0x10ffff, 0xff, 0x1ffff};