public @NotNull Map<String, Rectangle> getHighlightedRegionsBoundsMap() {

    HashMap<String, Rectangle> map = new HashMap<>();
    FontMetrics defFontMetrics = getFontMetrics(getFont());

    int pivot = getTextOffset();
    int start, end;

    if (!myText.isEmpty() && !myHighlightedRegions.isEmpty()) {
      int endIndex = 0;
      for (HighlightedRegion hRegion : myHighlightedRegions) {
        pivot += getStringWidth(myText.substring(endIndex, hRegion.startOffset), defFontMetrics);
        start = pivot;
        endIndex = hRegion.endOffset;

        String text = getRegionText(hRegion);
        Font regFont = getFont().deriveFont(hRegion.textAttributes.getFontType());
        FontMetrics fontMetrics = getFontMetrics(regFont);
        pivot += getStringWidth(text, fontMetrics);
        end = pivot;
        map.put(text, new Rectangle(this.getBounds().x + start, this.getBounds().y, end - start, this.getBounds().height));
      }
    }
    return map;
  }
public @NotNull Map<String, Rectangle> getHighlightedRegionsBoundsMap()