private boolean drawString(Graphics2D g, char[] text, int end, boolean lineStart, Point2D position, Rectangle2D clip,
                             Color backColor, Color underscoredColor) {
    boolean toContinue = true;
    if (end >= mySegmentEnd) {
      end = mySegmentEnd;
      toContinue = false;
    }
    if (myOffset >= end) return toContinue;
    boolean isInClip = (getLineHeight(g) + position.getY() >= clip.getY()) && (position.getY() <= clip.getY() + clip.getHeight());
    if (!isInClip) return toContinue;

    if (myPrintSettings.WRAP) {
      double w = getTextSegmentWidth(text, myOffset, end - myOffset, position.getX(), g);
      if (position.getX() + w > clip.getWidth()) {
        IntList breakOffsets = LineWrapper.calcBreakOffsets(text, myOffset, end, lineStart, position.getX(), clip.getWidth(),
                                                            (t, start, count, x) -> getTextSegmentWidth(t, start, count, x, g));
        for (int i = 0; i < breakOffsets.size(); i++) {
          int breakOffset = breakOffsets.getInt(i);
          drawTabbedString(g, text, breakOffset - myOffset, position, backColor, underscoredColor);
          position.setLocation(0, position.getY() + getLineHeight(g));
          if (position.getY() > clip.getY() + clip.getHeight() - getLineHeight(g)) {
            return false;
          }
        }
      }
    }
    drawTabbedString(g, text, end - myOffset, position, backColor, underscoredColor);
    return toContinue;
  }
private boolean drawString(Graphics2D g, char[] text, int end, boolean lineStart, Point2D position, Rectangle2D clip,
                             Color backColor, Color underscoredColor)