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.
-
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.TextRunNested classes/interfaces inherited from class org.apache.batik.bridge.BasicTextPainter
org.apache.batik.bridge.BasicTextPainter.BasicMark -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.apache.batik.bridge.TextLayoutFactoryprivate static final booleanprotected Fontprotected final org.apache.batik.bridge.FontFamilyResolverprotected final FontInfothe font collectionprotected static final org.apache.commons.logging.Logthe logger for this classprotected org.apache.batik.gvt.text.TextPaintInfoFields 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, YPOSFields inherited from class org.apache.batik.bridge.BasicTextPainter
aaOffFontRenderContext, fontRenderContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidprotected abstract voidprotected CharSequenceCollects all characters from anAttributedCharacterIterator.computeTextRuns(org.apache.batik.bridge.TextNode node, AttributedCharacterIterator nodeACI, AttributedCharacterIterator[] chunkACIs) protected abstract voidprotected org.apache.batik.bridge.FontFamilyResolverprotected AffineTransformgetLocalTransform(Point2D glyphPos, AffineTransform glyphTransform) protected org.apache.batik.bridge.TextLayoutFactoryprotected Setprotected abstract booleanisSupported(Graphics2D g2d) Indicates whether the givenGraphics2Dinstance if compatible with this text painter implementation.protected final voidlogCharacter(char ch, org.apache.batik.bridge.TextSpanLayout layout, int index, boolean visibleChar) protected final voidlogTextRun(org.apache.batik.bridge.StrokingTextPainter.TextRun textRun) protected final voidpaintTextRun(org.apache.batik.bridge.StrokingTextPainter.TextRun textRun, Graphics2D g2d) Paints a single text run.protected voidpaintTextRuns(List textRuns, Graphics2D g2d) protected abstract voidpositionGlyph(Point2D prevPos, Point2D glyphPos, boolean reposition) protected abstract voidprivate ListreorderRuns(List runs, int level) protected ListreorderTextRuns(org.apache.batik.bridge.StrokingTextPainter.TextChunk chunk, List runs) protected abstract voidprivate voidreverseGlyphs(List runs, boolean mirror) private ListreverseRuns(List runs, int s, int e) protected abstract voidprotected abstract voidsetInitialTransform(AffineTransform transform) protected abstract voidwriteGlyph(char glyph, AffineTransform transform) protected voidwriteGlyphs(FOPGVTGlyphVector gv, 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, selectLastMethods inherited from class org.apache.batik.bridge.BasicTextPainter
getGeometryBounds, selectAt, selectTo
-
Field Details
-
log
protected static final org.apache.commons.logging.Log logthe logger for this class -
DEBUG
private static final boolean DEBUG- See Also:
-
fontInfo
the font collection -
fontFamilyResolver
protected final org.apache.batik.bridge.FontFamilyResolver fontFamilyResolver -
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
Creates a new instance.- Parameters:
fontInfo- the font collection
-
-
Method Details
-
isSupported
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, Graphics2D g2d) throws IOException Paints a single text run.- Parameters:
textRun- the text rung2d- the target Graphics2D instance- Throws:
IOException- if an I/O error occurs while rendering the text
-
writeGlyphs
- Throws:
IOException
-
getLocalTransform
-
paintTextRuns
- Overrides:
paintTextRunsin classorg.apache.batik.bridge.StrokingTextPainter
-
collectCharacters
Collects all characters from anAttributedCharacterIterator.- Parameters:
runaci- the character iterator- Returns:
- the characters
-
computeTextRuns
public List computeTextRuns(org.apache.batik.bridge.TextNode node, AttributedCharacterIterator nodeACI, AttributedCharacterIterator[] chunkACIs) - Overrides:
computeTextRunsin classorg.apache.batik.bridge.StrokingTextPainter
-
getTextRunBoundaryAttributes
- Overrides:
getTextRunBoundaryAttributesin classorg.apache.batik.bridge.StrokingTextPainter
-
reorderTextRuns
-
reorderRuns
-
reverseRuns
-
reverseGlyphs
-
preparePainting
-
saveGraphicsState
- Throws:
IOException
-
restoreGraphicsState
- Throws:
IOException
-
setInitialTransform
- Throws:
IOException
-
clip
- Throws:
IOException
-
beginTextObject
- Throws:
IOException
-
endTextObject
- Throws:
IOException
-
positionGlyph
-
writeGlyph
- 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 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
-