org.apache.fop.svg

## 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 and Description
    --- | ---
    `protected Font` | `font`
    `protected org.apache.batik.bridge.FontFamilyResolver` | `fontFamilyResolver`
    `protected FontInfo` | `fontInfo` the font collection
    `protected static org.apache.commons.logging.Log` | `log` the logger for this class
    `protected org.apache.batik.gvt.text.TextPaintInfo` | `tpi`

    - ### 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 and Description
    `NativeTextPainter(FontInfo fontInfo)` Creates a new instance.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract void` | `beginTextObject()`
    `protected abstract void` | `clip(java.awt.Shape clip)`
    `protected java.lang.CharSequence` | `collectCharacters(java.text.AttributedCharacterIterator runaci)` Collects all characters from an `AttributedCharacterIterator`.
    `java.util.List` | `computeTextRuns(org.apache.batik.bridge.TextNode node, java.text.AttributedCharacterIterator nodeACI, java.text.AttributedCharacterIterator[] chunkACIs)`
    `protected abstract void` | `endTextObject()`
    `protected org.apache.batik.bridge.FontFamilyResolver` | `getFontFamilyResolver()`
    `protected org.apache.batik.bridge.TextLayoutFactory` | `getTextLayoutFactory()`
    `protected java.util.Set` | `getTextRunBoundaryAttributes()`
    `protected abstract boolean` | `isSupported(java.awt.Graphics2D g2d)` Indicates whether the given `Graphics2D` instance if compatible with this text painter implementation.
    `protected void` | `logCharacter(char ch, org.apache.batik.bridge.TextSpanLayout layout, int index, boolean visibleChar)`
    `protected void` | `logTextRun(org.apache.batik.bridge.StrokingTextPainter.TextRun textRun)`
    `protected void` | `paintTextRun(org.apache.batik.bridge.StrokingTextPainter.TextRun textRun, java.awt.Graphics2D g2d)` Paints a single text run.
    `protected void` | `paintTextRuns(java.util.List textRuns, java.awt.Graphics2D g2d)`
    `protected abstract void` | `positionGlyph(java.awt.geom.Point2D prevPos, java.awt.geom.Point2D glyphPos, boolean reposition)`
    `protected abstract void` | `preparePainting(java.awt.Graphics2D g2d)`
    `protected java.util.List` | `reorderTextRuns(org.apache.batik.bridge.StrokingTextPainter.TextChunk chunk, java.util.List runs)`
    `protected abstract void` | `restoreGraphicsState()`
    `protected abstract void` | `saveGraphicsState()`
    `protected abstract void` | `setInitialTransform(java.awt.geom.AffineTransform transform)`
    `protected abstract void` | `writeGlyph(char glyph, java.awt.geom.AffineTransform transform)`
    `protected void` | `writeGlyphs(FOPGVTGlyphVector gv, java.awt.geom.GeneralPath debugShapes)`

    - ### 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 Detail

    - #### 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 Detail

    - #### NativeTextPainter

          public NativeTextPainter(FontInfo fontInfo)

      Creates a new instance.
      Parameters:
        `fontInfo` - the font collection

  - ### Method Detail

    - #### isSupported

          protected abstract boolean isSupported(java.awt.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,
                                            java.awt.Graphics2D g2d)
                                     throws java.io.IOException

      Paints a single text run.
      Parameters:
        `textRun` - the text run
        `g2d` - the target Graphics2D instance
      Throws:
        `java.io.IOException` - if an I/O error occurs while rendering the text

    - #### writeGlyphs

          protected void writeGlyphs(FOPGVTGlyphVector gv,
                                     java.awt.geom.GeneralPath debugShapes)
                              throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### paintTextRuns

          protected void paintTextRuns(java.util.List textRuns,
                                       java.awt.Graphics2D g2d)

      Overrides:
        `paintTextRuns` in class `org.apache.batik.bridge.StrokingTextPainter`

    - #### collectCharacters

          protected java.lang.CharSequence collectCharacters(java.text.AttributedCharacterIterator runaci)

      Collects all characters from an `AttributedCharacterIterator`.
      Parameters:
        `runaci` - the character iterator
      Returns:
        the characters

    - #### computeTextRuns

          public java.util.List computeTextRuns(org.apache.batik.bridge.TextNode node,
                                                java.text.AttributedCharacterIterator nodeACI,
                                                java.text.AttributedCharacterIterator[] chunkACIs)

      Overrides:
        `computeTextRuns` in class `org.apache.batik.bridge.StrokingTextPainter`

    - #### getTextRunBoundaryAttributes

          protected java.util.Set getTextRunBoundaryAttributes()

      Overrides:
        `getTextRunBoundaryAttributes` in class `org.apache.batik.bridge.StrokingTextPainter`

    - #### reorderTextRuns

          protected java.util.List reorderTextRuns(org.apache.batik.bridge.StrokingTextPainter.TextChunk chunk,
                                                   java.util.List runs)

      Overrides:
        `reorderTextRuns` in class `org.apache.batik.bridge.StrokingTextPainter`

    - #### preparePainting

          protected abstract void preparePainting(java.awt.Graphics2D g2d)

    - #### saveGraphicsState

          protected abstract void saveGraphicsState()
                                             throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### restoreGraphicsState

          protected abstract void restoreGraphicsState()
                                                throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### setInitialTransform

          protected abstract void setInitialTransform(java.awt.geom.AffineTransform transform)
                                               throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### clip

          protected abstract void clip(java.awt.Shape clip)
                                throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### beginTextObject

          protected abstract void beginTextObject()
                                           throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### endTextObject

          protected abstract void endTextObject()
                                         throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### positionGlyph

          protected abstract void positionGlyph(java.awt.geom.Point2D prevPos,
                                                java.awt.geom.Point2D glyphPos,
                                                boolean reposition)

    - #### writeGlyph

          protected abstract void writeGlyph(char glyph,
                                             java.awt.geom.AffineTransform transform)
                                      throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### logTextRun

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

      Parameters:
        `runaci` - an attributed character iterator
        `layout` - a text span layout

    - #### 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`

Copyright 1999-2015 The Apache Software Foundation. All Rights Reserved.