org.apache.fop.render.ps
Class PSTextPainter
java.lang.Object
org.apache.fop.render.ps.PSTextPainter
- TextPainter
public class PSTextPainter
extends java.lang.Object
implements TextPainter
Renders the attributed character iterator of a TextNode.
This class draws the text directly into the PSGraphics2D so that
the text is not drawn using shapes which makes the PS 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.
(todo) handle underline, overline and strikethrough
(todo) use drawString(AttributedCharacterIterator iterator...) for some
$Id: PSTextPainter.java 542237 2007-05-28 14:31:24Z jeremias $protected static TextPainter | PROXY_PAINTER - Use the stroking text painter to get the bounds and shape.
|
protected Log | log - the logger for this class
|
Rectangle2D | getBounds2D(TextNode node) - Get the bounds.
|
Rectangle2D | getGeometryBounds(TextNode node) - Get the geometry bounds.
|
Shape | getHighlightShape(Mark beginMark, Mark endMark) - Get the highlighted shape.
|
Mark | getMark(TextNode node, int pos, boolean all) - Get the mark.
|
Shape | getOutline(TextNode node) - Get the outline shape of the text characters.
|
int[] | getSelected(Mark start, Mark finish) - Get selected.
|
protected String | getText(AttributedCharacterIterator aci) - Extract the raw text from an ACI.
|
void | paint(TextNode node, Graphics2D g2d) - Paints the specified attributed character iterator using the
specified Graphics2D and context and font context.
|
protected Point2D | paintACI(AttributedCharacterIterator aci, Graphics2D g2d, Point2D loc) - Paint an ACI on a Graphics2D at a given location.
|
protected Point2D | paintTextRun(StrokingTextPainter.TextRun run, Graphics2D g2d, Point2D loc) - Paint a single text run on the Graphics2D at a given location.
|
protected void | paintTextRuns(List textRuns, Graphics2D g2d, Point2D loc) - Paint a list of text runs on the Graphics2D at a given location.
|
Mark | selectAt(double x, double y, TextNode node) - Select at.
|
Mark | selectFirst(TextNode node) - Selec first.
|
Mark | selectLast(TextNode node) - Select last.
|
Mark | selectTo(double x, double y, Mark beginMark) - Select to.
|
PROXY_PAINTER
protected static final TextPainter PROXY_PAINTER
Use the stroking text painter to get the bounds and shape.
Also used as a fallback to draw the string with strokes.
log
protected Log log
the logger for this class
PSTextPainter
public PSTextPainter(NativeTextHandler nativeTextHandler)
Create a new PS text painter with the given font information.
nativeTextHandler
- the NativeTextHandler instance used for text painting
getBounds2D
public Rectangle2D getBounds2D(TextNode node)
Get the bounds.
This uses the StrokingTextPainter to get the bounds
since in theory it should be the same.
getGeometryBounds
public Rectangle2D getGeometryBounds(TextNode node)
Get the geometry bounds.
This uses the StrokingTextPainter to get the bounds
since in theory it should be the same.
getHighlightShape
public Shape getHighlightShape(Mark beginMark,
Mark endMark)
Get the highlighted shape.
This does nothing since the output is pdf and not interactive.
beginMark
- the start markendMark
- the end mark
getMark
public Mark getMark(TextNode node,
int pos,
boolean all)
Get the mark.
This does nothing since the output is pdf and not interactive.
node
- the text nodepos
- the positionall
- select all
getOutline
public Shape getOutline(TextNode node)
Get the outline shape of the text characters.
This uses the StrokingTextPainter to get the outline
shape since in theory it should be the same.
- the outline shape of the text characters
getSelected
public int[] getSelected(Mark start,
Mark finish)
Get selected.
This does nothing since the output is pdf and not interactive.
start
- the start markfinish
- the finish mark
getText
protected String getText(AttributedCharacterIterator aci)
Extract the raw text from an ACI.
paint
public void paint(TextNode node,
Graphics2D g2d)
Paints the specified attributed character iterator using the
specified Graphics2D and context and font context.
node
- the TextNode to paintg2d
- the Graphics2D to use
paintACI
protected Point2D paintACI(AttributedCharacterIterator aci,
Graphics2D g2d,
Point2D loc)
Paint an ACI on a Graphics2D at a given location. The method has to
update the location after painting.
aci
- ACI to paintg2d
- Graphics2D to paint onloc
- start location
paintTextRun
protected Point2D paintTextRun(StrokingTextPainter.TextRun run,
Graphics2D g2d,
Point2D loc)
Paint a single text run on the Graphics2D at a given location.
run
- the text run to paintg2d
- the Graphics2D to paint toloc
- the current location of the "cursor"
- the new location of the "cursor" after painting the text run
paintTextRuns
protected void paintTextRuns(List textRuns,
Graphics2D g2d,
Point2D loc)
Paint a list of text runs on the Graphics2D at a given location.
textRuns
- the list of text runsg2d
- the Graphics2D to paint toloc
- the current location of the "cursor"
selectAt
public Mark selectAt(double x,
double y,
TextNode node)
Select at.
This does nothing since the output is pdf and not interactive.
x
- the x positiony
- the y positionnode
- the text node
selectFirst
public Mark selectFirst(TextNode node)
Selec first.
This does nothing since the output is pdf and not interactive.
selectLast
public Mark selectLast(TextNode node)
Select last.
This does nothing since the output is pdf and not interactive.
selectTo
public Mark selectTo(double x,
double y,
Mark beginMark)
Select to.
This does nothing since the output is pdf and not interactive.
x
- the x positiony
- the y positionbeginMark
- the start mark
Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.