code: public float getWidth(int startIdx, int lastIdx) {
          char c = 0;
          PdfChunk ck = null;
          float width = 0;
          for (; startIdx <= lastIdx; ++startIdx) {
              boolean surrogate = Utilities.isSurrogatePair(text, startIdx);
              if (surrogate) {
                  width += detailChunks[startIdx].getCharWidth(Utilities.convertToUtf32(text, startIdx));
                  ++startIdx;
              }
              else {
                  c = text[startIdx];
                  ck = detailChunks[startIdx];
                  if (PdfChunk.noPrint(ck.getUnicodeEquivalent(c)))
                      continue;
                  width += detailChunks[startIdx].getCharWidth(c);
              }
          }
          return width;
      }
docs: Gets the width of a range of characters.
  @param startIdx the first index to calculate
  @param lastIdx the last inclusive index to calculate
  @return the sum of all widths