Package 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.StrokingTextPainterAbstract base class for text painters that use specialized text commands native to an output format to render text.
-
-
Field Summary
Fields Modifier and Type Field Description protected Fontfontprotected org.apache.batik.bridge.FontFamilyResolverfontFamilyResolverprotected FontInfofontInfothe font collectionprotected static org.apache.commons.logging.Loglogthe logger for this classprotected org.apache.batik.gvt.text.TextPaintInfotpi-
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
-
-
Constructor Summary
Constructors Constructor Description NativeTextPainter(FontInfo fontInfo)Creates a new instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidbeginTextObject()protected abstract voidclip(java.awt.Shape clip)protected java.lang.CharSequencecollectCharacters(java.text.AttributedCharacterIterator runaci)Collects all characters from anAttributedCharacterIterator.java.util.ListcomputeTextRuns(org.apache.batik.bridge.TextNode node, java.text.AttributedCharacterIterator nodeACI, java.text.AttributedCharacterIterator[] chunkACIs)protected abstract voidendTextObject()protected org.apache.batik.bridge.FontFamilyResolvergetFontFamilyResolver()protected org.apache.batik.bridge.TextLayoutFactorygetTextLayoutFactory()protected java.util.SetgetTextRunBoundaryAttributes()protected abstract booleanisSupported(java.awt.Graphics2D g2d)Indicates whether the givenGraphics2Dinstance if compatible with this text painter implementation.protected voidlogCharacter(char ch, org.apache.batik.bridge.TextSpanLayout layout, int index, boolean visibleChar)protected voidlogTextRun(org.apache.batik.bridge.StrokingTextPainter.TextRun textRun)protected voidpaintTextRun(org.apache.batik.bridge.StrokingTextPainter.TextRun textRun, java.awt.Graphics2D g2d)Paints a single text run.protected voidpaintTextRuns(java.util.List textRuns, java.awt.Graphics2D g2d)protected abstract voidpositionGlyph(java.awt.geom.Point2D prevPos, java.awt.geom.Point2D glyphPos, boolean reposition)protected abstract voidpreparePainting(java.awt.Graphics2D g2d)protected java.util.ListreorderTextRuns(org.apache.batik.bridge.StrokingTextPainter.TextChunk chunk, java.util.List runs)protected abstract voidrestoreGraphicsState()protected abstract voidsaveGraphicsState()protected abstract voidsetInitialTransform(java.awt.geom.AffineTransform transform)protected abstract voidwriteGlyph(char glyph, java.awt.geom.AffineTransform transform)protected voidwriteGlyphs(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
-
-
-
-
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 givenGraphics2Dinstance 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.IOExceptionPaints a single text run.- Parameters:
textRun- the text rung2d- 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:
paintTextRunsin classorg.apache.batik.bridge.StrokingTextPainter
-
collectCharacters
protected java.lang.CharSequence collectCharacters(java.text.AttributedCharacterIterator runaci)
Collects all characters from anAttributedCharacterIterator.- 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:
computeTextRunsin classorg.apache.batik.bridge.StrokingTextPainter
-
getTextRunBoundaryAttributes
protected java.util.Set getTextRunBoundaryAttributes()
- Overrides:
getTextRunBoundaryAttributesin classorg.apache.batik.bridge.StrokingTextPainter
-
reorderTextRuns
protected java.util.List reorderTextRuns(org.apache.batik.bridge.StrokingTextPainter.TextChunk chunk, java.util.List runs)- Overrides:
reorderTextRunsin classorg.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)
-
logCharacter
protected final void logCharacter(char ch, org.apache.batik.bridge.TextSpanLayout layout, int index, boolean visibleChar)- Parameters:
ch- a characterlayout- a text span layoutindex- an indexvisibleChar- visible character flag
-
getFontFamilyResolver
protected org.apache.batik.bridge.FontFamilyResolver getFontFamilyResolver()
- Overrides:
getFontFamilyResolverin classorg.apache.batik.bridge.StrokingTextPainter
-
getTextLayoutFactory
protected org.apache.batik.bridge.TextLayoutFactory getTextLayoutFactory()
- Overrides:
getTextLayoutFactoryin classorg.apache.batik.bridge.BasicTextPainter
-
-