org.apache.fop.util

Class 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

static char
CODE_EOT
Character code used to signal a character boundary in inline content, such as an inline with borders and padding or a nested block object.
static int
EOT
Character class: Boundary between text runs
static int
LINEFEED
Character class: Line feed
static char
NBSPACE
non-breaking space
static int
NONWHITESPACE
Character class: non-whitespace
static char
SOFT_HYPHEN
soft hyphen
static char
SPACE
normal space
static int
UCWHITESPACE
Character class: Unicode white space
static char
WORD_JOINER
word joiner
static int
XMLWHITESPACE
Character class: XML whitespace
static char
ZERO_WIDTH_NOBREAK_SPACE
zero-width no-break space (= byte order mark)
static char
ZERO_WIDTH_SPACE
zero-width space

Constructor Summary

CharUtilities()
Utility class: Constructor prevents instantiating when subclassed.

Method Summary

static int
classOf(char c)
Return the appropriate CharClass constant for the type of the passed character.
static boolean
isAdjustableSpace(char c)
Method to determine if the character is an adjustable space.
static boolean
isAlphabetic(char ch)
Indicates whether a character is classified as "Alphabetic" by the Unicode standard.
static boolean
isAnySpace(char c)
Determines if the character represents any kind of space.
static boolean
isBreakableSpace(char c)
Helper method to determine if the character is a space with normal behavior.
static boolean
isFixedWidthSpace(char c)
Method to determine if the character is a (breakable) fixed-width space.
static boolean
isNonBreakableSpace(char c)
Method to determine if the character is a nonbreaking space.
static boolean
isZeroWidthSpace(char c)
Method to determine if the character is a zero-width space.

Field Details

CODE_EOT

public static final char CODE_EOT
Character code used to signal a character boundary in inline content, such as an inline with borders and padding or a nested block object.
Field Value:
'\u0000'

EOT

public static final int EOT
Character class: Boundary between text runs
Field Value:
2

LINEFEED

public static final int LINEFEED
Character class: Line feed
Field Value:
1

NBSPACE

public static final char NBSPACE
non-breaking space
Field Value:
'\u00a0'

NONWHITESPACE

public static final int NONWHITESPACE
Character class: non-whitespace
Field Value:
3

SOFT_HYPHEN

public static final char SOFT_HYPHEN
soft hyphen
Field Value:
'\u00ad'

SPACE

public static final char SPACE
normal space
Field Value:
' '

UCWHITESPACE

public static final int UCWHITESPACE
Character class: Unicode white space
Field Value:
0

WORD_JOINER

public static final char WORD_JOINER
word joiner
Field Value:
'\u2060'

XMLWHITESPACE

public static final int XMLWHITESPACE
Character class: XML whitespace
Field Value:
4

ZERO_WIDTH_NOBREAK_SPACE

public static final char ZERO_WIDTH_NOBREAK_SPACE
zero-width no-break space (= byte order mark)
Field Value:
'\ufeff'

ZERO_WIDTH_SPACE

public static final char ZERO_WIDTH_SPACE
zero-width space
Field Value:
'\u200b'

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

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

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"

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

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

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

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

Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.