code: function getSegments(font, bounds) {
    bounds = bounds || Number.MAX_VALUE;
  
    var result = [];
    var segment;
  
    // prevEndCode only changes when a segment closes
    _.forEach(font.codePoints, function (glyph, unicode) {
      unicode = parseInt(unicode, 10);
      if (unicode >= bounds) {
        return false;
      }
      // Initialize first segment or add new segment if code "hole" is found
      if (!segment || unicode !== (segment.end + 1)) {
        if (segment) {
          result.push(segment);
        }
        segment = {
          start: unicode
        };
      }
      segment.end = unicode;
    });
  
    // Need to finish the last segment
    if (segment) {
      result.push(segment);
    }
  
    _.forEach(result, function (segment) {
      segment.length = segment.end - segment.start + 1;
    });
  
    return result;
  }
docs: Calculate character segments with non-interruptable chains of unicodes