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:
PDFFlowExtTextPainter, PDFFlowTextPainter, 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.
  • 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
    protected Font
     
    protected final org.apache.batik.bridge.FontFamilyResolver
     
    protected final FontInfo
    the font collection
    protected static final org.apache.commons.logging.Log
    the logger for this class
    protected org.apache.batik.gvt.text.TextPaintInfo
     

    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
    Creates a new instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract void
     
    protected abstract void
    clip(Shape clip)
     
    protected CharSequence
    Collects all characters from an AttributedCharacterIterator.
    computeTextRuns(org.apache.batik.bridge.TextNode node, AttributedCharacterIterator nodeACI, AttributedCharacterIterator[] chunkACIs)
     
    protected abstract void
     
    protected org.apache.batik.bridge.FontFamilyResolver
     
    protected org.apache.batik.bridge.TextLayoutFactory
     
    protected Set
     
    protected abstract boolean
    Indicates whether the given Graphics2D instance if compatible with this text painter implementation.
    protected final void
    logCharacter(char ch, org.apache.batik.bridge.TextSpanLayout layout, int index, boolean visibleChar)
     
    protected final void
    logTextRun(org.apache.batik.bridge.StrokingTextPainter.TextRun textRun)
     
    protected final void
    paintTextRun(org.apache.batik.bridge.StrokingTextPainter.TextRun textRun, Graphics2D g2d)
    Paints a single text run.
    protected void
    paintTextRuns(List textRuns, Graphics2D g2d)
     
    protected abstract void
    positionGlyph(Point2D prevPos, Point2D glyphPos, boolean reposition)
     
    protected abstract void
     
    protected List
    reorderTextRuns(org.apache.batik.bridge.StrokingTextPainter.TextChunk chunk, List runs)
     
    protected abstract void
     
    protected abstract void
     
    protected abstract void
     
    protected abstract void
    writeGlyph(char glyph, AffineTransform transform)
     
    protected void
     

    Methods inherited from class org.apache.batik.bridge.StrokingTextPainter

    adjustChunkOffsets, computeTextRuns, createModifiedACIForFontMatching, getBounds2D, getDecorationOutline, getDecorationStrokeOutline, getHighlightShape, getInstance, getMark, getOutline, getSelected, getTextChunk, getTextChunkACIs, getTextRuns, hitTest, paint, paintDecorations, printAttrs, selectFirst, selectLast

    Methods inherited from class org.apache.batik.bridge.BasicTextPainter

    getGeometryBounds, selectAt, selectTo

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • log

      protected static final org.apache.commons.logging.Log log
      the logger for this class
    • 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
  • 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
    • 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
    • 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