org.apache.batik.gvt.renderer
Class StrokingTextPainter
java.lang.Object
|
+--org.apache.batik.gvt.renderer.BasicTextPainter
|
+--org.apache.batik.gvt.renderer.StrokingTextPainter
- All Implemented Interfaces:
- TextPainter
- public class StrokingTextPainter
- extends BasicTextPainter
More sophisticated implementation of TextPainter which
renders the attributed character iterator of a TextNode.
StrokingTextPainter includes support for stroke, fill, opacity,
text-decoration, and other attributes.
- See Also:
TextPainter
,
GVTAttributedCharacterIterator
Inner Class Summary |
class |
StrokingTextPainter.TextRun
Inner convenience class for associating a TextLayout for
sub-spans, and the ACI which iterates over that subspan. |
Method Summary |
java.awt.geom.Rectangle2D |
getBounds2D(TextNode node)
Get a Rectangle2D in userspace coords which encloses the textnode
glyphs including stroke etc. |
java.awt.Shape |
getHighlightShape(Mark beginMark,
Mark endMark)
Return a Shape, in the coordinate system of the text layout,
which encloses the text selection delineated by two Mark instances. |
static TextPainter |
getInstance()
Returns a unique instance of this class. |
Mark |
getMark(TextNode node,
int index,
boolean leadingEdge)
Returns a mark for the char at index in node's
AttributedCharacterIterator. |
java.awt.Shape |
getOutline(TextNode node)
Get a Shape in userspace coords which defines the textnode glyph outlines. |
int[] |
getSelected(Mark startMark,
Mark finishMark)
Returns an array of ints representing begin/end index pairs into
an AttributedCharacterIterator which represents the text
selection delineated by two Mark instances. |
java.util.List |
getTextRuns(TextNode node,
java.text.AttributedCharacterIterator aci)
|
protected Mark |
hitTest(double x,
double y,
TextNode node)
Returns the mark for the specified parameters. |
void |
paint(TextNode node,
java.awt.Graphics2D g2d)
Paints the specified text node using the specified Graphics2D. |
Mark |
selectFirst(TextNode node)
Selects the first glyph in the text node. |
Mark |
selectLast(TextNode node)
Selects the last glyph in the text node. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FLOW_REGIONS
public static final java.text.AttributedCharacterIterator.Attribute FLOW_REGIONS
FLOW_PARAGRAPH
public static final java.text.AttributedCharacterIterator.Attribute FLOW_PARAGRAPH
TEXT_COMPOUND_DELIMITER
public static final java.text.AttributedCharacterIterator.Attribute TEXT_COMPOUND_DELIMITER
GVT_FONT
public static final java.text.AttributedCharacterIterator.Attribute GVT_FONT
GVT_FONT_FAMILIES
public static final java.text.AttributedCharacterIterator.Attribute GVT_FONT_FAMILIES
BIDI_LEVEL
public static final java.text.AttributedCharacterIterator.Attribute BIDI_LEVEL
XPOS
public static final java.text.AttributedCharacterIterator.Attribute XPOS
YPOS
public static final java.text.AttributedCharacterIterator.Attribute YPOS
TEXTPATH
public static final java.text.AttributedCharacterIterator.Attribute TEXTPATH
ANCHOR_TYPE
public static final java.text.AttributedCharacterIterator.Attribute ANCHOR_TYPE
ADJUST_SPACING
public static final java.lang.Integer ADJUST_SPACING
ADJUST_ALL
public static final java.lang.Integer ADJUST_ALL
ALT_GLYPH_HANDLER
public static final GVTAttributedCharacterIterator.TextAttribute ALT_GLYPH_HANDLER
singleton
protected static TextPainter singleton
- A unique instance of this class.
StrokingTextPainter
public StrokingTextPainter()
getInstance
public static TextPainter getInstance()
- Returns a unique instance of this class.
paint
public void paint(TextNode node,
java.awt.Graphics2D g2d)
- Paints the specified text node using the specified Graphics2D.
- Parameters:
node
- the text node to paintg2d
- the Graphics2D to use
getTextRuns
public java.util.List getTextRuns(TextNode node,
java.text.AttributedCharacterIterator aci)
getOutline
public java.awt.Shape getOutline(TextNode node)
- Get a Shape in userspace coords which defines the textnode glyph outlines.
- Parameters:
node
- the TextNode to measure
getBounds2D
public java.awt.geom.Rectangle2D getBounds2D(TextNode node)
- Get a Rectangle2D in userspace coords which encloses the textnode
glyphs including stroke etc.
- Following copied from interface:
org.apache.batik.gvt.TextPainter
- Parameters:
node
- the TextNode to measure
getMark
public Mark getMark(TextNode node,
int index,
boolean leadingEdge)
- Description copied from interface:
TextPainter
- Returns a mark for the char at index in node's
AttributedCharacterIterator. Leading edge indicates if the
mark should be considered immediately 'before' glyph or
after
hitTest
protected Mark hitTest(double x,
double y,
TextNode node)
- Description copied from class:
BasicTextPainter
- Returns the mark for the specified parameters.
- Overrides:
hitTest
in class BasicTextPainter
selectFirst
public Mark selectFirst(TextNode node)
- Selects the first glyph in the text node.
selectLast
public Mark selectLast(TextNode node)
- Selects the last glyph in the text node.
getSelected
public int[] getSelected(Mark startMark,
Mark finishMark)
- Returns an array of ints representing begin/end index pairs into
an AttributedCharacterIterator which represents the text
selection delineated by two Mark instances.
Note: The Mark instances passed must have been instantiated by
an instance of this enclosing TextPainter implementation.
getHighlightShape
public java.awt.Shape getHighlightShape(Mark beginMark,
Mark endMark)
- Return a Shape, in the coordinate system of the text layout,
which encloses the text selection delineated by two Mark instances.
Note: The Mark instances passed must have been instantiated by
an instance of this enclosing TextPainter implementation.
Copyright © 2002 Apache Software Foundation. All Rights Reserved.