|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.batik.bridge.BasicTextPainter
org.apache.batik.bridge.StrokingTextPainter
public class StrokingTextPainter
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.
TextPainter
,
GVTAttributedCharacterIterator
Nested Class Summary | |
---|---|
class |
StrokingTextPainter.TextChunk
|
class |
StrokingTextPainter.TextRun
Inner convenience class for associating a TextLayout for sub-spans, and the ACI which iterates over that subspan. |
Nested classes/interfaces inherited from class org.apache.batik.bridge.BasicTextPainter |
---|
BasicTextPainter.BasicMark |
Field Summary | |
---|---|
static Integer |
ADJUST_ALL
|
static Integer |
ADJUST_SPACING
|
static GVTAttributedCharacterIterator.TextAttribute |
ALT_GLYPH_HANDLER
|
static AttributedCharacterIterator.Attribute |
ANCHOR_TYPE
|
static AttributedCharacterIterator.Attribute |
BIDI_LEVEL
|
static AttributedCharacterIterator.Attribute |
FLOW_PARAGRAPH
|
static AttributedCharacterIterator.Attribute |
FLOW_REGIONS
|
static AttributedCharacterIterator.Attribute |
GVT_FONT
|
static AttributedCharacterIterator.Attribute |
GVT_FONTS
|
static AttributedCharacterIterator.Attribute |
PAINT_INFO
|
protected static TextPainter |
singleton
A unique instance of this class. |
static AttributedCharacterIterator.Attribute |
TEXT_COMPOUND_ID
|
static AttributedCharacterIterator.Attribute |
TEXTPATH
|
static AttributedCharacterIterator.Attribute |
WRITING_MODE
|
static Integer |
WRITING_MODE_RTL
|
static Integer |
WRITING_MODE_TTB
|
static AttributedCharacterIterator.Attribute |
XPOS
|
static AttributedCharacterIterator.Attribute |
YPOS
|
Fields inherited from class org.apache.batik.bridge.BasicTextPainter |
---|
aaOffFontRenderContext, fontRenderContext |
Constructor Summary | |
---|---|
StrokingTextPainter()
|
Method Summary | |
---|---|
protected Point2D |
adjustChunkOffsets(Point2D location,
List textRuns,
StrokingTextPainter.TextChunk chunk)
Adjusts the position of the text runs within the specified text chunk to account for any text anchor properties. |
List |
computeTextRuns(TextNode node,
AttributedCharacterIterator aci,
AttributedCharacterIterator[] chunkACIs)
|
protected List |
computeTextRuns(TextNode node,
AttributedCharacterIterator aci,
AttributedCharacterIterator[] chunkACIs,
int[][] chunkCharMaps)
|
protected AttributedCharacterIterator |
createModifiedACIForFontMatching(AttributedCharacterIterator aci)
Returns a new AttributedCharacterIterator that contains resolved GVTFont attributes. |
Rectangle2D |
getBounds2D(TextNode node)
Get a Rectangle2D in userspace coords which encloses the textnode glyphs including stroke etc. |
protected Shape |
getDecorationOutline(List textRuns,
int decorationType)
Returns the outline of the specified decoration type. |
protected Shape |
getDecorationStrokeOutline(List textRuns,
int decorationType)
Returns the stroked outline of the specified decoration type. |
protected FontFamilyResolver |
getFontFamilyResolver()
|
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. |
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. |
protected StrokingTextPainter.TextChunk |
getTextChunk(TextNode node,
AttributedCharacterIterator aci,
int[] charMap,
List textRuns,
StrokingTextPainter.TextChunk prevChunk)
|
protected AttributedCharacterIterator[] |
getTextChunkACIs(AttributedCharacterIterator aci)
Returns an array of ACIs, one for each text chunk within the given text node. |
protected Set |
getTextRunBoundaryAttributes()
|
List |
getTextRuns(TextNode node,
AttributedCharacterIterator aci)
|
protected Mark |
hitTest(double x,
double y,
TextNode node)
Returns the mark for the specified parameters. |
void |
paint(TextNode node,
Graphics2D g2d)
Paints the specified text node using the specified Graphics2D. |
protected void |
paintDecorations(List textRuns,
Graphics2D g2d,
int decorationType)
Paints decorations of the specified type. |
protected void |
paintTextRuns(List textRuns,
Graphics2D g2d)
Paints the text in each text run. |
protected void |
printAttrs(AttributedCharacterIterator aci)
|
protected List |
reorderTextRuns(StrokingTextPainter.TextChunk chunk,
List runs)
Reorder text runs as required by bidi algorithm. |
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.bridge.BasicTextPainter |
---|
getGeometryBounds, getTextLayoutFactory, selectAt, selectTo |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final AttributedCharacterIterator.Attribute PAINT_INFO
public static final AttributedCharacterIterator.Attribute FLOW_REGIONS
public static final AttributedCharacterIterator.Attribute FLOW_PARAGRAPH
public static final AttributedCharacterIterator.Attribute TEXT_COMPOUND_ID
public static final AttributedCharacterIterator.Attribute GVT_FONT
public static final AttributedCharacterIterator.Attribute GVT_FONTS
public static final AttributedCharacterIterator.Attribute BIDI_LEVEL
public static final AttributedCharacterIterator.Attribute XPOS
public static final AttributedCharacterIterator.Attribute YPOS
public static final AttributedCharacterIterator.Attribute TEXTPATH
public static final AttributedCharacterIterator.Attribute WRITING_MODE
public static final Integer WRITING_MODE_TTB
public static final Integer WRITING_MODE_RTL
public static final AttributedCharacterIterator.Attribute ANCHOR_TYPE
public static final Integer ADJUST_SPACING
public static final Integer ADJUST_ALL
public static final GVTAttributedCharacterIterator.TextAttribute ALT_GLYPH_HANDLER
protected static TextPainter singleton
Constructor Detail |
---|
public StrokingTextPainter()
Method Detail |
---|
public static TextPainter getInstance()
public void paint(TextNode node, Graphics2D g2d)
node
- the text node to paintg2d
- the Graphics2D to useprotected void printAttrs(AttributedCharacterIterator aci)
public List getTextRuns(TextNode node, AttributedCharacterIterator aci)
public List computeTextRuns(TextNode node, AttributedCharacterIterator aci, AttributedCharacterIterator[] chunkACIs)
protected List computeTextRuns(TextNode node, AttributedCharacterIterator aci, AttributedCharacterIterator[] chunkACIs, int[][] chunkCharMaps)
protected List reorderTextRuns(StrokingTextPainter.TextChunk chunk, List runs)
runs
- - unordered runs
protected AttributedCharacterIterator[] getTextChunkACIs(AttributedCharacterIterator aci)
protected AttributedCharacterIterator createModifiedACIForFontMatching(AttributedCharacterIterator aci)
aci
- The aci to be modified should already be split into
text chunks.
protected FontFamilyResolver getFontFamilyResolver()
protected Set getTextRunBoundaryAttributes()
protected StrokingTextPainter.TextChunk getTextChunk(TextNode node, AttributedCharacterIterator aci, int[] charMap, List textRuns, StrokingTextPainter.TextChunk prevChunk)
protected Point2D adjustChunkOffsets(Point2D location, List textRuns, StrokingTextPainter.TextChunk chunk)
protected void paintDecorations(List textRuns, Graphics2D g2d, int decorationType)
protected void paintTextRuns(List textRuns, Graphics2D g2d)
public Shape getOutline(TextNode node)
node
- the TextNode to measurepublic Rectangle2D getBounds2D(TextNode node)
node
- the TextNode to measureprotected Shape getDecorationOutline(List textRuns, int decorationType)
textRuns
- The list of text runs to get the decoration outline for.decorationType
- Indicates the type of decoration required.
eg. underline, overline or strikethrough.
protected Shape getDecorationStrokeOutline(List textRuns, int decorationType)
textRuns
- The list of text runs to get the decoration outline for.decorationType
- Indicates the type of decoration required.
eg. underline, overline or strikethrough.
public Mark getMark(TextNode node, int index, boolean leadingEdge)
TextPainter
protected Mark hitTest(double x, double y, TextNode node)
BasicTextPainter
hitTest
in class BasicTextPainter
public Mark selectFirst(TextNode node)
public Mark selectLast(TextNode node)
public int[] getSelected(Mark startMark, Mark finishMark)
public Shape getHighlightShape(Mark beginMark, Mark endMark)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |