Class PDFTextPainter

  • All Implemented Interfaces:
    org.apache.batik.bridge.TextPainter
    Direct Known Subclasses:
    PDFFlowExtTextPainter, PDFFlowTextPainter

    class PDFTextPainter
    extends NativeTextPainter
    Renders the attributed character iterator of a TextNode. This class draws the text directly into the PDFGraphics2D so that the text is not drawn using shapes which makes the PDF files larger. If the text is simple enough to draw then it sets the font and calls drawString. If the text is complex or the cannot be translated into a simple drawString the StrokingTextPainter is used instead.
    Version:
    $Id$
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.apache.batik.bridge.StrokingTextPainter

        org.apache.batik.bridge.StrokingTextPainter.TextChunk, org.apache.batik.bridge.StrokingTextPainter.TextRun
      • Nested classes/interfaces inherited from class org.apache.batik.bridge.BasicTextPainter

        org.apache.batik.bridge.BasicTextPainter.BasicMark
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static int[] paZero  
      private PDFGraphics2D pdf  
      private double prevVisibleGlyphWidth  
      private boolean repositionNextGlyph  
      private PDFTextUtil textUtil  
      • Fields inherited from class org.apache.batik.bridge.StrokingTextPainter

        ADJUST_ALL, ADJUST_SPACING, ALT_GLYPH_HANDLER, ANCHOR_TYPE, BIDI_LEVEL, FLOW_PARAGRAPH, FLOW_REGIONS, GVT_FONT, GVT_FONTS, PAINT_INFO, singleton, TEXT_COMPOUND_ID, TEXTPATH, WRITING_MODE, WRITING_MODE_RTL, WRITING_MODE_TTB, XPOS, YPOS
      • Fields inherited from class org.apache.batik.bridge.BasicTextPainter

        aaOffFontRenderContext, fontRenderContext
    • Constructor Summary

      Constructors 
      Constructor Description
      PDFTextPainter​(FontInfo fi)
      Create a new PDF text painter with the given font information.
    • Field Detail

      • prevVisibleGlyphWidth

        private double prevVisibleGlyphWidth
      • repositionNextGlyph

        private boolean repositionNextGlyph
      • paZero

        private static int[] paZero
    • Constructor Detail

      • PDFTextPainter

        public PDFTextPainter​(FontInfo fi)
        Create a new PDF text painter with the given font information.
        Parameters:
        fi - the font info
    • Method Detail

      • isSupported

        protected boolean isSupported​(java.awt.Graphics2D g2d)
        Indicates whether the given Graphics2D instance if compatible with this text painter implementation.
        Specified by:
        isSupported in class NativeTextPainter
        Parameters:
        g2d - the instance to check
        Returns:
        true if the instance is compatible.
      • createTextUtil

        private void createTextUtil()
      • applyColorAndPaint

        private void applyColorAndPaint​(org.apache.batik.gvt.text.TextPaintInfo tpi)
      • positionGlyph

        protected void positionGlyph​(java.awt.geom.Point2D prevPos,
                                     java.awt.geom.Point2D glyphPos,
                                     boolean reposition)
        Specified by:
        positionGlyph in class NativeTextPainter
      • writeGlyph

        protected void writeGlyph​(char glyph,
                                  java.awt.geom.AffineTransform transform)
        Specified by:
        writeGlyph in class NativeTextPainter