Class GraphemeBreak

java.lang.Object
icyllis.modernui.graphics.text.GraphemeBreak

public final class GraphemeBreak extends Object
This class handles grapheme cluster break.

It is important to recognize that what the user thinks of as a "character"-a basic unit of a writing system for a language- may not be just a single Unicode code point. Instead, that basic unit may be made up of multiple Unicode code points. To avoid ambiguity with the computer use of the term character, this is called a user-perceived character. For example, "G" + grave-accent is a user-perceived character: users think of it as a single character, yet is actually represented by two Unicode code points. These user-perceived characters are approximated by what is called a grapheme cluster, which can be determined programmatically.

Note: this class is not completed, use ICU instead.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Compute the valid cursor after offset or the limit of the context, whichever is less.
    static final int
    Return offset if the cursor at offset is valid, or -1 if it isn't.
    static final int
    Compute the valid cursor at or after the offset or the limit of the context, whichever is less.
    static final int
    Compute the valid cursor at or before offset or the start of the context, whichever is greater.
    static final int
    Compute the valid cursor before offset or the start of the context, whichever is greater.
    static boolean
    Config value, true to use ICU GCB, otherwise this
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    forTextRun(char[] text, Locale locale, int contextStart, int contextEnd, GraphemeBreak.ClusterConsumer consumer)
     
    static int
    getTextRunCursor(String text, Locale locale, int contextStart, int contextEnd, int offset, int op)
     
    static int
    getTextRunCursorICU(CharacterIterator text, Locale locale, int offset, int op)
     
    static int
    getTextRunCursorImpl(float[] advances, char[] buf, int start, int count, int offset, int op)
     
    static boolean
    isGraphemeBreak(float[] advances, char[] buf, int start, int count, int offset)
     
    static boolean
    isPureKiller(int c)
     
    static int
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • AFTER

      public static final int AFTER
      Compute the valid cursor after offset or the limit of the context, whichever is less.
      See Also:
    • AT_OR_AFTER

      public static final int AT_OR_AFTER
      Compute the valid cursor at or after the offset or the limit of the context, whichever is less.
      See Also:
    • BEFORE

      public static final int BEFORE
      Compute the valid cursor before offset or the start of the context, whichever is greater.
      See Also:
    • AT_OR_BEFORE

      public static final int AT_OR_BEFORE
      Compute the valid cursor at or before offset or the start of the context, whichever is greater.
      See Also:
    • AT

      public static final int AT
      Return offset if the cursor at offset is valid, or -1 if it isn't.
      See Also:
    • sUseICU

      public static boolean sUseICU
      Config value, true to use ICU GCB, otherwise this
  • Method Details

    • getTextRunCursor

      public static int getTextRunCursor(@Nonnull String text, @Nonnull Locale locale, int contextStart, int contextEnd, int offset, int op)
    • forTextRun

      public static void forTextRun(@Nonnull char[] text, @Nonnull Locale locale, int contextStart, int contextEnd, @Nonnull GraphemeBreak.ClusterConsumer consumer)
    • getTextRunCursorICU

      public static int getTextRunCursorICU(CharacterIterator text, Locale locale, int offset, int op)
    • getTextRunCursorImpl

      public static int getTextRunCursorImpl(@Nullable float[] advances, @Nonnull char[] buf, int start, int count, int offset, int op)
    • isGraphemeBreak

      public static boolean isGraphemeBreak(@Nullable float[] advances, @Nonnull char[] buf, int start, int count, int offset)
    • isPureKiller

      public static boolean isPureKiller(int c)
    • tailoredGraphemeClusterBreak

      public static int tailoredGraphemeClusterBreak(int c)