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

XFA - Fix font scale factors (bug 1720888)

- All the scale factors in for the substitution font were wrong because of different glyph positions between Liberation and the other ones:
    - regenerate all the factors
  - Text may have polish chars for example and in this case the glyph widths were wrong:
    - treat substitution font as a composite one
    - add a map glyphIndex to unicode for Liberation in order to generate width array for cid font
This commit is contained in:
Calixte Denizet 2021-07-28 18:30:22 +02:00
parent ac5c4b7fd0
commit 4a4591bd2c
17 changed files with 1614 additions and 1248 deletions

View file

@ -105,7 +105,7 @@ const StyleMapping = new Map([
const spacesRegExp = /\s+/g;
const crlfRegExp = /[\r\n]+/g;
function mapStyle(styleStr, fontFinder) {
function mapStyle(styleStr, node) {
const style = Object.create(null);
if (!styleStr) {
return style;
@ -144,7 +144,8 @@ function mapStyle(styleStr, fontFinder) {
posture: style.fontStyle || "normal",
size: original.fontSize || 0,
},
fontFinder,
node,
node[$globalData].fontFinder,
style
);
}
@ -309,7 +310,7 @@ class XhtmlObject extends XmlObject {
name: this[$nodeName],
attributes: {
href: this.href,
style: mapStyle(this.style, this[$globalData].fontFinder),
style: mapStyle(this.style, this),
},
children,
value: this[$content] || "",