fix: keep a header/footer's own font on DOCX import

blockDefaults(baseRun) made the Header/Footer style's own font the yardstick,
so a run matching it imported without marks. The zone carries no styleName and
no style CSS reaches it, so it then rendered in the editor default instead —
an Arial footer came back as Liberation Serif, 2.3mm narrow per line.
This commit is contained in:
Steffen Becker committed 2026-08-07 17:32:24 +00:00
1 parent 67e2a00bf0
commit 38e852190d
1 file changed
+4 -1
+4 -1
View File
@@ -1552,7 +1552,10 @@ function convertHfPart(relId: string | null, ctx: Ctx): HfDoc {
}
boxMaps.push(readParaBox(ppr));
const baseRun = hfCtx.styles.paragraphRun(fc(ppr, 'pStyle') ? wVal(fc(ppr, 'pStyle')!) : null);
inline.push(...convertInline(p, hfCtx, baseRun, blockDefaults(baseRun, null, false), true).filter((n) => n.type !== PB_MARKER));
// The zone carries no styleName and no style CSS reaches it, so the yardstick is the
// editor's own defaults — what the Header/Footer style provides has to become marks
// (mirrors odt.ts convertHfZone, which passes no style name either).
inline.push(...convertInline(p, hfCtx, baseRun, blockDefaults({}, null, false), true).filter((n) => n.type !== PB_MARKER));
}
// An all-empty zone is dropped unless it carries a background/rule line (a footer that
// is just a colored line has no text). The zone collapses to one paragraph (mergeHfBox).