org.pdfbox.util

Class TextPosition


public class TextPosition
extends java.lang.Object

This represents a character and a position on the screen of those characters.
Version:
$Revision: 1.11 $
Author:
Ben Litchfield

Constructor Summary

TextPosition(float xPos, float yPos, float xScl, float yScl, float widthValue, 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
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
setXScale(float scale)
void
setYScale(float scale)

Constructor Details

TextPosition

public TextPosition(float xPos,
                    float yPos,
                    float xScl,
                    float yScl,
                    float widthValue,
                    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.
widthValue - The width of the 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 Details

getCharacter

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

getFont

public PDFont getFont()
This will get the font for the text being drawn.
Returns:
The font size.

getFontSize

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

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.

getWidth

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

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.

getWordSpacing

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

getX

public float getX()
This will get the x position of the character.
Returns:
The x coordinate of the character.

getXScale

public float getXScale()
Returns:
Returns the xScale.

getY

public float getY()
This will get the y position of the character.
Returns:
The y coordinate of the character.

getYScale

public float getYScale()
Returns:
Returns the yScale.

setXScale

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

setYScale

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