Reset alpha before drawing a colored glyph in type 3 font

It fixes #21430.
This commit is contained in:
calixteman 2026-06-21 22:18:50 +02:00
parent 8ebc2382e3
commit 623e6d9476
No known key found for this signature in database
GPG Key ID: 0C5442631EE0691F
3 changed files with 19 additions and 0 deletions

View File

@ -2965,6 +2965,14 @@ class CanvasGraphics {
warn(`Type3 character "${glyph.operatorListId}" is not available.`);
} else if (this.contentVisible) {
this.save();
// A d0 (setCharWidth) glyph is colored (see Table 113 in pdf 1.7 specs)
// unlike a d1 glyph painted as a stencil mask with the current fill
// color. The constant alphas (ca/CA) are the opacity of that current
// color, so they must not attenuate a d0 glyph.
if (operatorList.fnArray[0] === OPS.setCharWidth) {
current.fillAlpha = current.strokeAlpha = 1;
ctx.globalAlpha = 1;
}
ctx.scale(fontSize, fontSize);
ctx.transform(...fontMatrix);
this.executeOperatorList(operatorList);

View File

@ -0,0 +1 @@
https://github.com/user-attachments/files/28821514/xxx.pdf

View File

@ -14429,5 +14429,15 @@
"type": "eq",
"annotations": true,
"forms": true
},
{
"id": "issue21430",
"file": "pdfs/issue21430.pdf",
"md5": "e317f63bdfd6f3d1939a52c983379454",
"rounds": 1,
"link": true,
"firstPage": 1,
"lastPage": 1,
"type": "eq"
}
]