private List<TextSubLine> splitGlyphTextIntoLines(String textLine, float boxWidth, Font font, float fontScale, float tracking,
      boolean usingGlyphs) {
    int lineCount = 0;

    float currentLineWidth = 0;
    int currentLineStartIndex = 0;

    int currentWordStartIndex = 0;
    float currentWordWidth = 0f;
    boolean nextCharacterStartsWord = false;

    // The measured size of a space.
    float spaceWidth = 0f;

    for (int i = 0; i < textLine.length(); i++) {
      char c = textLine.charAt(i);
      float currentCharWidth;
      if (usingGlyphs) {
        int characterHash = FontCharacter.hashFor(c, font.getFamily(), font.getStyle());
        FontCharacter character = composition.getCharacters().get(characterHash);
        if (character == null) {
          continue;
        }
        currentCharWidth = (float) character.getWidth() * fontScale * Utils.dpScale() + tracking;
      } else {
        currentCharWidth = fillPaint.measureText(textLine.substring(i, i + 1)) + tracking;
      }

      if (c == ' ') {
        spaceWidth = currentCharWidth;
        nextCharacterStartsWord = true;
      } else if (nextCharacterStartsWord) {
        nextCharacterStartsWord = false;
        currentWordStartIndex = i;
        currentWordWidth = currentCharWidth;
      } else {
        currentWordWidth += currentCharWidth;
      }
      currentLineWidth += currentCharWidth;

      if (boxWidth > 0f && currentLineWidth >= boxWidth) {
        if (c == ' ') {
          // Spaces at the end of a line don't do anything. Ignore it.
          // The next non-space character will hit the conditions below.
          continue;
        }
        TextSubLine subLine = ensureEnoughSubLines(++lineCount);
        if (currentWordStartIndex == currentLineStartIndex) {
          // Only word on line is wider than box, start wrapping mid-word.
          String substr = textLine.substring(currentLineStartIndex, i);
          String trimmed = substr.trim();
          float trimmedSpace = (trimmed.length() - substr.length()) * spaceWidth;
          subLine.set(trimmed, currentLineWidth - currentCharWidth - trimmedSpace);
          currentLineStartIndex = i;
          currentLineWidth = currentCharWidth;
          currentWordStartIndex = currentLineStartIndex;
          currentWordWidth = currentCharWidth;
        } else {
          String substr = textLine.substring(currentLineStartIndex, currentWordStartIndex - 1);
          String trimmed = substr.trim();
          float trimmedSpace = (substr.length() - trimmed.length()) * spaceWidth;
          subLine.set(trimmed, currentLineWidth - currentWordWidth - trimmedSpace - spaceWidth);
          currentLineStartIndex = currentWordStartIndex;
          currentLineWidth = currentWordWidth;
        }
      }
    }
    if (currentLineWidth > 0f) {
      TextSubLine line = ensureEnoughSubLines(++lineCount);
      line.set(textLine.substring(currentLineStartIndex), currentLineWidth);
    }
    return textSubLines.subList(0, lineCount);
  }
@param characterIndexAtStartOfLine The index within the overall document of the character at the start of the line
@param parentAlpha
lottie/src/main/java/com/airbnb/lottie/model/layer/TextLayer.java