public static IntList calcBreakOffsets(char[] text, int startOffset, int endOffset, boolean lineStart, double x, double clipX,
                                         WidthProvider widthProvider) {
    IntList breakOffsets = new IntArrayList();
    int nextOffset = startOffset;
    while (true) {
      int prevOffset = nextOffset;
      nextOffset = calcWordBreakOffset(text, nextOffset, endOffset, x, clipX, widthProvider);
      if (nextOffset == prevOffset && lineStart) {
        nextOffset = calcCharBreakOffset(text, nextOffset, endOffset, x, clipX, widthProvider);
        if (nextOffset == prevOffset) {
          nextOffset++; // extremal case when even one character doesn't fit into clip width
        }
      }
      if (nextOffset >= endOffset) {
        break;
      }
      breakOffsets.add(nextOffset);
      lineStart = true;
      x = 0;
    }
    return breakOffsets;
  }
public static IntList calcBreakOffsets(char[] text, int startOffset, int endOffset, boolean lineStart, double x, double clipX,
                                         WidthProvider widthProvider)