public class TextPath
extends java.lang.Object
Class that represents baseline of a string and allows the baseline to
be composed as contiguous segments with distinct slope each.
Once a TextPath is created for a string it is possible to know where
the character at a determined position in the string is placed and
rotated.
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_WORD_SPACING
Don't set a concrete word spacing.
|
static int |
NO_POS |
| Constructor and Description |
|---|
TextPath(java.awt.Graphics2D g,
Geometry path,
char[] text,
java.awt.Font font,
float characterSpacing,
float characterWidth,
boolean kerning,
float leading,
int alignment,
float wordSpacing,
float margin,
boolean rightToLeft)
Creates a new instance of TextPath with the current graphics
context.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getGlyphCount() |
protected static boolean |
isWordSeparator(char c,
char[] wordSeparators) |
double[] |
nextPosForGlyph(int glyphIndex)
Returns the placement of the next character to draw and the corresponding
rotation in a double array of three elements with this order:
double[0] Position in X in the screen double[1] Position in Y in the screen double[2] Angle of the character. |
protected Geometry |
softenShape(Geometry shape,
java.awt.font.GlyphVector gv) |
public static final int NO_POS
public static final int DEFAULT_WORD_SPACING
public TextPath(java.awt.Graphics2D g,
Geometry path,
char[] text,
java.awt.Font font,
float characterSpacing,
float characterWidth,
boolean kerning,
float leading,
int alignment,
float wordSpacing,
float margin,
boolean rightToLeft)
Creates a new instance of TextPath with the current graphics
context.
Given a Graphics2D, TextPath can know which Font and FontRenderContext is in use. So, it can calculate the position and rotation of each character in char[] text based in the path defined by the FShape path argument.
g, - Graphics2Dpath, - FShapetext, - char[]protected Geometry softenShape(Geometry shape, java.awt.font.GlyphVector gv) throws CreateGeometryException
CreateGeometryExceptionpublic double[] nextPosForGlyph(int glyphIndex)
Returns the placement of the next character to draw and the corresponding rotation in a double array of three elements with this order:
double[0] Position in X in the screen
double[1] Position in Y in the screen
double[2] Angle of the character.
public int getGlyphCount()
protected static boolean isWordSeparator(char c,
char[] wordSeparators)