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.
 
Inner classes inherited from class org.apache.batik.gvt.renderer.BasicTextPainter
BasicTextPainter.BasicMark
 
Field Summary
static java.text.AttributedCharacterIterator.Attribute ANCHOR_TYPE
           
static java.text.AttributedCharacterIterator.Attribute BIDI_LEVEL
           
static java.text.AttributedCharacterIterator.Attribute GVT_FONT
           
static java.text.AttributedCharacterIterator.Attribute GVT_FONT_FAMILIES
           
protected static TextPainter singleton
          A unique instance of this class.
static java.text.AttributedCharacterIterator.Attribute TEXT_COMPOUND_DELIMITER
           
static java.text.AttributedCharacterIterator.Attribute TEXTPATH
           
static java.text.AttributedCharacterIterator.Attribute XPOS
           
static java.text.AttributedCharacterIterator.Attribute YPOS
           
 
Fields inherited from class org.apache.batik.gvt.renderer.BasicTextPainter
fontRenderContext
 
Constructor Summary
StrokingTextPainter()
           
 
Method Summary
protected  java.awt.geom.Rectangle2D getBounds(TextNode node, boolean includeDecoration, boolean includeStrokeWidth)
          Get a Rectangle2D in userspace coords which encloses the textnode glyphs composed from an AttributedCharacterIterator.
 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.
protected  java.awt.Shape getOutline(TextNode node, boolean includeDecoration)
          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.
protected  java.awt.Shape getStrokeOutline(TextNode node, boolean includeDecoration)
          Get a Shape in userspace coords which defines the stroked textnode glyph outlines.
 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 org.apache.batik.gvt.renderer.BasicTextPainter
getBounds, getDecoratedBounds, getDecoratedShape, getPaintedBounds, getShape, getTextLayoutFactory, selectAt, selectTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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

singleton

protected static TextPainter singleton
A unique instance of this class.
Constructor Detail

StrokingTextPainter

public StrokingTextPainter()
Method Detail

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 paint
g2d - the Graphics2D to use

getTextRuns

public java.util.List getTextRuns(TextNode node,
                                  java.text.AttributedCharacterIterator aci)

getBounds

protected java.awt.geom.Rectangle2D getBounds(TextNode node,
                                              boolean includeDecoration,
                                              boolean includeStrokeWidth)
Get a Rectangle2D in userspace coords which encloses the textnode glyphs composed from an AttributedCharacterIterator.
Overrides:
getBounds in class BasicTextPainter
Following copied from class: org.apache.batik.gvt.renderer.BasicTextPainter
Parameters:
node - the TextNode to measure
includeDecoration - whether to include text decoration in bounds computation.
includeStrokeWidth - whether to include the effect of stroke width in bounds computation.

getOutline

protected java.awt.Shape getOutline(TextNode node,
                                    boolean includeDecoration)
Get a Shape in userspace coords which defines the textnode glyph outlines.
Overrides:
getOutline in class BasicTextPainter
Parameters:
node - the TextNode to measure
includeDecoration - whether to include text decoration outlines.

getStrokeOutline

protected java.awt.Shape getStrokeOutline(TextNode node,
                                          boolean includeDecoration)
Get a Shape in userspace coords which defines the stroked textnode glyph outlines.
Overrides:
getStrokeOutline in class BasicTextPainter
Parameters:
node - the TextNode to measure
includeDecoration - whether to include text decoration outlines.

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 © 2001 Apache Software Foundation. All Rights Reserved.