1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-28 23:28:16 +02:00

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

@ -94,7 +94,7 @@ const HelveticaBoldFactors = [
1.00022, 1.00022, 0.99973, 0.9993, 0.99973, 0.99973, 0.99973, 0.99973,
0.99973, 0.99973, 1, 1, 1, 1, 0.99973, 0.99902,
];
const HelveticaBoldLineHeight = 1.2;
const HelveticaBoldMetrics = { lineHeight: 1.2, lineGap: 0.2 };
// Factors to rescale LiberationSans-BoldItalic.ttf to have the same
// metrics as NimbusSans-BoldItalic.otf.
@ -177,7 +177,7 @@ const HelveticaBoldItalicFactors = [
0.99973, 1.00065, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1, 1,
1, 1, 0.99973, 1.00061,
];
const HelveticaBoldItalicLineHeight = 1.35;
const HelveticaBoldItalicMetrics = { lineHeight: 1.35, lineGap: 0.2 };
// Factors to rescale LiberationSans-Italic.ttf to have the same
// metrics as NimbusSans-Italic.otf.
@ -258,7 +258,7 @@ const HelveticaItalicFactors = [
0.99973, 0.99973, 1, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1, 1.0005,
1, 1, 1, 1, 0.99973, 1, 1, 1, 1, 1, 0.99973, 0.99918,
];
const HelveticaItalicLineHeight = 1.35;
const HelveticaItalicMetrics = { lineHeight: 1.35, lineGap: 0.2 };
// Factors to rescale LiberationSans-Regular.ttf to have the same
// metrics as NimbusSans-Regular.otf.
@ -339,15 +339,15 @@ const HelveticaRegularFactors = [
0.99977, 0.99977, 0.99977, 1, 1.00055, 1, 1, 1, 1, 0.99973, 1, 1, 1, 1, 1,
0.99973, 1.00019,
];
const HelveticaRegularLineHeight = 1.2;
const HelveticaRegularMetrics = { lineHeight: 1.2, lineGap: 0.2 };
export {
HelveticaBoldFactors,
HelveticaBoldItalicFactors,
HelveticaBoldItalicLineHeight,
HelveticaBoldLineHeight,
HelveticaBoldItalicMetrics,
HelveticaBoldMetrics,
HelveticaItalicFactors,
HelveticaItalicLineHeight,
HelveticaItalicMetrics,
HelveticaRegularFactors,
HelveticaRegularLineHeight,
HelveticaRegularMetrics,
};