Package snap.text

Class TextModelUtils

java.lang.Object
snap.text.TextModelUtils

public class TextModelUtils extends Object
Utility methods to support TextModel.
  • Constructor Details

    • TextModelUtils

      public TextModelUtils()
  • Method Details

    • getPathForCharRange

      public static Shape getPathForCharRange(TextModel textModel, 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(TextModel textModel, Rect aRect)
      Returns underlined runs for text.
    • paintTextModelUnderlines

      public static void paintTextModelUnderlines(Painter aPntr, TextModel textModel, Rect clipRect)
      Paints text underlines with given painter.
    • createTokensForTextLine

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

      public static void setMouseY(TextModel textModel, double aY)
      Sets the Mouse Y for given text model to assist in caret placement (can be ambiguous for start/end of line).
    • smartFindFormatRange

      public static TextSel smartFindFormatRange(TextModel textModel, int selStart, int selEnd)
      This method returns the range of the @-sign delinated key closest to the current selection (or null if not found).
    • toXML

      public static XMLElement toXML(TextModel textModel, XMLArchiver anArchiver)
      XML archival.
    • fromXML

      public static void fromXML(TextModel textModel, XMLArchiver anArchiver, XMLElement anElement)
      XML unarchival.