Pomax / lib-font

This library adds a new Font() object to the JavaScript toolbox, similar to new Image() for images
MIT License
730 stars 72 forks source link

collapse contiguous cmap segments in getSupportedCharCodes? #80

Open Pomax opened 4 years ago

Pomax commented 4 years ago

From https://github.com/Pomax/Font.js/issues/79, it would be nice if the getSupportedCharCodes function collapsed the result such that contiguous segments like this:

  { start: 32, end: 32 },   { start: 33, end: 33 },   { start: 34, end: 34 },
  { start: 35, end: 35 },   { start: 36, end: 36 },   { start: 37, end: 37 },
  { start: 38, end: 38 },   { start: 39, end: 39 },   { start: 40, end: 41 },
  { start: 42, end: 42 },   { start: 43, end: 43 },   { start: 44, end: 44 },
  { start: 45, end: 45 },   { start: 46, end: 46 },   { start: 47, end: 47 },
  { start: 48, end: 57 },   { start: 58, end: 59 },   { start: 60, end: 60 },

becomes a single segment { start: 32, end: 60 }