]> granicus.if.org Git - icu/commitdiff
ICU-11802 add 4 Emoji properties from emoji-data.txt 2.0
authorMarkus Scherer <markus.icu@gmail.com>
Thu, 21 Jan 2016 04:41:55 +0000 (04:41 +0000)
committerMarkus Scherer <markus.icu@gmail.com>
Thu, 21 Jan 2016 04:41:55 +0000 (04:41 +0000)
X-SVN-Rev: 38184

icu4j/main/classes/core/src/com/ibm/icu/impl/UCharacterProperty.java
icu4j/main/classes/core/src/com/ibm/icu/lang/UProperty.java
icu4j/main/shared/data/icudata.jar
icu4j/main/tests/core/src/com/ibm/icu/dev/test/lang/UCharacterTest.java

index fc28c9d44fe1d96085af01c1bf6db267966deca3..0af9f5cf8088cee66a177a6c029eb3c71d2cd44e 100644 (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;
 
index 3b77252dcbcc6150852542dd5bdc48060651475b..534f1e5ac503f21e5cc25d8142e93d2e67d0a579 100644 (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.
index 48cb0865675ea1b9e31b6374fe464e94544cddfb..c6b527cea49a88fe4a48d90c1e91e99943caa107 100755 (executable)
@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:626ed2484fc25dccca603b448372f479724a094a6006aa89be6764cc1af30fc4
-size 11622359
+oid sha256:3d7bedcc7a61859528568ec7a824629a67aad028319692cf798f89fd464ccc84
+size 11622863
index c6488d5e4bbec03a55b25754458f6de764feb280..c3a86be2527daa7652bd59bccbcb6d759d5ce2eb 100644 (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};