com.lowagie.text.pdf
Class PdfChunk

java.lang.Object
  extended by com.lowagie.text.pdf.PdfChunk
All Implemented Interfaces:
SplitCharacter

public class PdfChunk
extends Object
implements SplitCharacter

A PdfChunk is the PDF translation of a Chunk.

A PdfChunk is a PdfString in a certain PdfFont and Color.

See Also:
PdfString, Chunk, Font

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  com.lowagie.text.pdf.PdfFont font
          The font for this PdfChunk.
protected  Image image
          The image in this PdfChunk, if it has one
protected  boolean newlineSplit
          true 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
protected  SplitCharacter splitCharacter
           
protected  String value
          The value of this object.
 
Method Summary
 boolean changeLeading()
           
 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 isNewlineSplit()
          Checks if the PdfChunk split was caused by a newline.
 boolean isSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck)
          Checks if a character can be used to split a PdfString.
static boolean noPrint(char c)
           
 String toString()
           
 float trimLastSpace()
          Trims the last space.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

value

protected String value
The value of this object.


encoding

protected String encoding
The encoding.


font

protected com.lowagie.text.pdf.PdfFont font
The font for this PdfChunk.


baseFont

protected BaseFont baseFont

splitCharacter

protected SplitCharacter splitCharacter

attributes

protected HashMap attributes
Metric attributes.

This attributes require the mesurement of characters widths when rendering such as underline.


noStroke

protected HashMap noStroke
Non metric attributes.

This attributes do not require the mesurement of characters widths when rendering such as Color.


newlineSplit

protected boolean newlineSplit
true if the chunk split was cause by a newline.


image

protected Image image
The image in this PdfChunk, if it has one


offsetX

protected float offsetX
The offset in the x direction for the image


offsetY

protected float offsetY
The offset in the y direction for the image


changeLeading

protected boolean changeLeading
Indicates if the height and offset of the Image has to be taken into account

Method Detail

getUnicodeEquivalent

public char getUnicodeEquivalent(char c)
Gets the Unicode equivalent to a CID. The (inexistent) CID is translated as '\n'. It has only meaning with CJK fonts with Identity encoding.

Parameters:
c - the CID code
Returns:
the Unicode equivalent

getWord

protected int getWord(String text,
                      int start)

isNewlineSplit

public boolean isNewlineSplit()
Checks if the PdfChunk split was caused by a newline.

Returns:
true if the PdfChunk split was caused by a newline.

getWidthCorrected

public float getWidthCorrected(float charSpacing,
                               float wordSpacing)
Gets the width of the 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

getTextRise

public float getTextRise()
Gets the text displacement relatiev to the baseline.

Returns:
a displacement in points

trimLastSpace

public float trimLastSpace()
Trims the last space.

Returns:
the width of the space trimmed, otherwise 0

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

isSplitCharacter

public boolean isSplitCharacter(int start,
                                int current,
                                int end,
                                char[] cc,
                                PdfChunk[] ck)
Checks if a character can be used to split a PdfString.

for the moment every character less than or equal to SPACE and the character '-' are 'splitCharacters'.

Specified by:
isSplitCharacter in interface SplitCharacter
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

changeLeading

public boolean changeLeading()

noPrint

public static boolean noPrint(char c)


Copyright © 2006-2007 EGIZ - E-Government Innovationszentrum. All Rights Reserved.