Appearance
Function: measureText() ​
measureText(
registry,text,opts):TextMeasurement
Layout-time text measurement against registered metrics — the public engine behind pptx.measureText(). Uses the same calibrated wrap model, resolver semantics, and conservative safety factors as the export-time bake (applyMeasuredFit / solveResize / solveShrink), so a layout-time prediction matches the value the export would bake for any deck that opted into measured fit (i.e. registered at least one face).
With an empty registry the two intentionally diverge: applyMeasuredFit treats "no metrics" as "not opted in" and bakes nothing, while this returns heuristic numbers so the API is useful with zero setup. Check approximatedFaces if that distinction matters.
Synchronous: assumes metrics are pre-registered (lookup is sync). A named face with no exact metrics silently uses the conservative heuristic (same as export) and is reported in approximatedFaces; an unnamed theme-default face returns measurable: false. Code points a registered face has no glyph for are reported in uncoveredCodepoints, and are the one case where the height may come back short rather than tall — there is no font fallback here, only the font's .notdef advance.
Parameters ​
| Parameter | Type |
|---|---|
registry | FontMetricsRegistry |
text | string | TextProps[] |
opts | MeasureTextOptions |