private void ensureLayout(@NotNull EditorView view, BidiRun run, int line) {
      if (isReal()) {
        view.getTextLayoutCache().onChunkAccess(this);
      }
      if (fragments != null) return;
      assert isReal();
      fragments = new ArrayList<>();
      EditorImpl editor = view.getEditor();
      int lineStartOffset = editor.getDocument().getLineStartOffset(line);
      int start = lineStartOffset + startOffset;
      int end = lineStartOffset + endOffset;
      if (LOG.isDebugEnabled()) LOG.debug("Text layout for " + editor.getVirtualFile() + " (" + start + "-" + end + ")");
      IterationState it = new IterationState(editor, start, end, null, false, true, false, false);

      FontFallbackIterator ffi = new FontFallbackIterator()
        .setPreferredFonts(editor.getColorsScheme().getFontPreferences())
        .setFontRenderContext(view.getFontRenderContext());

      boolean specialCharsEnabled = editor.getSettings().isShowingSpecialChars();
      char[] chars = CharArrayUtil.fromSequence(editor.getDocument().getImmutableCharSequence(), start, end);
      int currentFontType = 0;
      Color currentColor = null;
      int currentStart = start;
      while (!it.atEnd()) {
        int fontType = it.getMergedAttributes().getFontType();
        Color color = it.getMergedAttributes().getForegroundColor();
        if (fontType != currentFontType || !color.equals(currentColor)) {
          int tokenStart = it.getStartOffset();
          if (tokenStart > currentStart) {
            addFragments(view, run, this, chars, currentStart - start, tokenStart - start, view.getTabFragment(), specialCharsEnabled, ffi);
          }
          currentStart = tokenStart;
          currentColor = color;
          ffi.setFontStyle(currentFontType = fontType);
        }
        it.advance();
      }
      if (end > currentStart) {
        addFragments(view, run, this, chars, currentStart - start, end - start, view.getTabFragment(), specialCharsEnabled, ffi);
      }
      view.getSizeManager().textLayoutPerformed(start, end);
      assert !fragments.isEmpty();
    }
private void ensureLayout(@NotNull EditorView view, BidiRun run, int line)