java.lang.Object
org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.TextPath

public class TextPath extends 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.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Don't set a concrete word spacing.
    static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    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.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    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:
    protected org.gvsig.fmap.geom.Geometry
    softenShape(org.gvsig.fmap.geom.Geometry shape, GlyphVector gv)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NO_POS

      public static final int NO_POS
      See Also:
    • DEFAULT_WORD_SPACING

      public static final int DEFAULT_WORD_SPACING
      Don'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 - , Graphics2D
      path - , FShape
      text - , 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)