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

Support (rare) Type3 fonts with Pattern resources (issue 16127)

This simply extends the approach in PR 10727 to also cover Patterns, which shouldn't be a common occurrence in Type3 fonts (since this is the first issue we've seen).
This commit is contained in:
Jonas Jenwald 2023-03-08 08:45:42 +01:00
parent e0d934ac9d
commit 471aef5fc6
5 changed files with 22 additions and 2 deletions

View file

@ -1482,8 +1482,16 @@ class PartialEvaluator {
);
const patternIR = shadingFill.getIR();
id = `pattern_${this.idFactory.createObjId()}`;
if (this.parsingType3Font) {
id = `${this.idFactory.getDocId()}_type3_${id}`;
}
localShadingPatternCache.set(shading, id);
this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
if (this.parsingType3Font) {
this.handler.send("commonobj", [id, "Pattern", patternIR]);
} else {
this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
}
}
return id;
}

View file

@ -2777,6 +2777,7 @@ class WorkerTransport {
break;
case "FontPath":
case "Image":
case "Pattern":
this.commonObjs.resolve(id, exportedData);
break;
default:

View file

@ -2517,7 +2517,7 @@ class CanvasGraphics {
if (this.cachedPatterns.has(objId)) {
pattern = this.cachedPatterns.get(objId);
} else {
pattern = getShadingPattern(this.objs.get(objId));
pattern = getShadingPattern(this.getObject(objId));
this.cachedPatterns.set(objId, pattern);
}
if (matrix) {