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

XFA - Fix text positions (bug 1718741)

- font line height is taken into account by acrobat when it isn't with masterpdfeditor: I extracted a font from a pdf, modified some ascent/descent properties thanks to ttx and the reinjected the font in the pdf: only Acrobat is taken it into account. So in this patch, line heights for some substituted fonts are added.
  - it seems that Acrobat is using a line height of 1.2 when the line height in the font is not enough (it's the only way I found to fix correctly bug 1718741).
   - don't use flex in wrapper container (which was causing an horizontal overflow in the above bug).
   - consequently, the above fixes introduced a lot of small regressions, so in order to see real improvements on reftests, I fixed the regressions in this patch:
     - replace margin by padding in some case where padding is a part of a container dimensions;
     - remove some flex display: some containers are wrongly sized when rendered;
     - set letter-spacing to 0.01px: it helps to be sure that text is not broken because of not enough width in Firefox.
This commit is contained in:
Calixte Denizet 2021-07-09 17:29:21 +02:00
parent 0afc785c7d
commit 58e1f51688
15 changed files with 220 additions and 103 deletions

View file

@ -41,7 +41,7 @@
font-style: inherit;
font-weight: inherit;
font-kerning: inherit;
letter-spacing: inherit;
letter-spacing: -0.01px;
text-align: inherit;
text-decoration: inherit;
vertical-align: inherit;
@ -118,13 +118,9 @@
pointer-events: none;
}
.xfaWrapper {
display: flex;
align-items: stretch;
}
.xfaWrapped {
flex: 1 1 auto;
width: 100%;
height: 100%;
}
.xfaTextfield,
@ -169,8 +165,8 @@
.xfaRich {
white-space: pre-wrap;
width: auto;
height: auto;
width: 100%;
height: 100%;
}
.xfaImage {
@ -188,12 +184,6 @@
align-items: stretch;
}
.xfaLr,
.xfaRl,
.xfaTb > div {
flex: 1 1 auto;
}
.xfaLr {
display: flex;
flex-direction: row;
@ -229,20 +219,12 @@
align-items: stretch;
}
.xfaTable > div {
flex: 1 1 auto;
}
.xfaTable .xfaRow {
display: flex;
flex-direction: row;
align-items: stretch;
}
.xfaTable .xfaRow > div {
flex: 1 1 auto;
}
.xfaTable .xfaRlRow {
display: flex;
flex-direction: row-reverse;