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
class PDFTextPainter extends NativeTextPainter
Renders the attributed character iterator of aTextNode. 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: PDFTextPainter.java 1805173 2017-08-16 10:50:04Z ssteiner $
-
-
Field Summary
Fields Modifier and Type Field Description private static int[]paZeroprivate PDFGraphics2Dpdfprivate doubleprevVisibleGlyphWidthprivate booleanrepositionNextGlyphprivate PDFTextUtiltextUtil-
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
-
-
Constructor Summary
Constructors Constructor Description PDFTextPainter(FontInfo fi)Create a new PDF text painter with the given font information.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidapplyColorAndPaint(org.apache.batik.gvt.text.TextPaintInfo tpi)protected voidbeginTextObject()protected voidclip(java.awt.Shape clip)private voidcreateTextUtil()protected voidendTextObject()protected booleanisSupported(java.awt.Graphics2D g2d)Indicates whether the givenGraphics2Dinstance if compatible with this text painter implementation.protected voidpositionGlyph(java.awt.geom.Point2D prevPos, java.awt.geom.Point2D glyphPos, boolean reposition)protected voidpreparePainting(java.awt.Graphics2D g2d)protected voidrestoreGraphicsState()protected voidsaveGraphicsState()protected voidsetInitialTransform(java.awt.geom.AffineTransform transform)protected voidwriteGlyph(char glyph, java.awt.geom.AffineTransform transform)protected voidwriteGlyphs(FOPGVTGlyphVector gv, java.awt.geom.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
-
-
-
-
Field Detail
-
pdf
private PDFGraphics2D pdf
-
textUtil
private PDFTextUtil textUtil
-
prevVisibleGlyphWidth
private double prevVisibleGlyphWidth
-
repositionNextGlyph
private boolean repositionNextGlyph
-
paZero
private static int[] paZero
-
-
Constructor Detail
-
PDFTextPainter
public PDFTextPainter(FontInfo fi)
Create a new PDF text painter with the given font information.- Parameters:
fi- the font info
-
-
Method Detail
-
isSupported
protected boolean isSupported(java.awt.Graphics2D g2d)
Indicates whether the givenGraphics2Dinstance if compatible with this text painter implementation.- Specified by:
isSupportedin classNativeTextPainter- Parameters:
g2d- the instance to check- Returns:
- true if the instance is compatible.
-
preparePainting
protected void preparePainting(java.awt.Graphics2D g2d)
- Specified by:
preparePaintingin classNativeTextPainter
-
saveGraphicsState
protected void saveGraphicsState()
- Specified by:
saveGraphicsStatein classNativeTextPainter
-
restoreGraphicsState
protected void restoreGraphicsState()
- Specified by:
restoreGraphicsStatein classNativeTextPainter
-
setInitialTransform
protected void setInitialTransform(java.awt.geom.AffineTransform transform)
- Specified by:
setInitialTransformin classNativeTextPainter
-
createTextUtil
private void createTextUtil()
-
clip
protected void clip(java.awt.Shape clip)
- Specified by:
clipin classNativeTextPainter
-
writeGlyphs
protected void writeGlyphs(FOPGVTGlyphVector gv, java.awt.geom.GeneralPath debugShapes) throws java.io.IOException
- Overrides:
writeGlyphsin classNativeTextPainter- Throws:
java.io.IOException
-
beginTextObject
protected void beginTextObject()
- Specified by:
beginTextObjectin classNativeTextPainter
-
endTextObject
protected void endTextObject()
- Specified by:
endTextObjectin classNativeTextPainter
-
applyColorAndPaint
private void applyColorAndPaint(org.apache.batik.gvt.text.TextPaintInfo tpi)
-
positionGlyph
protected void positionGlyph(java.awt.geom.Point2D prevPos, java.awt.geom.Point2D glyphPos, boolean reposition)- Specified by:
positionGlyphin classNativeTextPainter
-
writeGlyph
protected void writeGlyph(char glyph, java.awt.geom.AffineTransform transform)- Specified by:
writeGlyphin classNativeTextPainter
-
-