From 821688c2cba6101a07fc5f1148ecb00ad2903d7f Mon Sep 17 00:00:00 2001 From: Steffen Becker Date: Fri, 7 Aug 2026 22:25:13 +0000 Subject: [PATCH] fix: carry the theme font into an imported paragraph style A run with no font already fell back to the document's theme; the style did not, so the registry held Standard and the headings without a family. Single line spacing is measured against that family, so it resolved to the wrong one. --- src/lib/import/docx.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/import/docx.ts b/src/lib/import/docx.ts index 09cf1ee..21d4cd8 100644 --- a/src/lib/import/docx.ts +++ b/src/lib/import/docx.ts @@ -596,7 +596,12 @@ function stylePara(ctx: Ctx, id: string | null): ParaProps { // paragraph's formatting, so the document defaults are not its properties. function styleText(ctx: Ctx, id: string | null, own = false): TextProps { if (!id) return {}; - return runTextProps(own ? ctx.styles.styleOwn(id) : ctx.styles.paragraphRun(id)); + if (own) return runTextProps(ctx.styles.styleOwn(id)); + // A paragraph style naming no font uses the document's theme (minorHAnsi for body, + // majorHAnsi for headings) — the family single line spacing is measured against. + const run = ctx.styles.paragraphRun(id); + const font = run.font ?? ctx.styles.themeFont(run.fontTheme ?? 'minor'); + return runTextProps(font ? { ...run, font } : run); } function runTextProps(run: RunProps): TextProps {