Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8304027

Unicode Emoji Properties

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P4
    • 21
    • core-libs
    • None
    • source
    • minimal
    • There are new additional methods.
    • Java API
    • SE

    Description

      Summary

      Provide API to access Unicode Emoji properties for each character.

      Problem

      Emoji has become an integral part of text processing. The Unicode Consortium releases Unicode Emoji Technical Standard (UTS #51), but there is no way to retrieve those Emoji related information with the JDK libraries. It would be desirable to provide API to access those Emoji properties.

      Solution

      UTS #51 defines 6 Emoji related properties as follows:

      • Emoji
      • Emoji Presentation
      • Emoji Modifier
      • Emoji Modifier Base
      • Emoji Component
      • Extended Pictograph

      Providing public methods in java.lang.Character class would allow applications to programmatically access those properties.

      Specification

      Provide the following 6 new methods in java.lang.Character class:

      /**
       * Determines if the specified character (Unicode code point) is an Emoji.
       * <p>
       * A character is considered to be an Emoji if and only if it has the {@code Emoji}
       * property, defined in
       * <a href="https://unicode.org/reports/tr51/#Emoji_Properties_and_Data_Files">
       * Unicode Emoji (Technical Standard #51)</a>.
       *
       * @param   codePoint the character (Unicode code point) to be tested.
       * @return  {@code true} if the character is an Emoji;
       *          {@code false} otherwise.
       * @since   21
       */
      public static boolean isEmoji(int codePoint);
      
      /**
       * Determines if the specified character (Unicode code point) has the
       * Emoji Presentation property by default.
       * <p>
       * A character is considered to have the Emoji Presentation property if and
       * only if it has the {@code Emoji_Presentation} property, defined in
       * <a href="https://unicode.org/reports/tr51/#Emoji_Properties_and_Data_Files">
       * Unicode Emoji (Technical Standard #51)</a>.
       *
       * @param   codePoint the character (Unicode code point) to be tested.
       * @return  {@code true} if the character has the Emoji Presentation
       *.               property; {@code false} otherwise.
       * @since   21
       */
      public static boolean isEmojiPresentation(int codePoint);
      
      /**
       * Determines if the specified character (Unicode code point) is an
       * Emoji Modifier.
       * <p>
       * A character is considered to be an Emoji Modifier if and only if it has
       * the {@code Emoji_Modifier} property, defined in
       * <a href="https://unicode.org/reports/tr51/#Emoji_Properties_and_Data_Files">
       * Unicode Emoji (Technical Standard #51)</a>.
       *
       * @param   codePoint the character (Unicode code point) to be tested.
       * @return  {@code true} if the character is an Emoji Modifier;
       *          {@code false} otherwise.
       * @since   21
       */
      public static boolean isEmojiModifier(int codePoint);
      
      /**
       * Determines if the specified character (Unicode code point) is an
       * Emoji Modifier Base.
       * <p>
       * A character is considered to be an Emoji Modifier Base if and only if it has
       * the {@code Emoji_Modifier_Base} property, defined in
       * <a href="https://unicode.org/reports/tr51/#Emoji_Properties_and_Data_Files">
       * Unicode Emoji (Technical Standard #51)</a>.
       *
       * @param   codePoint the character (Unicode code point) to be tested.
       * @return  {@code true} if the character is an Emoji Modifier Base;
       *          {@code false} otherwise.
       * @since   21
       */
      public static boolean isEmojiModifierBase(int codePoint);
      
      /**
       * Determines if the specified character (Unicode code point) is an
       * Emoji Component.
       * <p>
       * A character is considered to be an Emoji Component if and only if it has
       * the {@code Emoji_Component} property, defined in
       * <a href="https://unicode.org/reports/tr51/#Emoji_Properties_and_Data_Files">
       * Unicode Emoji (Technical Standard #51)</a>.
       *
       * @param   codePoint the character (Unicode code point) to be tested.
       * @return  {@code true} if the character is an Emoji Component;
       *          {@code false} otherwise.
       * @since   21
       */
      public static boolean isEmojiComponent(int codePoint);
      
      /**
       * Determines if the specified character (Unicode code point) is
       * an Extended Pictographic.
       * <p>
       * A character is considered to be an Extended Pictographic if and only if it has
       * the {@code Extended_Pictographic} property, defined in
       * <a href="https://unicode.org/reports/tr51/#Emoji_Properties_and_Data_Files">
       * Unicode Emoji (Technical Standard #51)</a>.
       *
       * @param   codePoint the character (Unicode code point) to be tested.
       * @return  {@code true} if the character is an Extended Pictographic;
       *          {@code false} otherwise.
       * @since   21
       */
      public static boolean isExtendedPictographic(int codePoint);

      Attachments

        Issue Links

          Activity

            People

              naoto Naoto Sato
              prr Philip Race
              Alan Bateman, Philip Race
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: