java.lang.Object
com.github.sttk.linebreak.Unicode
Unicode
is the class that provides static methods to operate or
check Unicode characters or texts.-
Method Summary
Modifier and TypeMethodDescriptionstatic int
getCodepointWidth
(int codepoint) Returns the display width of the specified Unicode codepoiot.static int
getTextWidth
(String text) Returns the display width of the specified Unicode text.static boolean
isPrint
(int codepoint) Checks whether the specified codepoint is one of the printable characters that includes letters, marks, numbers, punctuations, symbols from Unicode categories L, M, N, P, S, and the ASCII space character,static boolean
isSpace
(int codepoint) Checks whether the specified codepoint is a space character as defined by Unicode's White Space property.
-
Method Details
-
isSpace
public static boolean isSpace(int codepoint) Checks whether the specified codepoint is a space character as defined by Unicode's White Space property.- Parameters:
codepoint
- An Unicode codepoint.- Returns:
- True, if the codepoint is a space character.
-
isPrint
public static boolean isPrint(int codepoint) Checks whether the specified codepoint is one of the printable characters that includes letters, marks, numbers, punctuations, symbols from Unicode categories L, M, N, P, S, and the ASCII space character,- Parameters:
codepoint
- An Unicode codepoint.- Returns:
- True, if the codepoint is a printable character.
-
getCodepointWidth
public static int getCodepointWidth(int codepoint) Returns the display width of the specified Unicode codepoiot. A display width is determined by the Unicode Standard Annex #11 (UAX11) East-Asian-Width.- Parameters:
codepoint
- An Unicode codepoint.- Returns:
- A codepoint display width.
-
getTextWidth
Returns the display width of the specified Unicode text. The display width is calculated by taking into account the letter width determined by the Unicode Standard Annex #11 (UAX11) East-Asian-Width.- Parameters:
text
- A text of which the width is calculated.- Returns:
- A text display width.
-