Scrawl-canvas v8 - Canvas test 015a

Phrase entity - cache output to improve render speeds

Test purpose

Known issues when using this approach:

  1. Calculating the best Picture dimensions to replicate the Phrase may take some experimentation; remember that Phrase entitys include their lineHight attribute when calculating their height value.
  2. Any bounding box will be incorrectly placed with relation to the captured text; try using a stroke around the Picture entity instead.
  3. Phrase entitys with dynamic fill or stroke styles (for example animated patterns or gradients) will not benefit from this approach.
  4. The 'clear' method will not work because the cache image is captured against a transparent background.

Touch test: should work as expected - though flicking a text may lead to it moving beyond the canvas border and out of sight!

Annotated code