private static @NotNull String trimLeft(@NotNull String text, @NotNull FontMetrics metrics, int width) {
    int min = 0, max = text.length();
    while (true) {
      int pos = max - (max - min) / 2;
      String str = text.substring(pos);
      if (pos == max) return str;
      if (isFit(str, metrics, width)) {
        max = pos;
      }
      else {
        min = pos;
      }
    }
  }
private static @NotNull String trimLeft(@NotNull String text, @NotNull FontMetrics metrics, int width)