code: Map<String, Rectangle2D> getSeriesTextBounds(S series) {
  
      // FontMetrics fontMetrics = g.getFontMetrics(getChartPainter().getstyler().getLegendFont());
      // float fontDescent = fontMetrics.getDescent();
  
      String lines[] = series.getName().split("\\n");
      Map<String, Rectangle2D> seriesTextBounds =
          new LinkedHashMap<String, Rectangle2D>(lines.length);
      for (String line : lines) {
        TextLayout textLayout =
            new TextLayout(
                line, chart.getStyler().getLegendFont(), new FontRenderContext(null, true, false));
        Shape shape = textLayout.getOutline(null);
        Rectangle2D bounds = shape.getBounds2D();
        // System.out.println(tl.getAscent());
        // System.out.println(tl.getDescent());
        // System.out.println(tl.getBounds());
        // seriesTextBounds.put(line, new Rectangle2D.Double(bounds.getX(), bounds.getY(),
        // bounds.getWidth(), bounds.getHeight() - tl.getDescent()));
        // seriesTextBounds.put(line, new Rectangle2D.Double(bounds.getX(), bounds.getY(),
        // bounds.getWidth(), tl.getAscent()));
        seriesTextBounds.put(line, bounds);
      }
      return seriesTextBounds;
    }
docs: Normally each legend entry just has one line of text, but it can be made multi-line by adding
  "\\n". This method returns a Map for each single legend entry, which is normally just a Map
  with one single entry.
  
  @param series
  @return