Class StringMetrics

java.lang.Object
org.jjazz.uiutilities.api.StringMetrics

public class StringMetrics extends Object
Compute string metrics.

Try to cache data whenever possible.

  • Constructor Details

  • Method Details

    • getLogicalBounds

      public Rectangle2D getLogicalBounds(String text)
      Return a rectangle in baseline relative coordinates, include the leading (interline spacing).

      If this method is called several times with the same text, the cached result is returned.

      Parameters:
      text -
      Returns:
    • getLogicalBoundsNoLeading

      public Rectangle2D getLogicalBoundsNoLeading(String text)
      Return a rectangle in baseline relative coordinates, excluding the leading (interline spacing).

      If this method is called several times with the same text, the cached result is returned.

      Parameters:
      text -
      Returns:
    • getLogicalBoundsNoLeadingNoDescent

      public Rectangle2D getLogicalBoundsNoLeadingNoDescent(String text)
      Return a rectangle in baseline relative coordinates, excluding the descent and the leading (interline spacing).

      See LineMetrics or FontMetrics for more info about descent/leading.

      If this method is called several times with the same text, the cached result is returned.

      Parameters:
      text -
      Returns:
    • getWidth

      public double getWidth(String text)
    • getHeight

      public double getHeight(String text)
      get the height of this text, including the leading (interline space).
      Parameters:
      text -
      Returns:
    • getHeightNoLeading

      public double getHeightNoLeading(String text)
      Get the height of this text, excluding the leading (interline space).
      Parameters:
      text -
      Returns: