LivelyKernel / lively.morphic

An implementation of the Morphic user interface framework for lively.next.
13 stars 2 forks source link

Text tree layout #122

Closed rksm closed 7 years ago

rksm commented 7 years ago

Towards performance improvements for text layouting by using a btree representation.

rksm commented 7 years ago

This changes

  1. Document representation of text (i.e. how lines + strings and attributes in lines are handled)

btree that makes read and modifications efficient.

screen shot 2017-04-10 at 6 14 36 pm

is represented as

screen shot 2017-04-10 at 6 24 05 pm

  1. What text layouting is based on (i.e. the system for font measurements changed)

document.createRange().getClientRects() if possible, fallback to the slower element.getBoundingClientRect() if necessary.

Generally, concrete measuring is done as little as possible.

screen shot 2017-04-10 at 6 44 24 pm

  1. Interface changes in text morph to make using rich text easier
text.textAndAttributes = [
  "this\n", {fontSize: 14},
  "is a\n", {fontSize: 30},
  "lively\n", {textDecoration: "underline"},
  "text", null
]