org.pdfbox.util
Class TextPosition

java.lang.Object
  extended byorg.pdfbox.util.TextPosition

public class TextPosition
extends Object

This represents a character and a position on the screen of those characters.

Version:
$Revision: 1.12 $
Author:
Ben Litchfield

Constructor Summary
protected TextPosition()
           
  TextPosition(float xPos, float yPos, float xScl, float yScl, float totalWidthValue, float[] individualWidths, float heightValue, float spaceWidth, String string, PDFont currentFont, float fontSizeValue, float ws)
          Constructor.
 
Method Summary
 String getCharacter()
          This will the character that will be displayed on the screen.
 PDFont getFont()
          This will get the font for the text being drawn.
 float getFontSize()
          This will get the font size that this object is suppose to be drawn at.
 float getHeight()
          This will get the maximum height of all characters in this string.
 float[] getIndividualWidths()
          Get the widths of each individual character.
 float getWidth()
          This will get the width of this character.
 float getWidthOfSpace()
          This will get the width of a space character.
 float getWordSpacing()
          This will get the current word spacing.
 float getX()
          This will get the x position of the character.
 float getXScale()
           
 float getY()
          This will get the y position of the character.
 float getYScale()
           
 void setIndividualWidths(float[] individualWidths)
          Set the individual widths of every character.
 void setXScale(float scale)
           
 void setYScale(float scale)
           
 String toString()
          Show the string data for this text position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextPosition

protected TextPosition()

TextPosition

public TextPosition(float xPos,
                    float yPos,
                    float xScl,
                    float yScl,
                    float totalWidthValue,
                    float[] individualWidths,
                    float heightValue,
                    float spaceWidth,
                    String string,
                    PDFont currentFont,
                    float fontSizeValue,
                    float ws)
Constructor.

Parameters:
xPos - The x coordinate of the character.
yPos - The y coordinate of the character.
xScl - The x scaling of the character.
yScl - The y scaling of the character.
totalWidthValue - The width of all the characters.
individualWidths - The width of each individual character.
heightValue - The height of the character.
spaceWidth - The width of the space character.
string - The character to be displayed.
currentFont - The current for for this text position.
fontSizeValue - The new font size.
ws - The word spacing parameter
Method Detail

getCharacter

public String getCharacter()
This will the character that will be displayed on the screen.

Returns:
The character on the screen.

getX

public float getX()
This will get the x position of the character.

Returns:
The x coordinate of the character.

getY

public float getY()
This will get the y position of the character.

Returns:
The y coordinate of the character.

getWidth

public float getWidth()
This will get the width of this character.

Returns:
The width of this character.

getHeight

public float getHeight()
This will get the maximum height of all characters in this string.

Returns:
The maximum height of all characters in this string.

getFontSize

public float getFontSize()
This will get the font size that this object is suppose to be drawn at.

Returns:
The font size.

getFont

public PDFont getFont()
This will get the font for the text being drawn.

Returns:
The font size.

getWordSpacing

public float getWordSpacing()
This will get the current word spacing.

Returns:
The current word spacing.

getWidthOfSpace

public float getWidthOfSpace()
This will get the width of a space character. This is useful for some algorithms such as the text stripper, that need to know the width of a space character.

Returns:
The width of a space character.

getXScale

public float getXScale()
Returns:
Returns the xScale.

setXScale

public void setXScale(float scale)
Parameters:
scale - The xScale to set.

getYScale

public float getYScale()
Returns:
Returns the yScale.

setYScale

public void setYScale(float scale)
Parameters:
scale - The yScale to set.

getIndividualWidths

public float[] getIndividualWidths()
Get the widths of each individual character.

Returns:
An array that is the same length as the length of the string.

setIndividualWidths

public void setIndividualWidths(float[] individualWidths)
Set the individual widths of every character.

Parameters:
individualWidths - The individual widths of characters.

toString

public String toString()
Show the string data for this text position.

Returns:
A human readable form of this object.