public final class TextPosition extends Object
Constructor and Description |
---|
TextPosition(int pageRotation,
float pageWidth,
float pageHeight,
Matrix textMatrix,
float endX,
float endY,
float maxHeight,
float individualWidth,
float spaceWidth,
String unicode,
int[] charCodes,
PDFont font,
float fontSize,
int fontSizeInPt)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(TextPosition tp2)
Determine if this TextPosition logically contains another (i.e. they overlap and should be
rendered on top of each other).
|
boolean |
equals(Object o) |
int[] |
getCharacterCodes()
Return the internal PDF character codes of the glyphs in this text.
|
float |
getDir()
Return the direction/orientation of the string in this object based on its text matrix.
|
float |
getEndX()
This will get the x coordinate of the end position.
|
float |
getEndY()
This will get the y coordinate of the end position.
|
PDFont |
getFont()
This will get the font for the text being drawn.
|
float |
getFontSize()
This will get the font size that has been set with the "Tf" operator (Set text font and
size).
|
float |
getFontSizeInPt()
This will get the font size in pt.
|
float |
getHeight()
This will get the maximum height of all characters in this string.
|
float |
getHeightDir()
This will get the maximum height of all characters in this string.
|
float[] |
getIndividualWidths()
Get the widths of each individual character.
|
float |
getPageHeight()
This will get the height of the page that the text is located in.
|
float |
getPageWidth()
This will get the width of the page that the text is located in.
|
int |
getRotation()
This will get the rotation of the page that the text is located in.
|
Matrix |
getTextMatrix()
The matrix containing the starting text position and scaling.
|
String |
getUnicode()
Return the string of characters stored in this object.
|
float |
getWidth()
This will get the width of the string when page rotation adjusted coordinates are used.
|
float |
getWidthDirAdj()
This will get the width of the string when text direction adjusted coordinates are used.
|
float |
getWidthOfSpace()
This will get the width of a space character.
|
float |
getX()
This will get the page rotation adjusted x position of the character.
|
float |
getXDirAdj()
This will get the text direction adjusted x position of the character.
|
float |
getXScale()
This will get the X scaling factor.
|
float |
getY()
This will get the y position of the text, adjusted so that 0,0 is upper left and it is
adjusted based on the page rotation.
|
float |
getYDirAdj()
This will get the y position of the text, adjusted so that 0,0 is upper left and it is
adjusted based on the text direction.
|
float |
getYScale()
This will get the Y scaling factor.
|
int |
hashCode() |
boolean |
isDiacritic() |
void |
mergeDiacritic(TextPosition diacritic)
Merge a single character TextPosition into the current object.
|
String |
toString()
Show the string data for this text position.
|
public TextPosition(int pageRotation, float pageWidth, float pageHeight, Matrix textMatrix, float endX, float endY, float maxHeight, float individualWidth, float spaceWidth, String unicode, int[] charCodes, PDFont font, float fontSize, int fontSizeInPt)
pageRotation
- rotation of the page that the text is located inpageWidth
- width of the page that the text is located inpageHeight
- height of the page that the text is located intextMatrix
- text rendering matrix for start of text (in display units)endX
- x coordinate of the end positionendY
- y coordinate of the end positionmaxHeight
- Maximum height of text (in display units)individualWidth
- The width of the given character/string. (in text units)spaceWidth
- The width of the space character. (in display units)unicode
- The string of Unicode characters to be displayed.charCodes
- An array of the internal PDF character codes for the glyphs in this text.font
- The current font for this text position.fontSize
- The new font size.fontSizeInPt
- The font size in pt units (see getFontSizeInPt()
for details).public String getUnicode()
public int[] getCharacterCodes()
public Matrix getTextMatrix()
public float getDir()
public float getX()
public float getXDirAdj()
public float getY()
public float getYDirAdj()
public float getWidth()
public float getWidthDirAdj()
public float getHeight()
public float getHeightDir()
public float getFontSize()
public float getFontSizeInPt()
getFontSize()
with the text matrix (set by the "Tm" operator)
horizontal scaling factor and truncate the result to integer. The actual rendering may appear
bigger or smaller depending on the current transformation matrix (set by the "cm" operator).
To get the size in rendering, use getXScale()
.public PDFont getFont()
public float getWidthOfSpace()
public float getXScale()
public float getYScale()
public float[] getIndividualWidths()
public boolean contains(TextPosition tp2)
tp2
- The other TestPosition to compare againstpublic void mergeDiacritic(TextPosition diacritic)
diacritic
- TextPosition to merge into the current TextPosition.public boolean isDiacritic()
public String toString()
public float getEndX()
public float getEndY()
public int getRotation()
public float getPageHeight()
public float getPageWidth()
Copyright © 2002–2017 The Apache Software Foundation. All rights reserved.