[WIP] Support variable-width text 

rebased version of #1608 

TODO:
- [ ] add option to keep old behavior
- [ ] fix handling of wrapped lines
- [ ] rtl support (use range.getBoundingClientRect for measurements)
- [ ] gracefully handle scrollbar size changes from delayed measurements of line height/length