Class WTextItem

java.lang.Object
eu.webtoolkit.jwt.WTextItem

public class WTextItem
extends java.lang.Object
The result of a font metrics computation.

See Also:
WPaintDevice.measureText(CharSequence text, double maxWidth, boolean wordWrap)
  • Constructor Summary

    Constructors
    Constructor Description
    WTextItem​(java.lang.CharSequence text, double width)
    Constructor.
    WTextItem​(java.lang.CharSequence text, double width, double nextWidth)
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    double getNextWidth()
    Returns the width for a next line-break boundary.
    WString getText()
    Returns the measured text.
    double getWidth()
    Returns the measured width.

    Methods inherited from class java.lang.Object

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

    • WTextItem

      public WTextItem​(java.lang.CharSequence text, double width, double nextWidth)
      Constructor.
    • WTextItem

      public WTextItem​(java.lang.CharSequence text, double width)
      Constructor.

      Calls this(text, width, - 1)

  • Method Details

    • getText

      public WString getText()
      Returns the measured text.

      If the item was measured with word breaking enabled, then the text may contain trailing whitespace that is not included in the getWidth().

    • getWidth

      public double getWidth()
      Returns the measured width.

      Returns the text width, in device local coordinates (pixels).

    • getNextWidth

      public double getNextWidth()
      Returns the width for a next line-break boundary.

      Returns the width until the next line-break boundary, or -1 if the underlying word boundary analysis does not support this.