com.lowagie.text.pdf
public class PdfChunk extends Object implements SplitCharacter
PdfChunk
is the PDF translation of a Chunk
.
A PdfChunk
is a PdfString
in a certain
PdfFont
and Color
.
Field Summary | |
---|---|
protected HashMap | attributes
Metric attributes.
|
protected BaseFont | baseFont |
protected boolean | changeLeading Indicates if the height and offset of the Image has to be taken into account |
protected String | encoding The encoding. |
protected PdfFont | font The font for this PdfChunk . |
protected Image | image The image in this PdfChunk , if it has one |
static float | ITALIC_ANGLE |
static HashMap | keysAttributes The allowed attributes in variable attributes . |
static HashMap | keysNoStroke The allowed attributes in variable noStroke . |
protected boolean | newlineSplittrue if the chunk split was cause by a newline. |
protected HashMap | noStroke
Non metric attributes.
|
protected float | offsetX The offset in the x direction for the image |
protected float | offsetY The offset in the y direction for the image |
static char[] | singleSpace |
protected SplitCharacter | splitCharacter |
static PdfChunk[] | thisChunk |
protected String | value The value of this object. |
Constructor Summary | |
---|---|
PdfChunk(String string, PdfChunk other)
Constructs a PdfChunk -object.
| |
PdfChunk(Chunk chunk, PdfAction action)
Constructs a PdfChunk -object.
|
Method Summary | |
---|---|
boolean | changeLeading() |
Color | color()
Returns the color of this Chunk .
|
PdfFont | font()
Returns the font of this Chunk .
|
Object | getAttribute(String name)
Gets an attribute. |
float | getCharWidth(char c) |
String | getEncoding()
Gets the encoding of this string.
|
Image | getImage()
Gets the image in the PdfChunk . |
float | getImageOffsetX()
Gets the image offset in the x direction |
float | getImageOffsetY()
Gets the image offset in the y direction |
float | getTextRise()
Gets the text displacement relatiev to the baseline. |
char | getUnicodeEquivalent(char c) Gets the Unicode equivalent to a CID.
|
float | getWidthCorrected(float charSpacing, float wordSpacing)
Gets the width of the PdfChunk taking into account the
extra character and word spacing. |
protected int | getWord(String text, int start) |
boolean | isAttribute(String name)
Checks if the attribute exists. |
boolean | isExtSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck) |
boolean | isImage()
Checks if there is an image in the PdfChunk . |
boolean | isNewlineSplit()
Checks if the PdfChunk split was caused by a newline. |
boolean | isSpecialEncoding()
Tells you if this string is in Chinese, Japanese, Korean or Identity-H. |
boolean | isSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck)
Checks if a character can be used to split a PdfString .
|
boolean | isStroked()
Checks if this PdfChunk needs some special metrics handling. |
int | length() |
static boolean | noPrint(char c) |
void | setImageOffsetX(float offsetX)
Sets the image offset in the x direction |
void | setImageOffsetY(float offsetY)
Sets the image offset in the y direction |
void | setValue(String value)
sets the value. |
PdfChunk | split(float width)
Splits this PdfChunk if it's too long for the given width.
|
String | toString() |
String | trim(String string)
Removes all the ' ' and '-'-characters on the right of a String .
|
float | trimFirstSpace() |
float | trimLastSpace()
Trims the last space. |
PdfChunk | truncate(float width)
Truncates this PdfChunk if it's too long for the given width.
|
float | width()
Returns the width of this PdfChunk .
|
This attributes require the mesurement of characters widths when rendering such as underline.
PdfChunk
.PdfChunk
, if it has oneattributes
.noStroke
.true
if the chunk split was cause by a newline.This attributes do not require the mesurement of characters widths when rendering such as Color.
PdfChunk
-object.
Parameters: string the content of the PdfChunk
-object other Chunk with the same style you want for the new Chunk
PdfChunk
-object.
Parameters: chunk the original Chunk
-object action the PdfAction
if the Chunk
comes from an Anchor
Chunk
.
Returns: a Color
Chunk
.
Returns: a PdfFont
attributes
and noStroke
.Parameters: name the attribute key
Returns: the attribute value or null if not found
Returns: a String
PdfChunk
.Returns: the image or null
Returns: the image offset in the x direction
Returns: Gets the image offset in the y direction
Returns: a displacement in points
Parameters: c the CID code
Returns: the Unicode equivalent
PdfChunk
taking into account the
extra character and word spacing.Parameters: charSpacing the extra character spacing wordSpacing the extra word spacing
Returns: the calculated width
Parameters: name the attribute key
Returns: true
if the attribute exists
PdfChunk
.Returns: true
if an image is present
PdfChunk
split was caused by a newline.Returns: true
if the PdfChunk
split was caused by a newline.
Returns: true if the Chunk has a special encoding
PdfString
.
for the moment every character less than or equal to SPACE and the character '-' are 'splitCharacters'.
Parameters: start start position in the array current current position in the array end end position in the array cc the character array that has to be checked ck chunk array
Returns: true
if the character can be used to split a string, false
otherwise
PdfChunk
needs some special metrics handling.Returns: true
if this PdfChunk
needs some special metrics handling.
Parameters: offsetX the image offset in the x direction
Parameters: offsetY the image offset in the y direction
Parameters: value content of the Chunk
PdfChunk
if it's too long for the given width.
Returns null if the PdfChunk
wasn't truncated.
Parameters: width a given width
Returns: the PdfChunk
that doesn't fit into the width.
See Also: java.lang.Object#toString()
String
.
Parameters: string the String
that has to be trimmed.
Returns: the trimmed String
Returns: the width of the space trimmed, otherwise 0
PdfChunk
if it's too long for the given width.
Returns null if the PdfChunk
wasn't truncated.
Parameters: width a given width
Returns: the PdfChunk
that doesn't fit into the width.
PdfChunk
.
Returns: a width