code: public float trimLastSpace()
      {
          BaseFont ft = font.getFont();
          if (ft.getFontType() == BaseFont.FONT_TYPE_CJK && ft.getUnicodeEquivalent(' ') != ' ') {
              if (value.length() > 1 && value.endsWith("\u0001")) {
                  value = value.substring(0, value.length() - 1);
                  return font.width('\u0001');
              }
          }
          else {
              if (value.length() > 1 && value.endsWith(" ")) {
                  value = value.substring(0, value.length() - 1);
                  return font.width(' ');
              }
          }
          return 0;
      }
docs: Trims the last space.
  @return the width of the space trimmed, otherwise 0