Class NativeTextPainter

java.lang.Object
org.apache.batik.bridge.BasicTextPainter
org.apache.batik.bridge.StrokingTextPainter
org.apache.fop.svg.NativeTextPainter
All Implemented Interfaces:
org.apache.batik.bridge.TextPainter
Direct Known Subclasses:
PDFTextPainter, PSTextPainter

public abstract class NativeTextPainter extends org.apache.batik.bridge.StrokingTextPainter
Abstract base class for text painters that use specialized text commands native to an output format to render text.
  • Field Details

    • log

      protected static final org.apache.commons.logging.Log log
      the logger for this class
    • DEBUG

      private static final boolean DEBUG
      See Also:
    • fontInfo

      protected final FontInfo fontInfo
      the font collection
    • fontFamilyResolver

      protected final org.apache.batik.bridge.FontFamilyResolver fontFamilyResolver
    • font

      protected Font font
    • tpi

      protected org.apache.batik.gvt.text.TextPaintInfo tpi
    • COMPLEX_SCRIPT_TEXT_LAYOUT_FACTORY

      private static final org.apache.batik.bridge.TextLayoutFactory COMPLEX_SCRIPT_TEXT_LAYOUT_FACTORY
  • Constructor Details

    • NativeTextPainter

      public NativeTextPainter(FontInfo fontInfo)
      Creates a new instance.
      Parameters:
      fontInfo - the font collection
  • Method Details

    • isSupported

      protected abstract boolean isSupported(Graphics2D g2d)
      Indicates whether the given Graphics2D instance if compatible with this text painter implementation.
      Parameters:
      g2d - the instance to check
      Returns:
      true if the instance is compatible.
    • paintTextRun

      protected final void paintTextRun(org.apache.batik.bridge.StrokingTextPainter.TextRun textRun, Graphics2D g2d) throws IOException
      Paints a single text run.
      Parameters:
      textRun - the text run
      g2d - the target Graphics2D instance
      Throws:
      IOException - if an I/O error occurs while rendering the text
    • writeGlyphs

      protected void writeGlyphs(FOPGVTGlyphVector gv, GeneralPath debugShapes) throws IOException
      Throws:
      IOException
    • getLocalTransform

      protected AffineTransform getLocalTransform(Point2D glyphPos, AffineTransform glyphTransform)
    • paintTextRuns

      protected void paintTextRuns(List textRuns, Graphics2D g2d)
      Overrides:
      paintTextRuns in class org.apache.batik.bridge.StrokingTextPainter
    • collectCharacters

      protected CharSequence collectCharacters(AttributedCharacterIterator runaci)
      Collects all characters from an AttributedCharacterIterator.
      Parameters:
      runaci - the character iterator
      Returns:
      the characters
    • computeTextRuns

      public List computeTextRuns(org.apache.batik.bridge.TextNode node, AttributedCharacterIterator nodeACI, AttributedCharacterIterator[] chunkACIs)
      Overrides:
      computeTextRuns in class org.apache.batik.bridge.StrokingTextPainter
    • getTextRunBoundaryAttributes

      protected Set getTextRunBoundaryAttributes()
      Overrides:
      getTextRunBoundaryAttributes in class org.apache.batik.bridge.StrokingTextPainter
    • reorderTextRuns

      protected List reorderTextRuns(org.apache.batik.bridge.StrokingTextPainter.TextChunk chunk, List runs)
      Overrides:
      reorderTextRuns in class org.apache.batik.bridge.StrokingTextPainter
    • reorderRuns

      private List reorderRuns(List runs, int level)
    • reverseRuns

      private List reverseRuns(List runs, int s, int e)
    • reverseGlyphs

      private void reverseGlyphs(List runs, boolean mirror)
    • preparePainting

      protected abstract void preparePainting(Graphics2D g2d)
    • saveGraphicsState

      protected abstract void saveGraphicsState() throws IOException
      Throws:
      IOException
    • restoreGraphicsState

      protected abstract void restoreGraphicsState() throws IOException
      Throws:
      IOException
    • setInitialTransform

      protected abstract void setInitialTransform(AffineTransform transform) throws IOException
      Throws:
      IOException
    • clip

      protected abstract void clip(Shape clip) throws IOException
      Throws:
      IOException
    • beginTextObject

      protected abstract void beginTextObject() throws IOException
      Throws:
      IOException
    • endTextObject

      protected abstract void endTextObject() throws IOException
      Throws:
      IOException
    • positionGlyph

      protected abstract void positionGlyph(Point2D prevPos, Point2D glyphPos, boolean reposition)
    • writeGlyph

      protected abstract void writeGlyph(char glyph, AffineTransform transform) throws IOException
      Throws:
      IOException
    • logTextRun

      protected final void logTextRun(org.apache.batik.bridge.StrokingTextPainter.TextRun textRun)
    • logCharacter

      protected final void logCharacter(char ch, org.apache.batik.bridge.TextSpanLayout layout, int index, boolean visibleChar)
      Parameters:
      ch - a character
      layout - a text span layout
      index - an index
      visibleChar - visible character flag
    • getFontFamilyResolver

      protected org.apache.batik.bridge.FontFamilyResolver getFontFamilyResolver()
      Overrides:
      getFontFamilyResolver in class org.apache.batik.bridge.StrokingTextPainter
    • getTextLayoutFactory

      protected org.apache.batik.bridge.TextLayoutFactory getTextLayoutFactory()
      Overrides:
      getTextLayoutFactory in class org.apache.batik.bridge.BasicTextPainter