Class TextSvgBranchRenderer

    • Field Detail

      • TEXTFLIP

        protected static final AffineTransform TEXTFLIP
        Top level transformation to flip the y-axis results in the character glyphs being mirrored, this tf corrects for this behaviour
      • performRootTransformations

        @Deprecated
        protected boolean performRootTransformations
        Deprecated.
      • objectBoundingBox

        private Rectangle objectBoundingBox
      • moveResolved

        private boolean moveResolved
      • xMove

        private float xMove
      • yMove

        private float yMove
      • posResolved

        private boolean posResolved
      • xPos

        private float[] xPos
      • yPos

        private float[] yPos
      • whiteSpaceProcessed

        private boolean whiteSpaceProcessed
    • Constructor Detail

    • Method Detail

      • getTextContentLength

        @Deprecated
        public float getTextContentLength​(float parentFontSize,
                                          PdfFont font)
        Deprecated.
        Description copied from interface: ISvgTextNodeRenderer
        Gets text content length.
        Specified by:
        getTextContentLength in interface ISvgTextNodeRenderer
        Parameters:
        parentFontSize - parent font size
        font - 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 signature getRelativeTranslation(SvgDrawContext). This is needed because xMove/yMove can contain relative values, so SvgDrawContext is needed to resolve them.
        Specified by:
        getRelativeTranslation in interface ISvgTextNodeRenderer
        Returns:
        text relative translation
      • getRelativeTranslation

        public float[] getRelativeTranslation​(SvgDrawContext context)
        Gets relative translation of the current <text> or <tspan> element.
        Parameters:
        context - current SvgDrawContext
        Returns:
        float array that contains relative dx and dy translations
      • containsRelativeMove

        @Deprecated
        public boolean containsRelativeMove()
        Deprecated.
        Description copied from interface: ISvgTextNodeRenderer
        This method is deprecated and will be replaced with new signature containsRelativeMove(SvgDrawContext). This is needed because xMove/yMove can contain relative values, so SvgDrawContext is needed to resolve them.
        Specified by:
        containsRelativeMove in interface ISvgTextNodeRenderer
        Returns:
        true if there is a relative move, false otherwise
      • containsRelativeMove

        public boolean containsRelativeMove​(SvgDrawContext context)
        Checks whether current <text> or <tspan> element contains relative position change.
        Parameters:
        context - current SvgDrawContext
        Returns:
        true is current element contains relative position, false otherwise
      • containsAbsolutePositionChange

        public boolean containsAbsolutePositionChange()
        Description copied from interface: ISvgTextNodeRenderer
        This method is deprecated and will be replaced with new signature containsAbsolutePositionChange(SvgDrawContext). This is needed because x/y can contain relative values, so SvgDrawContext is needed to resolve them.
        Specified by:
        containsAbsolutePositionChange in interface ISvgTextNodeRenderer
        Returns:
        true if an absolute position is specified via x/y attributes, false otherwise
      • containsAbsolutePositionChange

        public boolean containsAbsolutePositionChange​(SvgDrawContext context)
        Checks whether current <text> or <tspan> element contains absolute position attributes.
        Parameters:
        context - current SvgDrawContext
        Returns:
        true is current element contains absolute position, false otherwise
      • getAbsolutePositionChanges

        public float[][] getAbsolutePositionChanges()
        Description copied from interface: ISvgTextNodeRenderer
        This method is deprecated and will be replaced with new signature getAbsolutePositionChanges(SvgDrawContext). This is needed because x/y can contain relative values, so SvgDrawContext is needed to resolve them.
        Specified by:
        getAbsolutePositionChanges in interface ISvgTextNodeRenderer
        Returns:
        text absolute position
      • getAbsolutePositionChanges

        public float[][] getAbsolutePositionChanges​(SvgDrawContext context)
        Gets absolute position of the current <text> or <tspan> element.
        Parameters:
        context - current SvgDrawContext
        Returns:
        float array that contains absolute x and y positions as either single item arrays or null if attribute is not present
      • markWhiteSpaceProcessed

        public void markWhiteSpaceProcessed()
        Marks white-space property as processed.
      • getObjectBoundingBox

        public Rectangle getObjectBoundingBox​(SvgDrawContext context)
        Description copied from interface: ISvgNodeRenderer
        Calculates the current object bounding box.
        Specified by:
        getObjectBoundingBox in interface ISvgNodeRenderer
        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)
        Method that will set properties to be inherited by this branch renderer's children and will iterate over all children in order to draw them.
        Specified by:
        doDraw in class AbstractSvgNodeRenderer
        Parameters:
        context - the object that knows the place to draw this element and maintains its state
      • applyTextRenderingMode

        void applyTextRenderingMode​(IElement element)
      • drawLastTextChunk

        private void drawLastTextChunk​(SvgDrawContext context)
      • resolveRelativeTextMove

        private void resolveRelativeTextMove​(SvgDrawContext context)
      • resolveAbsoluteTextPosition

        private void resolveAbsoluteTextPosition​(SvgDrawContext context)
      • getPositionsFromString

        private float[] getPositionsFromString​(java.lang.String rawValuesString,
                                               SvgDrawContext context,
                                               boolean isHorizontal)
      • getCommonRectangleWithAnchor

        private static Rectangle getCommonRectangleWithAnchor​(Rectangle commonRect,
                                                              Rectangle textChunkRect,
                                                              float absoluteX,
                                                              java.lang.String textAnchorValue)
        Adjust absolutely positioned text chunk (shift it to the start of view port, apply text anchor) and merge it with the common text rectangle.
        Parameters:
        commonRect - rectangle for the whole text tag
        textChunkRect - rectangle for the last absolutely positioned text chunk
        absoluteX - last absolute x position
        textAnchorValue - text anchor for the last text chunk
        Returns:
        merged common text rectangle
      • applyTextAnchor

        private void applyTextAnchor()
      • applyTextAnchor

        private void applyTextAnchor​(java.lang.String textAnchorValue,
                                     boolean isRtl)