public class StrokingTextPainter extends BasicTextPainter
TextNode
.
StrokingTextPainter includes support for stroke, fill, opacity,
text-decoration, and other attributes.TextPainter
,
GVTAttributedCharacterIterator
Modifier and Type | Class and Description |
---|---|
static class |
StrokingTextPainter.TextChunk |
static class |
StrokingTextPainter.TextRun
Inner convenience class for associating a TextLayout for
sub-spans, and the ACI which iterates over that subspan.
|
BasicTextPainter.BasicMark
Modifier and Type | Field and Description |
---|---|
static java.lang.Integer |
ADJUST_ALL |
static java.lang.Integer |
ADJUST_SPACING |
static GVTAttributedCharacterIterator.TextAttribute |
ALT_GLYPH_HANDLER |
static java.text.AttributedCharacterIterator.Attribute |
ANCHOR_TYPE |
static java.text.AttributedCharacterIterator.Attribute |
BIDI_LEVEL |
static java.text.AttributedCharacterIterator.Attribute |
FLOW_PARAGRAPH |
static java.text.AttributedCharacterIterator.Attribute |
FLOW_REGIONS |
static java.text.AttributedCharacterIterator.Attribute |
GVT_FONT |
static java.text.AttributedCharacterIterator.Attribute |
GVT_FONTS |
static java.text.AttributedCharacterIterator.Attribute |
PAINT_INFO |
protected static TextPainter |
singleton
A unique instance of this class.
|
static java.text.AttributedCharacterIterator.Attribute |
TEXT_COMPOUND_ID |
static java.text.AttributedCharacterIterator.Attribute |
TEXTPATH |
static java.text.AttributedCharacterIterator.Attribute |
WRITING_MODE |
static java.lang.Integer |
WRITING_MODE_RTL |
static java.lang.Integer |
WRITING_MODE_TTB |
static java.text.AttributedCharacterIterator.Attribute |
XPOS |
static java.text.AttributedCharacterIterator.Attribute |
YPOS |
aaOffFontRenderContext, fontRenderContext
Constructor and Description |
---|
StrokingTextPainter() |
Modifier and Type | Method and Description |
---|---|
protected java.awt.geom.Point2D |
adjustChunkOffsets(java.awt.geom.Point2D location,
java.util.List textRuns,
StrokingTextPainter.TextChunk chunk)
Adjusts the position of the text runs within the specified text chunk
to account for any text anchor properties.
|
java.util.List |
computeTextRuns(TextNode node,
java.text.AttributedCharacterIterator aci,
java.text.AttributedCharacterIterator[] chunkACIs) |
protected java.util.List |
computeTextRuns(TextNode node,
java.text.AttributedCharacterIterator aci,
java.text.AttributedCharacterIterator[] chunkACIs,
int[][] chunkCharMaps) |
protected java.text.AttributedCharacterIterator |
createModifiedACIForFontMatching(java.text.AttributedCharacterIterator aci)
Returns a new AttributedCharacterIterator that contains resolved GVTFont
attributes.
|
java.awt.geom.Rectangle2D |
getBounds2D(TextNode node)
Get a Rectangle2D in userspace coords which encloses the textnode
glyphs including stroke etc.
|
protected java.awt.Shape |
getDecorationOutline(java.util.List textRuns,
int decorationType)
Returns the outline of the specified decoration type.
|
protected java.awt.Shape |
getDecorationStrokeOutline(java.util.List textRuns,
int decorationType)
Returns the stroked outline of the specified decoration type.
|
protected FontFamilyResolver |
getFontFamilyResolver() |
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.
|
protected StrokingTextPainter.TextChunk |
getTextChunk(TextNode node,
java.text.AttributedCharacterIterator aci,
int[] charMap,
java.util.List textRuns,
StrokingTextPainter.TextChunk prevChunk) |
protected java.text.AttributedCharacterIterator[] |
getTextChunkACIs(java.text.AttributedCharacterIterator aci)
Returns an array of ACIs, one for each text chunk within the given
text node.
|
protected java.util.Set |
getTextRunBoundaryAttributes() |
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.
|
protected void |
paintDecorations(java.util.List textRuns,
java.awt.Graphics2D g2d,
int decorationType)
Paints decorations of the specified type.
|
protected void |
paintTextRuns(java.util.List textRuns,
java.awt.Graphics2D g2d)
Paints the text in each text run.
|
protected void |
printAttrs(java.text.AttributedCharacterIterator aci) |
protected java.util.List |
reorderTextRuns(StrokingTextPainter.TextChunk chunk,
java.util.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.
|
getGeometryBounds, getTextLayoutFactory, selectAt, selectTo
public static final java.text.AttributedCharacterIterator.Attribute PAINT_INFO
public static final java.text.AttributedCharacterIterator.Attribute FLOW_REGIONS
public static final java.text.AttributedCharacterIterator.Attribute FLOW_PARAGRAPH
public static final java.text.AttributedCharacterIterator.Attribute TEXT_COMPOUND_ID
public static final java.text.AttributedCharacterIterator.Attribute GVT_FONT
public static final java.text.AttributedCharacterIterator.Attribute GVT_FONTS
public static final java.text.AttributedCharacterIterator.Attribute BIDI_LEVEL
public static final java.text.AttributedCharacterIterator.Attribute XPOS
public static final java.text.AttributedCharacterIterator.Attribute YPOS
public static final java.text.AttributedCharacterIterator.Attribute TEXTPATH
public static final java.text.AttributedCharacterIterator.Attribute WRITING_MODE
public static final java.lang.Integer WRITING_MODE_TTB
public static final java.lang.Integer WRITING_MODE_RTL
public static final java.text.AttributedCharacterIterator.Attribute ANCHOR_TYPE
public static final java.lang.Integer ADJUST_SPACING
public static final java.lang.Integer ADJUST_ALL
public static final GVTAttributedCharacterIterator.TextAttribute ALT_GLYPH_HANDLER
protected static TextPainter singleton
public static TextPainter getInstance()
public void paint(TextNode node, java.awt.Graphics2D g2d)
node
- the text node to paintg2d
- the Graphics2D to useprotected void printAttrs(java.text.AttributedCharacterIterator aci)
public java.util.List getTextRuns(TextNode node, java.text.AttributedCharacterIterator aci)
public java.util.List computeTextRuns(TextNode node, java.text.AttributedCharacterIterator aci, java.text.AttributedCharacterIterator[] chunkACIs)
protected java.util.List computeTextRuns(TextNode node, java.text.AttributedCharacterIterator aci, java.text.AttributedCharacterIterator[] chunkACIs, int[][] chunkCharMaps)
protected java.util.List reorderTextRuns(StrokingTextPainter.TextChunk chunk, java.util.List runs)
runs
- - unordered runsprotected java.text.AttributedCharacterIterator[] getTextChunkACIs(java.text.AttributedCharacterIterator aci)
protected java.text.AttributedCharacterIterator createModifiedACIForFontMatching(java.text.AttributedCharacterIterator aci)
aci
- The aci to be modified should already be split into
text chunks.protected FontFamilyResolver getFontFamilyResolver()
protected java.util.Set getTextRunBoundaryAttributes()
protected StrokingTextPainter.TextChunk getTextChunk(TextNode node, java.text.AttributedCharacterIterator aci, int[] charMap, java.util.List textRuns, StrokingTextPainter.TextChunk prevChunk)
protected java.awt.geom.Point2D adjustChunkOffsets(java.awt.geom.Point2D location, java.util.List textRuns, StrokingTextPainter.TextChunk chunk)
protected void paintDecorations(java.util.List textRuns, java.awt.Graphics2D g2d, int decorationType)
protected void paintTextRuns(java.util.List textRuns, java.awt.Graphics2D g2d)
public java.awt.Shape getOutline(TextNode node)
node
- the TextNode to measurepublic java.awt.geom.Rectangle2D getBounds2D(TextNode node)
node
- the TextNode to measureprotected java.awt.Shape getDecorationOutline(java.util.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 java.awt.Shape getDecorationStrokeOutline(java.util.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 int[] getSelected(Mark startMark, Mark finishMark)
public java.awt.Shape getHighlightShape(Mark beginMark, Mark endMark)
Copyright © 2022 Apache Software Foundation. All Rights Reserved.