Package com.itextpdf.text.pdf.parser
Class TextRenderInfo
- java.lang.Object
-
- com.itextpdf.text.pdf.parser.TextRenderInfo
-
public class TextRenderInfo extends Object
Provides information and calculations needed by render listeners to display/evaluate text render operations.
This is passed between thePdfContentStreamProcessor
andRenderListener
objects as text rendering operations are discovered
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LineSegment
getAscentLine()
Gets the ascentline for the text (i.e.LineSegment
getBaseline()
Gets the baseline for the text (i.e.List<TextRenderInfo>
getCharacterRenderInfos()
Provides detail useful if a listener needs access to the position of each individual glyph in the text render operationLineSegment
getDescentLine()
Gets the descentline for the text (i.e.BaseColor
getFillColor()
DocumentFont
getFont()
Getter for the fontInteger
getMcid()
PdfString
getPdfString()
float
getRise()
The rise represents how far above the nominal baseline the text should be rendered.float
getSingleSpaceWidth()
BaseColor
getStrokeColor()
String
getText()
int
getTextRenderMode()
LineSegment
getUnscaledBaseline()
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.
-
-
-
Method Detail
-
getText
public String getText()
- Returns:
- the text to render
-
getPdfString
public PdfString getPdfString()
- Returns:
- original PDF string
-
hasMcid
public boolean hasMcid(int mcid)
Checks if the text belongs to a marked content sequence with a given mcid.- Parameters:
mcid
- a marked content id- Returns:
- true if the text is marked with this id
- Since:
- 5.0.2
-
hasMcid
public boolean hasMcid(int mcid, boolean checkTheTopmostLevelOnly)
Checks if the text belongs to a marked content sequence with a given mcid.- Parameters:
mcid
- a marked content idcheckTheTopmostLevelOnly
- indicates whether to check the topmost level of marked content stack only- Returns:
- true if the text is marked with this id
- Since:
- 5.3.5
-
getMcid
public Integer getMcid()
- Returns:
- the marked content associated with the TextRenderInfo instance.
-
getBaseline
public LineSegment getBaseline()
Gets the baseline for the text (i.e. the line that the text 'sits' on) This value includes the Rise of the draw operation - seegetRise()
for the amount added by Rise- Returns:
- the baseline line segment
- Since:
- 5.0.2
-
getUnscaledBaseline
public LineSegment getUnscaledBaseline()
-
getAscentLine
public LineSegment getAscentLine()
Gets the ascentline for the text (i.e. the line that represents the topmost extent that a string of the current font could have) This value includes the Rise of the draw operation - seegetRise()
for the amount added by Rise- Returns:
- the ascentline line segment
- Since:
- 5.0.2
-
getDescentLine
public LineSegment getDescentLine()
Gets the descentline for the text (i.e. the line that represents the bottom most extent that a string of the current font could have). This value includes the Rise of the draw operation - seegetRise()
for the amount added by Rise- Returns:
- the descentline line segment
- Since:
- 5.0.2
-
getFont
public DocumentFont getFont()
Getter for the font- Returns:
- the font
- Since:
- iText 5.0.2
-
getRise
public float getRise()
The rise represents how far above the nominal baseline the text should be rendered. ThegetBaseline()
,getAscentLine()
andgetDescentLine()
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)- Returns:
- The Rise for the text draw operation, in user space units (Ts value, scaled to user space)
- Since:
- 5.3.3
-
getSingleSpaceWidth
public float getSingleSpaceWidth()
- Returns:
- The width, in user space units, of a single space character in the current font
-
getTextRenderMode
public int getTextRenderMode()
- Returns:
- the text render mode that should be used for the text. From the
PDF specification, this means:
- 0 = Fill text
- 1 = Stroke text
- 2 = Fill, then stroke text
- 3 = Invisible
- 4 = Fill text and add to path for clipping
- 5 = Stroke text and add to path for clipping
- 6 = Fill, then stroke text and add to path for clipping
- 7 = Add text to padd for clipping
- Since:
- iText 5.0.1
-
getFillColor
public BaseColor getFillColor()
- Returns:
- the current fill color.
-
getStrokeColor
public BaseColor getStrokeColor()
- Returns:
- the current stroke color.
-
getCharacterRenderInfos
public List<TextRenderInfo> getCharacterRenderInfos()
Provides detail useful if a listener needs access to the position of each individual glyph in the text render operation- Returns:
- A list of
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 - Since:
- 5.3.3
-
-