diff --git a/README.md b/README.md index ee00d5cf..d485ac8b 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Pretext serves 2 use cases: import { prepare, layout } from '@chenglou/pretext' const prepared = prepare('AGI 春天到了. بدأت الرحلة 🚀', '16px Inter') -const { height, lineCount } = layout(prepared, textWidth, 20) // pure arithmetics. No DOM layout & reflow! +const { height, lineCount } = layout(prepared, 320, 20) // pure arithmetics. No DOM layout & reflow! ``` `prepare()` does the one-time work: normalize whitespace, segment the text, apply glue rules, measure the segments with canvas, and return an opaque handle. `layout()` is the cheap hot path after that: pure arithmetic over cached widths. Do not rerun `prepare()` for the same text and configs; that'd defeat its precomputation. For example, on resize, only rerun `layout()`.