XFA - Fix auto-sized fields (bug 1722030)

- In order to better compute text fields size, use line height with no gaps (and consequently guessed height for text are slightly better in general).
  - Fix default background color in fields.
This commit is contained in:
Calixte Denizet 2021-07-27 18:43:05 +02:00
parent 336a74a0e5
commit 76d882b560
14 changed files with 311 additions and 162 deletions

View file

@ -247,7 +247,7 @@ function layoutNode(node, availableSpace) {
}
}
const maxWidth = !node.w ? availableSpace.width : node.w;
const maxWidth = (!node.w ? availableSpace.width : node.w) - marginH;
const fontFinder = node[$globalData].fontFinder;
if (
node.value.exData &&
@ -614,10 +614,8 @@ function setFontFamily(xfaFont, fontFinder, style) {
}
const pdfFont = selectFont(xfaFont, typeface);
if (pdfFont && pdfFont.lineHeight > 0) {
if (pdfFont) {
style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
} else {
style.lineHeight = 1.2;
}
}
}