Skip to content

Function: emuToPoints() ​

emuToPoints(emu): number

EMU → points, the unit the write API states line widths, font sizes and text insets in.

The one conversion, for the library as well as for a consumer: three private forms of emu / EMU_PER_POINT had grown around it — the read model's null-propagating ptFromEmu, the script mapper's points, and a dozen inline divisions — while this stayed published and uncalled.

The policy, and its one exception. Every EMU→points conversion goes through here or through ptFromEmu in src/read/api/coords.ts, which is this with a null passed along. (Named rather than linked: it is internal, so a reference link to it resolves to nothing in the published reference.) The exception is measure/* — fit.ts, paragraphs.ts, table-fit.ts — where an inner box is computed as (extent - inset - inset) / EMU_PER_POINT and then guarded with !(x > 0). That guard is written NaN-first on purpose: a box that cannot be measured is skipped, not reported. This function asserts a finite input and throws instead, which is the right answer for a caller stating a value and the wrong one for a pass whose whole job is to degrade quietly. Those sites keep the division; nothing else may.

Parameters ​

ParameterType
emunumber

Returns ​

number