code: @VisibleForTesting
      protected static Dimension getMaxLabelSize(final ScaleBarRenderSettings settings) {
          float maxLabelHeight = 0.0f;
          float maxLabelWidth = 0.0f;
          for (final Label label: settings.getLabels()) {
              maxLabelHeight = Math.max(maxLabelHeight, label.getHeight());
              maxLabelWidth = Math.max(maxLabelWidth, label.getWidth());
          }
          return new Dimension((int) Math.ceil(maxLabelWidth), (int) Math.ceil(maxLabelHeight));
      }
docs: Get the maximum width and height of the labels.
  
  @param settings Parameters for rendering the scalebar.