modern-text 0.1.25 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,9 +21,9 @@
21
21
  ## Usage
22
22
 
23
23
  ```ts
24
- import { measureText, renderText } from 'modern-text'
24
+ import { Text } from 'modern-text'
25
25
 
26
- const text = {
26
+ const text = new Text({
27
27
  style: {
28
28
  width: 100,
29
29
  height: 200,
@@ -58,9 +58,11 @@ const text = {
58
58
  { content: ', ', color: 'grey' },
59
59
  { content: 'World!', color: 'black' },
60
60
  ],
61
- }
61
+ })
62
62
 
63
- document.body.append(renderText(text)) // canvas 2d
63
+ const view = document.createElement('canvas')
64
+ text.render({ view })
65
+ document.body.append(view) // canvas 2d
64
66
 
65
- console.log(measureText(text)) // boundingBox with computed paragraphs
67
+ console.log(text.measure()) // boundingBox with computed paragraphs
66
68
  ```