Package snap.text

Class TextBlockUtils

java.lang.Object
snap.text.TextBlockUtils

public class TextBlockUtils extends Object
Utility methods to support TextBlock.
  • Constructor Details

    • TextBlockUtils

      public TextBlockUtils()
  • Method Details

    • getPathForCharRange

      public static Shape getPathForCharRange(TextBlock textBlock, int aStartCharIndex, int aEndCharIndex)
      Returns a path for two char indexes - it will be a simple box with extensions for first/last lines.
    • getUnderlineRuns

      public static TextRun[] getUnderlineRuns(TextBlock textBlock, Rect aRect)
      Returns underlined runs for text box.
    • paintTextBlockUnderlines

      public static void paintTextBlockUnderlines(Painter aPntr, TextBlock textBlock, Rect clipRect)
      Paint TextBox to given painter.
    • createTokensForTextLine

      public static TextToken[] createTokensForTextLine(TextLine aTextLine)
      Returns the tokens.
    • setMouseY

      public static void setMouseY(TextBlock textBlock, double aY)
      Sets the Mouse Y for given text block to assist in caret placement (can be ambiguous for start/end of line).
    • toXML

      public static XMLElement toXML(TextBlock textBlock, XMLArchiver anArchiver)
      XML archival.
    • fromXML

      public static void fromXML(TextBlock textBlock, XMLArchiver anArchiver, XMLElement anElement)
      XML unarchival.