Class TextPath
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDon't set a concrete word spacing.static final int -
Constructor Summary
ConstructorsConstructorDescriptionTextPath(Graphics2D g, org.gvsig.fmap.geom.Geometry path, char[] text, 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. -
Method Summary
Modifier and TypeMethodDescriptionintprotected static booleanisWordSeparator(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:protected org.gvsig.fmap.geom.GeometrysoftenShape(org.gvsig.fmap.geom.Geometry shape, GlyphVector gv)
-
Field Details
-
NO_POS
public static final int NO_POS- See Also:
-
DEFAULT_WORD_SPACING
public static final int DEFAULT_WORD_SPACINGDon't set a concrete word spacing. The word is separated using the normal width of the separator glyph.- See Also:
-
-
Constructor Details
-
TextPath
public TextPath(Graphics2D g, org.gvsig.fmap.geom.Geometry path, char[] text, 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.
- Parameters:
g- , Graphics2Dpath- , FShapetext- , char[]
-
-
Method Details
-
softenShape
protected org.gvsig.fmap.geom.Geometry softenShape(org.gvsig.fmap.geom.Geometry shape, GlyphVector gv) throws org.gvsig.fmap.geom.exception.CreateGeometryException - Throws:
org.gvsig.fmap.geom.exception.CreateGeometryException
-
nextPosForGlyph
public 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.
- Returns:
-
getGlyphCount
public int getGlyphCount() -
isWordSeparator
protected static boolean isWordSeparator(char c, char[] wordSeparators)
-