Package com.itextpdf.svg.renderers.impl
Class TextLeafSvgNodeRenderer
- java.lang.Object
-
- com.itextpdf.svg.renderers.impl.AbstractSvgNodeRenderer
-
- com.itextpdf.svg.renderers.impl.TextLeafSvgNodeRenderer
-
- All Implemented Interfaces:
ISvgTextNodeRenderer
,ISvgNodeRenderer
public class TextLeafSvgNodeRenderer extends AbstractSvgNodeRenderer implements ISvgTextNodeRenderer
ISvgNodeRenderer
implementation for drawing text to a canvas.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.itextpdf.svg.renderers.impl.AbstractSvgNodeRenderer
AbstractSvgNodeRenderer.FillProperties, AbstractSvgNodeRenderer.StrokeProperties
-
-
Field Summary
Fields Modifier and Type Field Description private Text
text
-
Fields inherited from class com.itextpdf.svg.renderers.impl.AbstractSvgNodeRenderer
attributesAndStyles, doFill, doStroke
-
-
Constructor Summary
Constructors Constructor Description TextLeafSvgNodeRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private void
applyGraphicsState(SvgDrawContext context)
private void
applyTransform(SvgDrawContext context)
protected boolean
canElementFill()
Method to see if a certain renderer can use fill.boolean
containsAbsolutePositionChange()
Deprecated.boolean
containsRelativeMove()
Deprecated.ISvgNodeRenderer
createDeepCopy()
Creates a deep copy of this renderer, including it's subtree of childrenprotected void
doDraw(SvgDrawContext context)
Draws this element to a canvas-like object maintained in the context.float[][]
getAbsolutePositionChanges()
Deprecated.Rectangle
getObjectBoundingBox(SvgDrawContext context)
Calculates the current object bounding box.float[]
getRelativeTranslation()
Deprecated.float
getTextContentLength(float parentFontSize, PdfFont font)
Deprecated.TextRectangle
getTextRectangle(SvgDrawContext context, Point startPoint)
Return the bounding rectangle of the text element.private LineRenderer
layoutText(SvgDrawContext context)
-
Methods inherited from class com.itextpdf.svg.renderers.impl.AbstractSvgNodeRenderer
applyFillAndStrokeProperties, applyNonScalingStrokeTransform, calculateViewPortTranslation, canConstructViewPort, deepCopyAttributesAndStyles, doStrokeOrFill, draw, getAttribute, getAttributeMapCopy, getAttributeOrDefault, getCurrentFontSize, getCurrentFontSize, getCurrentViewBox, getParent, getParentClipPath, isHidden, parseAbsoluteLength, parseHorizontalLength, parseVerticalLength, postDraw, preDraw, retrieveAlignAndMeet, setAttribute, setAttributesAndStyles, setParent
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.itextpdf.svg.renderers.ISvgNodeRenderer
draw, getAttribute, getAttributeMapCopy, getParent, setAttribute, setAttributesAndStyles, setParent
-
-
-
-
Field Detail
-
text
private final Text text
-
-
Method Detail
-
createDeepCopy
public ISvgNodeRenderer createDeepCopy()
Description copied from interface:ISvgNodeRenderer
Creates a deep copy of this renderer, including it's subtree of children- Specified by:
createDeepCopy
in interfaceISvgNodeRenderer
- Returns:
- deep copy of this renderer
-
getTextContentLength
@Deprecated public float getTextContentLength(float parentFontSize, PdfFont font)
Deprecated.Description copied from interface:ISvgTextNodeRenderer
Gets text content length.- Specified by:
getTextContentLength
in interfaceISvgTextNodeRenderer
- Parameters:
parentFontSize
- parent font sizefont
- current font- Returns:
- text content length
-
getRelativeTranslation
@Deprecated public float[] getRelativeTranslation()
Deprecated.Description copied from interface:ISvgTextNodeRenderer
This method is deprecated and will be replaced with new signaturegetRelativeTranslation(SvgDrawContext)
. This is needed because xMove/yMove can contain relative values, so SvgDrawContext is needed to resolve them.- Specified by:
getRelativeTranslation
in interfaceISvgTextNodeRenderer
- Returns:
- text relative translation
-
containsRelativeMove
@Deprecated public boolean containsRelativeMove()
Deprecated.Description copied from interface:ISvgTextNodeRenderer
This method is deprecated and will be replaced with new signaturecontainsRelativeMove(SvgDrawContext)
. This is needed because xMove/yMove can contain relative values, so SvgDrawContext is needed to resolve them.- Specified by:
containsRelativeMove
in interfaceISvgTextNodeRenderer
- Returns:
true
if there is a relative move,false
otherwise
-
containsAbsolutePositionChange
@Deprecated public boolean containsAbsolutePositionChange()
Deprecated.Description copied from interface:ISvgTextNodeRenderer
This method is deprecated and will be replaced with new signaturecontainsAbsolutePositionChange(SvgDrawContext)
. This is needed because x/y can contain relative values, so SvgDrawContext is needed to resolve them.- Specified by:
containsAbsolutePositionChange
in interfaceISvgTextNodeRenderer
- Returns:
true
if an absolute position is specified via x/y attributes,false
otherwise
-
getAbsolutePositionChanges
@Deprecated public float[][] getAbsolutePositionChanges()
Deprecated.Description copied from interface:ISvgTextNodeRenderer
This method is deprecated and will be replaced with new signaturegetAbsolutePositionChanges(SvgDrawContext)
. This is needed because x/y can contain relative values, so SvgDrawContext is needed to resolve them.- Specified by:
getAbsolutePositionChanges
in interfaceISvgTextNodeRenderer
- Returns:
- text absolute position
-
getTextRectangle
public TextRectangle getTextRectangle(SvgDrawContext context, Point startPoint)
Description copied from interface:ISvgTextNodeRenderer
Return the bounding rectangle of the text element.- Specified by:
getTextRectangle
in interfaceISvgTextNodeRenderer
- Parameters:
context
- currentSvgDrawContext
startPoint
- end point of previous text element- Returns:
- created instance of
TextRectangle
-
getObjectBoundingBox
public Rectangle getObjectBoundingBox(SvgDrawContext context)
Description copied from interface:ISvgNodeRenderer
Calculates the current object bounding box.- Specified by:
getObjectBoundingBox
in interfaceISvgNodeRenderer
- Parameters:
context
- the current context, for instance it contains current viewport and available font data- Returns:
- the
Rectangle
representing the current object's bounding box, or null if bounding box is undefined
-
doDraw
protected void doDraw(SvgDrawContext context)
Description copied from class:AbstractSvgNodeRenderer
Draws this element to a canvas-like object maintained in the context.- Specified by:
doDraw
in classAbstractSvgNodeRenderer
- Parameters:
context
- the object that knows the place to draw this element and maintains its state
-
canElementFill
protected boolean canElementFill()
Description copied from class:AbstractSvgNodeRenderer
Method to see if a certain renderer can use fill.- Overrides:
canElementFill
in classAbstractSvgNodeRenderer
- Returns:
- true if the renderer can use fill
-
applyTransform
private void applyTransform(SvgDrawContext context)
-
applyGraphicsState
private void applyGraphicsState(SvgDrawContext context)
-
layoutText
private LineRenderer layoutText(SvgDrawContext context)
-
-