public class TextRenderInfo extends AbstractRenderInfo
PdfCanvasProcessor
and IEventListener
objects as text rendering operations are discovered
gs
Constructor and Description |
---|
TextRenderInfo(PdfString str, CanvasGraphicsState gs, Matrix textMatrix, Stack<CanvasTag> canvasTagHierarchy)
Creates a new TextRenderInfo object
|
Modifier and Type | Method and Description |
---|---|
String |
getActualText()
Gets /ActualText tag entry value if this text chunk is marked content.
|
LineSegment |
getAscentLine()
Gets the ascent line for the text (i.e.
|
LineSegment |
getBaseline()
Gets the baseline for the text (i.e.
|
List<CanvasTag> |
getCanvasTagHierarchy()
Gets hierarchy of the canvas tags that wraps given text.
|
List<TextRenderInfo> |
getCharacterRenderInfos()
Provides detail useful if a listener needs access to the position of each individual glyph in the text render operation
|
float |
getCharSpacing() |
LineSegment |
getDescentLine()
Gets the descent line for the text (i.e.
|
String |
getExpansionText()
Gets /E tag (expansion text) entry value if this text chunk is marked content.
|
Color |
getFillColor() |
PdfFont |
getFont()
Getter for the font
|
float |
getFontSize() |
float |
getHorizontalScaling() |
float |
getLeading() |
int |
getMcid()
Gets the marked-content identifier associated with this TextRenderInfo instance
|
PdfString |
getPdfString() |
float |
getRise()
The rise represents how far above the nominal baseline the text should be rendered.
|
float |
getSingleSpaceWidth() |
Color |
getStrokeColor() |
String |
getText()
Gets the text to be rendered according to canvas operators.
|
Matrix |
getTextMatrix()
Gets original Text matrix.
|
int |
getTextRenderMode() |
LineSegment |
getUnscaledBaseline() |
float |
getUnscaledWidth() |
float |
getWordSpacing() |
boolean |
hasMcid(int mcid)
Checks if the text belongs to a marked content sequence with a given mcid.
|
boolean |
hasMcid(int mcid, boolean checkTheTopmostLevelOnly)
Checks if the text belongs to a marked content sequence with a given mcid.
|
boolean |
isReversedChars()
Determines if the text represented by this TextRenderInfo instance is written in a text showing operator wrapped by /ReversedChars marked content sequence
|
checkGraphicsState, getGraphicsState, isGraphicsStatePreserved, preserveGraphicsState, releaseGraphicsState
public TextRenderInfo(PdfString str, CanvasGraphicsState gs, Matrix textMatrix, Stack<CanvasTag> canvasTagHierarchy)
str
- the PDF string that should be displayed
gs
- the graphics state (note: at this time, this is not immutable, so don't cache it)
textMatrix
- the text matrix at the time of the render operation
canvasTagHierarchy
- the marked content tags sequence, if available
public String getText()
public PdfString getPdfString()
public Matrix getTextMatrix()
public boolean hasMcid(int mcid)
mcid
- a marked content id
public boolean hasMcid(int mcid, boolean checkTheTopmostLevelOnly)
mcid
- a marked content id
checkTheTopmostLevelOnly
- indicates whether to check the topmost level of marked content stack only
public int getMcid()
TextRenderInfo
instance
public LineSegment getBaseline()
getRise()
for the amount added by Rise
public LineSegment getUnscaledBaseline()
public LineSegment getAscentLine()
getRise()
for the amount added by Rise.
public LineSegment getDescentLine()
getRise()
for the amount added by Rise.
public PdfFont getFont()
public float getRise()
getBaseline()
, getAscentLine()
and getDescentLine()
methods already include Rise. This method is exposed to allow listeners to determine if an explicit rise was involved in the computation of the baseline (this might be useful, for example, for identifying superscript rendering)
public List<TextRenderInfo> getCharacterRenderInfos()
TextRenderInfo
objects that represent each glyph used in the draw operation. The next effect is if there was a separate Tj opertion for each character in the rendered string
public float getSingleSpaceWidth()
public int getTextRenderMode()
public Color getFillColor()
public Color getStrokeColor()
public float getFontSize()
public float getHorizontalScaling()
public float getCharSpacing()
public float getWordSpacing()
public float getLeading()
public String getActualText()
null
if none found
public String getExpansionText()
null
if none found
public boolean isReversedChars()
TextRenderInfo
instance is written in a text showing operator wrapped by /ReversedChars marked content sequence
true
if this text block lies within /ReversedChars block, false
otherwise
public List<CanvasTag> getCanvasTagHierarchy()
public float getUnscaledWidth()
Copyright © 1998–2023 iText Group NV. All rights reserved.