Skip to content

@shbernal/ts-pptx


@shbernal/ts-pptx / index / TextMeasurement

Interface: TextMeasurement

Defined in: src/types/text.ts:578

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[]

Defined in: src/types/text.ts:600

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

Defined in: src/types/text.ts:602

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

Parameters

hIn

number

Returns

boolean


heightIn

heightIn: number

Defined in: src/types/text.ts:580

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


lineCount

lineCount: number

Defined in: src/types/text.ts:582

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


measurable

measurable: boolean

Defined in: src/types/text.ts:591

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


shrinkScaleFor

shrinkScaleFor: (hIn) => number

Defined in: src/types/text.ts:604

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

Parameters

hIn

number

Returns

number


widestLineIn

widestLineIn: number

Defined in: src/types/text.ts:589

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.