public abstract class AbstractFOPTextPainter
extends java.lang.Object
implements org.apache.batik.gvt.TextPainter
TextNode
.
This class draws the text directly into the Graphics2D so that
the text is not drawn using shapes.
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.Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.logging.Log |
log
the logger for this class
|
protected static org.apache.batik.gvt.TextPainter |
PROXY_PAINTER
Use the stroking text painter to get the bounds and shape.
|
Constructor and Description |
---|
AbstractFOPTextPainter(FOPTextHandler nativeTextHandler)
Create a new PS text painter with the given font information.
|
Modifier and Type | Method and Description |
---|---|
java.awt.geom.Rectangle2D |
getBounds2D(org.apache.batik.gvt.TextNode node)
Get the bounds.
|
java.awt.geom.Rectangle2D |
getGeometryBounds(org.apache.batik.gvt.TextNode node)
Get the geometry bounds.
|
java.awt.Shape |
getHighlightShape(org.apache.batik.gvt.text.Mark beginMark,
org.apache.batik.gvt.text.Mark endMark)
Get the highlighted shape.
|
org.apache.batik.gvt.text.Mark |
getMark(org.apache.batik.gvt.TextNode node,
int pos,
boolean all)
Get the mark.
|
java.awt.Shape |
getOutline(org.apache.batik.gvt.TextNode node)
Get the outline shape of the text characters.
|
int[] |
getSelected(org.apache.batik.gvt.text.Mark start,
org.apache.batik.gvt.text.Mark finish)
Get selected.
|
protected java.lang.String |
getText(java.text.AttributedCharacterIterator aci)
Extract the raw text from an ACI.
|
protected abstract boolean |
isSupportedGraphics2D(java.awt.Graphics2D g2d)
Checks whether the Graphics2D is compatible with this text painter.
|
void |
paint(org.apache.batik.gvt.TextNode node,
java.awt.Graphics2D g2d)
Paints the specified attributed character iterator using the
specified Graphics2D and context and font context.
|
protected java.awt.geom.Point2D |
paintTextRun(org.apache.batik.gvt.renderer.StrokingTextPainter.TextRun run,
java.awt.Graphics2D g2d,
java.awt.geom.Point2D loc)
Paint a single text run on the Graphics2D at a given location.
|
protected void |
paintTextRuns(java.util.List textRuns,
java.awt.Graphics2D g2d,
java.awt.geom.Point2D loc)
Paint a list of text runs on the Graphics2D at a given location.
|
org.apache.batik.gvt.text.Mark |
selectAt(double x,
double y,
org.apache.batik.gvt.TextNode node)
Select at.
|
org.apache.batik.gvt.text.Mark |
selectFirst(org.apache.batik.gvt.TextNode node)
Selec first.
|
org.apache.batik.gvt.text.Mark |
selectLast(org.apache.batik.gvt.TextNode node)
Select last.
|
org.apache.batik.gvt.text.Mark |
selectTo(double x,
double y,
org.apache.batik.gvt.text.Mark beginMark)
Select to.
|
protected org.apache.commons.logging.Log log
protected static final org.apache.batik.gvt.TextPainter PROXY_PAINTER
public AbstractFOPTextPainter(FOPTextHandler nativeTextHandler)
nativeTextHandler
- the NativeTextHandler instance used for text paintingpublic void paint(org.apache.batik.gvt.TextNode node, java.awt.Graphics2D g2d)
paint
in interface org.apache.batik.gvt.TextPainter
node
- the TextNode to paintg2d
- the Graphics2D to useprotected abstract boolean isSupportedGraphics2D(java.awt.Graphics2D g2d)
g2d
- the Graphics2D instance to checkprotected void paintTextRuns(java.util.List textRuns, java.awt.Graphics2D g2d, java.awt.geom.Point2D loc)
textRuns
- the list of text runsg2d
- the Graphics2D to paint toloc
- the current location of the "cursor"protected java.awt.geom.Point2D paintTextRun(org.apache.batik.gvt.renderer.StrokingTextPainter.TextRun run, java.awt.Graphics2D g2d, java.awt.geom.Point2D loc)
run
- the text run to paintg2d
- the Graphics2D to paint toloc
- the current location of the "cursor"protected java.lang.String getText(java.text.AttributedCharacterIterator aci)
aci
- ACI to inspectpublic java.awt.Shape getOutline(org.apache.batik.gvt.TextNode node)
getOutline
in interface org.apache.batik.gvt.TextPainter
node
- the text nodepublic java.awt.geom.Rectangle2D getBounds2D(org.apache.batik.gvt.TextNode node)
getBounds2D
in interface org.apache.batik.gvt.TextPainter
node
- the text nodepublic java.awt.geom.Rectangle2D getGeometryBounds(org.apache.batik.gvt.TextNode node)
getGeometryBounds
in interface org.apache.batik.gvt.TextPainter
node
- the text nodepublic org.apache.batik.gvt.text.Mark getMark(org.apache.batik.gvt.TextNode node, int pos, boolean all)
getMark
in interface org.apache.batik.gvt.TextPainter
node
- the text nodepos
- the positionall
- select allpublic org.apache.batik.gvt.text.Mark selectAt(double x, double y, org.apache.batik.gvt.TextNode node)
selectAt
in interface org.apache.batik.gvt.TextPainter
x
- the x positiony
- the y positionnode
- the text nodepublic org.apache.batik.gvt.text.Mark selectTo(double x, double y, org.apache.batik.gvt.text.Mark beginMark)
selectTo
in interface org.apache.batik.gvt.TextPainter
x
- the x positiony
- the y positionbeginMark
- the start markpublic org.apache.batik.gvt.text.Mark selectFirst(org.apache.batik.gvt.TextNode node)
selectFirst
in interface org.apache.batik.gvt.TextPainter
node
- the text nodepublic org.apache.batik.gvt.text.Mark selectLast(org.apache.batik.gvt.TextNode node)
selectLast
in interface org.apache.batik.gvt.TextPainter
node
- the text nodepublic int[] getSelected(org.apache.batik.gvt.text.Mark start, org.apache.batik.gvt.text.Mark finish)
getSelected
in interface org.apache.batik.gvt.TextPainter
start
- the start markfinish
- the finish markpublic java.awt.Shape getHighlightShape(org.apache.batik.gvt.text.Mark beginMark, org.apache.batik.gvt.text.Mark endMark)
getHighlightShape
in interface org.apache.batik.gvt.TextPainter
beginMark
- the start markendMark
- the end markCopyright 1999-2012 The Apache Software Foundation. All Rights Reserved.