public class Text extends Element
| Constructor and Description |
|---|
Text() |
| Modifier and Type | Method and Description |
|---|---|
void |
addGlyphs(java.util.List<java.lang.Character> glyphIDs,
java.util.List<java.lang.Character> uniText,
Font font,
GraphicState gState,
TextState state,
Matrix matrix,
java.util.EnumSet<TextFlags> flags)
Adds Unicode text to a Text object
|
void |
addGlyphs(java.util.List<java.lang.Character> glyphIDs,
java.util.List<java.lang.Character> uniText,
Font font,
GraphicState gState,
TextState state,
Matrix matrix,
java.util.EnumSet<TextFlags> flags,
int index)
Adds Unicode text to a Text object
|
void |
addRun(TextRun run)
Adds a TextRun to the end of this text element.
|
void |
addRun(TextRun run,
int index)
Adds a TextRun at the specified index.
|
void |
changeMatrixForTextRun(Matrix newMatrix,
int textRunIndex)
Changes the transformation matrix from user space to the current text space for the specified TextRun.
|
void |
changeTextMatrixForTextRun(Matrix newMatrix,
int textRunIndex)
Changes the transformation matrix from user space to the current text space for the specified TextRun.
|
Text |
clone()
Makes a copy of the text.
|
Text |
clone(java.util.EnumSet<ElementCloneFlags> cloneFlags)
Makes a copy of the text.
|
Text |
colorConvert(Document document,
ColorProfile prof,
RenderIntent intent,
boolean embed)
Applies the specified ICC ColorProfile to the Text object
|
void |
delete() |
int |
findTextRunIndexForCharacter(int characterIndex)
Finds the index of the TextRun that contains the nth character in a Text object.
|
Point |
getAdvanceForCharacter(int characterIndex)
Gets the advance width of a character, in user space.
|
Point |
getAdvanceForTextRun(int textRunIndex)
Gets the advance width of a TextRun, in user space.
|
Rect |
getBoundingBoxForCharacter(int characterIndex)
The bounding box for a character in this text element.
|
int |
getNumberOfCharacters()
The number of characters in this text element.
|
int |
getNumberOfRuns()
The number of text runs in this text element.
|
TextRun |
getRun(int index)
Obtains the TextRun at the specified index.
|
Matrix |
getTextMatrixForCharacter(int characterIndex)
Gets the transformation matrix from user space to the current text space for the specified character.
|
Matrix |
getTextMatrixForTextRun(int textRunIndex)
Gets the transformation matrix from user space to the current text space for the specified TextRun.
|
boolean |
pointIntersectsCharacter(Point p,
int index)
Tests whether a point is on a specified character within this Text object.
|
boolean |
pointIntersectsTextRun(Point p,
int index)
Tests whether a point is on a specified TextRun within this Text object.
|
boolean |
rectIntersectsCharacter(Rect r,
int index)
Tests whether any part of a rectangle is on a specified character within this Text object.
|
boolean |
rectIntersectsTextRun(Rect r,
int index)
Tests whether any part of a rectangle is on a specified TextRun within this Text object.
|
void |
removeRuns(int index,
int count)
Removes a count of TextRuns, starting from index
|
void |
splitTextRunAtCharacter(int splitLocation)
Splits the TextRun containing the character at the specified location into two contiguous TextRuns.
|
public int getNumberOfRuns()
public TextRun getRun(int index)
public void addRun(TextRun run)
public void addRun(TextRun run, int index)
run - TextRun to be addedindex - Index, where TextRun should be placedpublic void removeRuns(int index,
int count)
index - Start position of range to deletecount - Count of TextRuns to deletepublic void addGlyphs(java.util.List<java.lang.Character> glyphIDs,
java.util.List<java.lang.Character> uniText,
Font font,
GraphicState gState,
TextState state,
Matrix matrix,
java.util.EnumSet<TextFlags> flags)
glyphIDs - Glyphs IDs in the specified font for adding to the page's contentuniText - Unicode codes for the specified glyph IDsfont - Font for wich GlyphIDs were specifiedgState - The GraphicsState for Text elementstate - TextState flagsmatrix - matrix for the Text elementflags - TextFlags that specifies what kind of text to addpublic void addGlyphs(java.util.List<java.lang.Character> glyphIDs,
java.util.List<java.lang.Character> uniText,
Font font,
GraphicState gState,
TextState state,
Matrix matrix,
java.util.EnumSet<TextFlags> flags,
int index)
glyphIDs - Glyphs IDs in the specified font to add to the page's contentuniText - Unicode codes for the specified glyph IDsfont - Font for wich GlyphIDs were specifiedgState - The GraphicsState for Text elementstate - TextState flagsmatrix - matrix for the Text elementflags - TextFlags that specifies what kind of text to addindex - The index after which to add the character or text run.public Text clone()
Make a copy of an text to obtain a new text that has a distinct set of attributes.
public Text clone(java.util.EnumSet<ElementCloneFlags> cloneFlags)
Make a copy of an text to obtain a new text that has a distinct set of attributes.
public boolean pointIntersectsCharacter(Point p, int index)
p - The point to test, in user space coordinates.index - The index of the character. The first character in the Text has an index of 0.public boolean pointIntersectsTextRun(Point p, int index)
p - The point to test, in user space coordinates.index - The index of the TextRun. The first TextRun in the Text has an index of 0.public boolean rectIntersectsCharacter(Rect r, int index)
r - The rect to test, in user space coordinates.index - The index of the character. The first character in the Text has an index of 0.public boolean rectIntersectsTextRun(Rect r, int index)
r - The rect to test, in user space coordinates.index - The index of the TextRun. The first TextRun in the Text has an index of 0.public void splitTextRunAtCharacter(int splitLocation)
splitLocation - The split location, relative to the Text object.public int findTextRunIndexForCharacter(int characterIndex)
characterIndex - The index of a character, relative to the Text object (the first character in the Text object is at index 0).public Matrix getTextMatrixForCharacter(int characterIndex)
characterIndex - The index of a character, relative to the Text object (the first character in the Text object is at index 0).public Matrix getTextMatrixForTextRun(int textRunIndex)
textRunIndex - The index of a TextRun, relative to the Text object (the first TextRun in the Text object is at index 0).public void changeTextMatrixForTextRun(Matrix newMatrix, int textRunIndex)
newMatrix - The new transformation matrix to use for the TextRun.textRunIndex - The index of a TextRun, relative to the Text object (the first TextRun in the Text object is at index 0).public void changeMatrixForTextRun(Matrix newMatrix, int textRunIndex)
newMatrix - The new transformation matrix to use for the TextRun.textRunIndex - The index of a TextRun, relative to the Text object (the first TextRun in the Text object is at index 0).public Point getAdvanceForCharacter(int characterIndex)
Advance width may be horizontal or vertical, depending on the writing style. Thus, the return value has both a horizontal and a vertical component.
characterIndex - The index of a character, relative to the Text object (the first character in the Text object is at index 0).public Point getAdvanceForTextRun(int textRunIndex)
Advance width may be horizontal or vertical, depending on the writing style. Thus, the return value has both a horizontal and a vertical component.
textRunIndex - The index of a TextRun, relative to the Text object (the first TextRun in the Text object is at index 0).public int getNumberOfCharacters()
public Rect getBoundingBoxForCharacter(int characterIndex)
characterIndex - The index of a character, relative to the Text object (the first character in the Text object is at index 0)public Text colorConvert(Document document, ColorProfile prof, RenderIntent intent, boolean embed)
document - The document the element belongs to.prof - The ICC ColorProfile to be applied.intent - The ICC Rendering Intent for the ColorProfileembed - If true, embed the color space and make the object calibrated. If it is false and the target profile is CMYK, RGB, or Gray, the colors space of the resulting object, after conversion, will be DeviceCMYK, DeviceRGB, or DeviceGray, respectively.