Class TextRenderInfo
Provides information and calculations needed by render listeners to display/evaluate text render operations.
public class TextRenderInfo : AbstractRenderInfo, IEventData
- Inheritance
-
TextRenderInfo
- Implements
- Inherited Members
Remarks
Provides information and calculations needed by render listeners
to display/evaluate text render operations.
This is passed between the
PdfCanvasProcessor
and
IEventListener
objects as text rendering operations are
discovered
Constructors
TextRenderInfo(PdfString, CanvasGraphicsState, Matrix, Stack<CanvasTag>)
Creates a new TextRenderInfo object
public TextRenderInfo(PdfString str, CanvasGraphicsState gs, Matrix textMatrix, Stack<CanvasTag> canvasTagHierarchy)
Parameters
str
PdfStringthe PDF string that should be displayed
gs
CanvasGraphicsStatethe graphics state (note: at this time, this is not immutable, so don't cache it)
textMatrix
Matrixthe text matrix at the time of the render operation
canvasTagHierarchy
Stack<CanvasTag>the marked content tags sequence, if available
Methods
GetActualText()
Gets /ActualText tag entry value if this text chunk is marked content.
public virtual string GetActualText()
Returns
- string
/ActualText value or
null
if none found
GetAscentLine()
Gets the ascent line for the text (i.e. the line that represents the topmost extent that a string of the current font could have).
public virtual LineSegment GetAscentLine()
Returns
- LineSegment
a LineSegment instance
Remarks
Gets the ascent line 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 - see GetRise() for the amount added by Rise.
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 - see GetRise() for the amount added by Rise
public virtual LineSegment GetBaseline()
Returns
- LineSegment
the baseline line segment
GetCanvasTagHierarchy()
Gets hierarchy of the canvas tags that wraps given text.
public virtual IList<CanvasTag> GetCanvasTagHierarchy()
Returns
- IList<CanvasTag>
list of the wrapping canvas tags. The first tag is the innermost (nearest to the text).
GetCharSpacing()
public virtual float GetCharSpacing()
Returns
GetCharacterRenderInfos()
Provides detail useful if a listener needs access to the position of each individual glyph in the text render operation
public virtual IList<TextRenderInfo> GetCharacterRenderInfos()
Returns
- IList<TextRenderInfo>
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
GetDescentLine()
Gets the descent line for the text (i.e. the line that represents the bottom most extent that a string of the current font could have).
public virtual LineSegment GetDescentLine()
Returns
- LineSegment
a LineSegment instance
Remarks
Gets the descent line 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 - see GetRise() for the amount added by Rise.
GetExpansionText()
Gets /E tag (expansion text) entry value if this text chunk is marked content.
public virtual string GetExpansionText()
Returns
- string
/E value or
null
if none found
GetFillColor()
public virtual Color GetFillColor()
Returns
- Color
the current fill color.
GetFont()
Getter for the font
public virtual PdfFont GetFont()
Returns
- PdfFont
the font
GetFontSize()
public virtual float GetFontSize()
Returns
GetHorizontalScaling()
public virtual float GetHorizontalScaling()
Returns
GetLeading()
public virtual float GetLeading()
Returns
GetMcid()
Gets the marked-content identifier associated with this TextRenderInfo instance
public virtual int GetMcid()
Returns
- int
associated marked-content identifier or -1 in case content is unmarked
GetPdfString()
public virtual PdfString GetPdfString()
Returns
- PdfString
original PDF string
GetRise()
The rise represents how far above the nominal baseline the text should be rendered.
public virtual float GetRise()
Returns
- float
The Rise for the text draw operation, in user space units (Ts value, scaled to user space)
Remarks
The rise represents how far above the nominal baseline the text should be rendered. The 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)
GetSingleSpaceWidth()
public virtual float GetSingleSpaceWidth()
Returns
- float
The width, in user space units, of a single space character in the current font
GetStrokeColor()
public virtual Color GetStrokeColor()
Returns
- Color
the current stroke color.
GetText()
Gets the text to be rendered according to canvas operators.
public virtual string GetText()
Returns
- string
the text to render
GetTextMatrix()
Gets original Text matrix.
public virtual Matrix GetTextMatrix()
Returns
- Matrix
text matrix.
GetTextRenderMode()
public virtual int GetTextRenderMode()
Returns
- int
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
GetUnscaledBaseline()
public virtual LineSegment GetUnscaledBaseline()
Returns
GetUnscaledWidth()
public virtual float GetUnscaledWidth()
Returns
- float
the unscaled (i.e. in Text space) width of the text
GetWordSpacing()
public virtual float GetWordSpacing()
Returns
HasMcid(int)
Checks if this TextRenderInfo instance belongs to a marked content sequence with a given mcid.
public virtual bool HasMcid(int mcid)
Parameters
mcid
inta marked content id
Returns
- bool
true if this TextRenderInfo instance is marked with this id, false otherwise
HasMcid(int, bool)
Checks if this TextRenderInfo instance belongs to a marked content sequence with a given mcid.
public virtual bool HasMcid(int mcid, bool checkTheTopmostLevelOnly)
Parameters
mcid
inta marked content id
checkTheTopmostLevelOnly
boolindicates whether to check the topmost level of marked content stack only
Returns
- bool
true if this TextRenderInfo instance is marked with this id, false otherwise
IsReversedChars()
Determines if the text represented by this TextRenderInfo instance is written in a text showing operator wrapped by /ReversedChars marked content sequence
public virtual bool IsReversedChars()
Returns
- bool
true
if this text block lies within /ReversedChars block,false
otherwise