com.itextpdf.text.pdf
Class PdfLine

java.lang.Object
  extended by com.itextpdf.text.pdf.PdfLine

public class PdfLine
extends Object

PdfLine defines an array with PdfChunk-objects that fit into 1 line.


Field Summary
protected  int alignment
          The alignment of the line.
protected  float height
          The height of the line.
protected  boolean isRTL
           
protected  float left
          The left indentation of the line.
protected  ArrayList<PdfChunk> line
          The arraylist containing the chunks.
protected  ListItem listItem
           
protected  boolean newlineSplit
          true if the chunk splitting was caused by a newline.
protected  float originalWidth
          The original width.
protected  float tabPosition
           
protected  TabStop tabStop
           
protected  float tabStopAnchorPosition
           
protected  float width
          The width of the line.
 
Method Summary
 void flush()
           
 float getAscender()
          Gets the maximum size of the ascender for all the fonts used in this line.
 PdfChunk getChunk(int idx)
          Gets a PdfChunk by index.
 float getDescender()
          Gets the biggest descender for all the fonts used in this line.
 int getLastStrokeChunk()
          Gets the index of the last PdfChunk with metric attributes
 int getLineLengthUtf32()
          Returns the length of a line in UTF32 characters
 float getOriginalWidth()
          Gets the original width of the line.
 float getWidthCorrected(float charSpacing, float wordSpacing)
          Gets a width corrected with a charSpacing and wordSpacing.
 boolean hasToBeJustified()
          Checks if this line has to be justified.
 boolean isNewlineSplit()
          Checks if a newline caused the line split.
 Iterator<PdfChunk> iterator()
          Returns an iterator of PdfChunks.
 float listIndent()
          Return the indentation needed to show the listsymbol.
 ListItem listItem()
           
 Chunk listSymbol()
          Returns the listsymbol of this line.
 void resetAlignment()
          Resets the alignment of this line.
 void setListItem(ListItem listItem)
          Sets the listsymbol of this line.
 int size()
          Returns the number of chunks in the line.
 String toString()
          Get the string representation of what is in this line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

line

protected ArrayList<PdfChunk> line
The arraylist containing the chunks.


left

protected float left
The left indentation of the line.


width

protected float width
The width of the line.


alignment

protected int alignment
The alignment of the line.


height

protected float height
The height of the line.


newlineSplit

protected boolean newlineSplit
true if the chunk splitting was caused by a newline.


originalWidth

protected float originalWidth
The original width.


isRTL

protected boolean isRTL

listItem

protected ListItem listItem

tabStop

protected TabStop tabStop

tabStopAnchorPosition

protected float tabStopAnchorPosition

tabPosition

protected float tabPosition
Method Detail

size

public int size()
Returns the number of chunks in the line.

Returns:
a value

iterator

public Iterator<PdfChunk> iterator()
Returns an iterator of PdfChunks.

Returns:
an Iterator

hasToBeJustified

public boolean hasToBeJustified()
Checks if this line has to be justified.

Returns:
true if the alignment equals ALIGN_JUSTIFIED and there is some width left.

resetAlignment

public void resetAlignment()
Resets the alignment of this line.

The alignment of the last line of for instance a Paragraph that has to be justified, has to be reset to ALIGN_LEFT.


setListItem

public void setListItem(ListItem listItem)
Sets the listsymbol of this line.

This is only necessary for the first line of a ListItem.

Parameters:
listItem - the list symbol

listSymbol

public Chunk listSymbol()
Returns the listsymbol of this line.

Returns:
a PdfChunk if the line has a listsymbol; null otherwise

listIndent

public float listIndent()
Return the indentation needed to show the listsymbol.

Returns:
a value

listItem

public ListItem listItem()

toString

public String toString()
Get the string representation of what is in this line.

Overrides:
toString in class Object
Returns:
a String

getLineLengthUtf32

public int getLineLengthUtf32()
Returns the length of a line in UTF32 characters

Returns:
the length in UTF32 characters
Since:
2.1.2; Get changed into get in 5.0.2

isNewlineSplit

public boolean isNewlineSplit()
Checks if a newline caused the line split.

Returns:
true if a newline caused the line split

getLastStrokeChunk

public int getLastStrokeChunk()
Gets the index of the last PdfChunk with metric attributes

Returns:
the last PdfChunk with metric attributes

getChunk

public PdfChunk getChunk(int idx)
Gets a PdfChunk by index.

Parameters:
idx - the index
Returns:
the PdfChunk or null if beyond the array

getOriginalWidth

public float getOriginalWidth()
Gets the original width of the line.

Returns:
the original width of the line

getWidthCorrected

public float getWidthCorrected(float charSpacing,
                               float wordSpacing)
Gets a width corrected with a charSpacing and wordSpacing.

Parameters:
charSpacing -
wordSpacing -
Returns:
a corrected width

getAscender

public float getAscender()
Gets the maximum size of the ascender for all the fonts used in this line.

Returns:
maximum size of all the ascenders used in this line

getDescender

public float getDescender()
Gets the biggest descender for all the fonts used in this line. Note that this is a negative number.

Returns:
maximum size of all the descenders used in this line

flush

public void flush()


Copyright © 2013. All Rights Reserved.