Skip to content

Interface: TextMeasurement ​

Result of TsPptx.measureText. Heights err tall (conservative) — they match the value the export-time autofit bake uses, so the laid-out height is ≥ what PowerPoint/LibreOffice render. Use it to grow a container; for an overflow check it may slightly over-report (good for a warning, not a hard gate).

Properties ​

approximatedFaces ​

approximatedFaces: string[]

The named faces laid out with the conservative average-advance heuristic instead of their real metrics — i.e. faces with no registered metrics. Empty when every run was measured exactly (and for an unmeasurable result, which guessed nothing). The numbers stay conservative (they err tall/wide), but a non-empty list means they are an approximation, not a measurement; register the face via TsPptx.registerFontMetrics for an exact result.


fitsBox ​

fitsBox: (hIn) => boolean

True if the text fits a box of inner height hIn (inches) at full size.

Parameters ​

ParameterType
hInnumber

Returns ​

boolean


heightIn ​

heightIn: number

Laid-out height in inches at the given fontSize (conservative/tall).


lineCount ​

lineCount: number

Number of wrapped lines (conservative — the model wraps marginally early).


measurable ​

measurable: boolean

false only for an unnamed theme-default face that could not be measured.


shrinkScaleFor ​

shrinkScaleFor: (hIn) => number

The fontScale (percent) that fits inner height hIn; 100 if it already fits, never below the shrink floor.

Parameters ​

ParameterType
hInnumber

Returns ​

number


uncoveredCodepoints ​

uncoveredCodepoints: number[]

Code points in the measured text — sorted, deduplicated — whose run resolved to a registered face that has no glyph for them. Empty for fully covered text.

Unlike everything else here, a non-empty list means the numbers are not reliably conservative. PowerPoint renders such a code point from a substituted face and measures it in that face's advances; this model has no fallback and charges the registered font's .notdef advance, which is unrelated to the glyph that paints. A .notdef wider than the real glyph over-reports (harmless); a narrower one under-reports the width and can drop a line, so heightIn may come back short and the text overflow. Register a face that covers them (or set an explicit fontFace on those runs) before trusting the height.

Faces with no registered metrics are not audited — they measure through the cmap-less heuristic and are reported in approximatedFaces instead. String.fromCodePoint(...uncoveredCodepoints) renders the list.


widestLineIn ​

widestLineIn: number

Width in inches of the widest laid-out line (conservative — the model wraps marginally early, so this errs slightly wide). With an unconstrained wIn it is the natural single-line width; constrained, it is the widest wrapped line. A box set to this width will not re-wrap the text.