private static Set<@NlsSafe String> collectFontNames(@NotNull EditorEx editor) {
      Set<String> result = new TreeSet<>();
      Document document = editor.getDocument();
      CharSequence text = document.getImmutableCharSequence();
      int textLength = document.getTextLength();
      IterationState it = new IterationState(editor, 0, textLength, null, false, true, false, false);
      FontFallbackIterator ffi = new FontFallbackIterator().setPreferredFonts(editor.getColorsScheme().getFontPreferences());
      while (!it.atEnd()) {
        ffi.setFontStyle(it.getMergedAttributes().getFontType());
        int start = it.getStartOffset();
        int end = it.getEndOffset();
        for (int i = start; i < end; i++) {
          if ("\r\n\t".indexOf(text.charAt(i)) >= 0) {
            collectFontNames(result, text, start, i, ffi);
            start = i + 1;
          }
        }
        collectFontNames(result, text, start, end, ffi);
        setProgress((double)end / textLength);
        it.advance();
      }
      return result;
    }
private static Set<@NlsSafe String> collectFontNames(@NotNull EditorEx editor)