org.apache.fop.svg
Class PDFTextPainter
java.lang.Object
org.apache.fop.svg.PDFTextPainter
- TextPainter
public class PDFTextPainter
extends java.lang.Object
implements TextPainter
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.
(todo) handle underline, overline and strikethrough
(todo) use drawString(AttributedCharacterIterator iterator...) for some
$Id: PDFTextPainter.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.
|
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.
|
void | paint(TextNode node, Graphics2D g2d) - Paints the specified attributed character iterator using the
specified Graphics2D and context and font context.
|
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.
PDFTextPainter
public PDFTextPainter(FontInfo fi)
Create a new PDF text painter with the given font information.
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
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
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.