Package org.apache.fop.svg
Class PDFTextPainter
java.lang.Object
org.apache.batik.bridge.BasicTextPainter
org.apache.batik.bridge.StrokingTextPainter
org.apache.fop.svg.NativeTextPainter
org.apache.fop.svg.PDFTextPainter
- All Implemented Interfaces:
org.apache.batik.bridge.TextPainter
- Direct Known Subclasses:
PDFFlowExtTextPainter
,PDFFlowTextPainter
Renders the attributed character iterator of a
TextNode
.
This class draws the text directly into the PDFGraphics2D so that
the text is not drawn using shapes which makes the PDF files larger.
If the text is simple enough to draw then it sets the font and calls
drawString. If the text is complex or the cannot be translated
into a simple drawString the StrokingTextPainter is used instead.- Version:
- $Id$
-
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
FieldsModifier and TypeFieldDescriptionprivate static int[]
private PDFGraphics2D
private double
private boolean
private PDFTextUtil
Fields inherited from class org.apache.fop.svg.NativeTextPainter
font, fontFamilyResolver, fontInfo, log, 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
ConstructorsConstructorDescriptionCreate a new PDF text painter with the given font information. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
applyColorAndPaint
(org.apache.batik.gvt.text.TextPaintInfo tpi) protected void
protected void
private void
protected void
protected boolean
isSupported
(Graphics2D g2d) Indicates whether the givenGraphics2D
instance if compatible with this text painter implementation.protected void
positionGlyph
(Point2D prevPos, Point2D glyphPos, boolean reposition) protected void
protected void
protected void
protected void
setInitialTransform
(AffineTransform transform) protected void
writeGlyph
(char glyph, AffineTransform transform) protected void
writeGlyphs
(FOPGVTGlyphVector gv, GeneralPath debugShapes) Methods inherited from class org.apache.fop.svg.NativeTextPainter
collectCharacters, computeTextRuns, getFontFamilyResolver, getTextLayoutFactory, getTextRunBoundaryAttributes, logCharacter, logTextRun, paintTextRun, paintTextRuns, reorderTextRuns
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
-
Field Details
-
pdf
-
textUtil
-
prevVisibleGlyphWidth
private double prevVisibleGlyphWidth -
repositionNextGlyph
private boolean repositionNextGlyph -
paZero
private static int[] paZero
-
-
Constructor Details
-
PDFTextPainter
Create a new PDF text painter with the given font information.- Parameters:
fi
- the font info
-
-
Method Details
-
isSupported
Indicates whether the givenGraphics2D
instance if compatible with this text painter implementation.- Specified by:
isSupported
in classNativeTextPainter
- Parameters:
g2d
- the instance to check- Returns:
- true if the instance is compatible.
-
preparePainting
- Specified by:
preparePainting
in classNativeTextPainter
-
saveGraphicsState
protected void saveGraphicsState()- Specified by:
saveGraphicsState
in classNativeTextPainter
-
restoreGraphicsState
protected void restoreGraphicsState()- Specified by:
restoreGraphicsState
in classNativeTextPainter
-
setInitialTransform
- Specified by:
setInitialTransform
in classNativeTextPainter
-
createTextUtil
private void createTextUtil() -
clip
- Specified by:
clip
in classNativeTextPainter
-
writeGlyphs
- Overrides:
writeGlyphs
in classNativeTextPainter
- Throws:
IOException
-
beginTextObject
protected void beginTextObject()- Specified by:
beginTextObject
in classNativeTextPainter
-
endTextObject
protected void endTextObject()- Specified by:
endTextObject
in classNativeTextPainter
-
applyColorAndPaint
private void applyColorAndPaint(org.apache.batik.gvt.text.TextPaintInfo tpi) -
positionGlyph
- Specified by:
positionGlyph
in classNativeTextPainter
-
writeGlyph
- Specified by:
writeGlyph
in classNativeTextPainter
-