fix: a style keeps the line spacing its document default does not

Word writes 1.08 into w:docDefaults, so a style declaring single spacing was
dropped as "the default anyway" and inherited 1.08 instead — every Title and
every heading that asks for 1 rendered a line too tall. The parent style is
the yardstick, which ownProps already applies.
This commit is contained in:
Steffen Becker committed 2026-08-10 21:22:34 +00:00
1 parent af144362fe
commit dc22bb7523
1 file changed
+4 -2
+4 -2
View File
@@ -661,9 +661,11 @@ function stylePara(ctx: Ctx, id: string | null): ParaProps {
const sp = ctx.styles.paragraphSpacing(id);
if (sp.before != null) out.spaceBefore = snapPt(twipToPt(sp.before));
if (sp.after != null) out.spaceAfter = snapPt(twipToPt(sp.after));
// Not suppressed against single spacing — the document default may be something else
// (Word writes 1.08), and a style declaring 1 would then inherit that instead. What
// the parent style already supplies is dropped by the caller's ownProps.
if (sp.line != null && (!sp.lineRule || sp.lineRule === 'auto')) {
const mult = round2(sp.line / 240);
if (Math.abs(mult - 1) > 0.01) out.lineHeight = String(mult);
out.lineHeight = String(round2(sp.line / 240));
}
const jc = ctx.styles.paragraphAlign(id);
if (jc === 'center') out.textAlign = 'center';