textMeasurementFacts()
Measure text and package the result as measurement facts.
Import
Section titled “Import”import { textMeasurementFacts } from "@graphrefly/ts/solutions/reactive-layout";Signature
Section titled “Signature”function textMeasurementFacts( text: string, font: string, adapter: MeasurementAdapter, cache: Map<string, Map<string, number>>, segmentAdapter: SegmentAdapter, targetId: string, source: string,): MeasurementsParameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
text | string | Text to measure. |
font | string | Font string to measure with. |
adapter | MeasurementAdapter | Measurement adapter. |
cache | Map<string, Map<string, number>> | Shared segment measurement cache. |
segmentAdapter | SegmentAdapter | Segment adapter used for grapheme/word splitting. |
targetId | string | Measurement target id. |
source | string | Measurement source label. |
Returns
Section titled “Returns”Measurement facts describing the text segments and hyphen width.
Example
Section titled “Example”textMeasurementFacts("Hello", "16px sans-serif", adapter, new Map(), segmentAdapter, "title", "demo");Source
Section titled “Source”packages/ts/src/solutions/reactive-layout/measurements.ts