code: public BidiWrappingText unicodeWrappingText(@Nullable Dir dir, String str, boolean isHtml) {
      if (dir == null) {
        dir = estimateDirection(str, isHtml);
      }
      StringBuilder beforeText = new StringBuilder();
      StringBuilder afterText = new StringBuilder();
      if (dir != Dir.NEUTRAL && dir != contextDir) {
        beforeText.append(dir == Dir.RTL ? BidiUtils.Format.RLE : BidiUtils.Format.LRE);
        afterText.append(BidiUtils.Format.PDF);
      }
      afterText.append(markAfter(dir, str, isHtml));
      return BidiWrappingText.create(beforeText.toString(), afterText.toString());
    }
docs: Operates like {@link #unicodeWrap(Dir, String, boolean)} but only returns the text that would
  be prepended and appended to {@code str}.
  
  @param dir {@code str}'s directionality. If null, i.e. unknown, it is estimated.
  @param str The input string
  @param isHtml Whether {@code str} is HTML / HTML-escaped