Package org.docx4j.fonts.fop.util
Class CharUtilities
java.lang.Object
org.docx4j.fonts.fop.util.CharUtilities
public class CharUtilities
extends java.lang.Object
This class provides utilities to distinguish various kinds of Unicode
whitespace and to get character widths in a given FontState.
-
Field Summary
Fields Modifier and Type Field Description static charCARRIAGE_RETURNcarriage returnstatic charCODE_EOTCharacter code used to signal a character boundary in inline content, such as an inline with borders and padding or a nested block object.static intEOTCharacter class: Boundary between text runsstatic charIDEOGRAPHIC_SPACEIdeogreaphic spacestatic charLINE_SEPARATORline-separatorstatic intLINEFEEDCharacter class: Line feedstatic charLINEFEED_CHARlinefeed characterstatic charMISSING_IDEOGRAPHmissing ideographstatic charNBSPACEnon-breaking spacestatic charNEXT_LINEnext line control characterstatic intNONWHITESPACECharacter class: non-whitespacestatic charNOT_A_CHARACTERUnicode value indicating the the character is "not a character".static charNULL_CHARnull charstatic charPARAGRAPH_SEPARATORparagraph-separatorstatic charSOFT_HYPHENsoft hyphenstatic charSPACEnormal spacestatic charTABnormal tabstatic intUCWHITESPACECharacter class: Unicode white spacestatic charWORD_JOINERword joinerstatic intXMLWHITESPACECharacter class: XML whitespacestatic charZERO_WIDTH_JOINERzero-width joinerstatic charZERO_WIDTH_NOBREAK_SPACEzero-width no-break space (= byte order mark)static charZERO_WIDTH_SPACEzero-width space -
Constructor Summary
Constructors Modifier Constructor Description protectedCharUtilities()Utility class: Constructor prevents instantiating when subclassed. -
Method Summary
Modifier and Type Method Description static intclassOf(char c)Return the appropriate CharClass constant for the type of the passed character.static booleanisAdjustableSpace(char c)Method to determine if the character is an adjustable space.static booleanisAlphabetic(char ch)Indicates whether a character is classified as "Alphabetic" by the Unicode standard.static booleanisAnySpace(char c)Determines if the character represents any kind of space.static booleanisBreakableSpace(char c)Helper method to determine if the character is a space with normal behavior.static booleanisExplicitBreak(char ch)Indicates whether the given character is an explicit break-characterstatic booleanisFixedWidthSpace(char c)Method to determine if the character is a (breakable) fixed-width space.static booleanisNonBreakableSpace(char c)Method to determine if the character is a nonbreaking space.static booleanisZeroWidthSpace(char c)Method to determine if the character is a zero-width space.
-
Field Details
-
CODE_EOT
public static final char CODE_EOTCharacter code used to signal a character boundary in inline content, such as an inline with borders and padding or a nested block object.- See Also:
- Constant Field Values
-
UCWHITESPACE
public static final int UCWHITESPACECharacter class: Unicode white space- See Also:
- Constant Field Values
-
LINEFEED
public static final int LINEFEEDCharacter class: Line feed- See Also:
- Constant Field Values
-
EOT
public static final int EOTCharacter class: Boundary between text runs- See Also:
- Constant Field Values
-
NONWHITESPACE
public static final int NONWHITESPACECharacter class: non-whitespace- See Also:
- Constant Field Values
-
XMLWHITESPACE
public static final int XMLWHITESPACECharacter class: XML whitespace- See Also:
- Constant Field Values
-
NULL_CHAR
public static final char NULL_CHARnull char- See Also:
- Constant Field Values
-
LINEFEED_CHAR
public static final char LINEFEED_CHARlinefeed character- See Also:
- Constant Field Values
-
CARRIAGE_RETURN
public static final char CARRIAGE_RETURNcarriage return- See Also:
- Constant Field Values
-
TAB
public static final char TABnormal tab- See Also:
- Constant Field Values
-
SPACE
public static final char SPACEnormal space- See Also:
- Constant Field Values
-
NBSPACE
public static final char NBSPACEnon-breaking space- See Also:
- Constant Field Values
-
NEXT_LINE
public static final char NEXT_LINEnext line control character- See Also:
- Constant Field Values
-
ZERO_WIDTH_SPACE
public static final char ZERO_WIDTH_SPACEzero-width space- See Also:
- Constant Field Values
-
WORD_JOINER
public static final char WORD_JOINERword joiner- See Also:
- Constant Field Values
-
ZERO_WIDTH_JOINER
public static final char ZERO_WIDTH_JOINERzero-width joiner- See Also:
- Constant Field Values
-
ZERO_WIDTH_NOBREAK_SPACE
public static final char ZERO_WIDTH_NOBREAK_SPACEzero-width no-break space (= byte order mark)- See Also:
- Constant Field Values
-
SOFT_HYPHEN
public static final char SOFT_HYPHENsoft hyphen- See Also:
- Constant Field Values
-
LINE_SEPARATOR
public static final char LINE_SEPARATORline-separator- See Also:
- Constant Field Values
-
PARAGRAPH_SEPARATOR
public static final char PARAGRAPH_SEPARATORparagraph-separator- See Also:
- Constant Field Values
-
MISSING_IDEOGRAPH
public static final char MISSING_IDEOGRAPHmissing ideograph- See Also:
- Constant Field Values
-
IDEOGRAPHIC_SPACE
public static final char IDEOGRAPHIC_SPACEIdeogreaphic space- See Also:
- Constant Field Values
-
NOT_A_CHARACTER
public static final char NOT_A_CHARACTERUnicode value indicating the the character is "not a character".- See Also:
- Constant Field Values
-
-
Constructor Details
-
CharUtilities
protected CharUtilities()Utility class: Constructor prevents instantiating when subclassed.
-
-
Method Details
-
classOf
public static int classOf(char c)Return the appropriate CharClass constant for the type of the passed character.- Parameters:
c- character to inspect- Returns:
- the determined character class
-
isBreakableSpace
public static boolean isBreakableSpace(char c)Helper method to determine if the character is a space with normal behavior. Normal behavior means that it's not non-breaking.- Parameters:
c- character to inspect- Returns:
- True if the character is a normal space
-
isZeroWidthSpace
public static boolean isZeroWidthSpace(char c)Method to determine if the character is a zero-width space.- Parameters:
c- the character to check- Returns:
- true if the character is a zero-width space
-
isFixedWidthSpace
public static boolean isFixedWidthSpace(char c)Method to determine if the character is a (breakable) fixed-width space.- Parameters:
c- the character to check- Returns:
- true if the character has a fixed-width
-
isNonBreakableSpace
public static boolean isNonBreakableSpace(char c)Method to determine if the character is a nonbreaking space.- Parameters:
c- character to check- Returns:
- True if the character is a nbsp
-
isAdjustableSpace
public static boolean isAdjustableSpace(char c)Method to determine if the character is an adjustable space.- Parameters:
c- character to check- Returns:
- True if the character is adjustable
-
isAnySpace
public static boolean isAnySpace(char c)Determines if the character represents any kind of space.- Parameters:
c- character to check- Returns:
- True if the character represents any kind of space
-
isAlphabetic
public static boolean isAlphabetic(char ch)Indicates whether a character is classified as "Alphabetic" by the Unicode standard.- Parameters:
ch- the character- Returns:
- true if the character is "Alphabetic"
-
isExplicitBreak
public static boolean isExplicitBreak(char ch)Indicates whether the given character is an explicit break-character- Parameters:
ch- the character to check- Returns:
- true if the character represents an explicit break
-