mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-26 01:55:48 +02:00
Get the right transform for a pattern before filling some text
It fixes #16091.
This commit is contained in:
parent
d1a711bca3
commit
a1b64c52a1
@ -2137,6 +2137,23 @@ class CanvasGraphics {
|
|||||||
fillStrokeMode === TextRenderingMode.STROKE ||
|
fillStrokeMode === TextRenderingMode.STROKE ||
|
||||||
fillStrokeMode === TextRenderingMode.FILL_STROKE;
|
fillStrokeMode === TextRenderingMode.FILL_STROKE;
|
||||||
|
|
||||||
|
let lineWidth = current.lineWidth;
|
||||||
|
const scale = current.textMatrixScale;
|
||||||
|
if (scale === 0 || lineWidth === 0) {
|
||||||
|
if (needsStroke) {
|
||||||
|
lineWidth = this.getSinglePixelWidth();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
lineWidth /= scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fontSizeScale !== 1.0) {
|
||||||
|
ctx.scale(fontSizeScale, fontSizeScale);
|
||||||
|
lineWidth /= fontSizeScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.lineWidth = lineWidth;
|
||||||
|
|
||||||
if (needsFill && current.patternFill) {
|
if (needsFill && current.patternFill) {
|
||||||
ctx.save();
|
ctx.save();
|
||||||
const pattern = current.fillColor.getPattern(
|
const pattern = current.fillColor.getPattern(
|
||||||
@ -2165,23 +2182,6 @@ class CanvasGraphics {
|
|||||||
ctx.strokeStyle = pattern;
|
ctx.strokeStyle = pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
let lineWidth = current.lineWidth;
|
|
||||||
const scale = current.textMatrixScale;
|
|
||||||
if (scale === 0 || lineWidth === 0) {
|
|
||||||
if (needsStroke) {
|
|
||||||
lineWidth = this.getSinglePixelWidth();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
lineWidth /= scale;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fontSizeScale !== 1.0) {
|
|
||||||
ctx.scale(fontSizeScale, fontSizeScale);
|
|
||||||
lineWidth /= fontSizeScale;
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.lineWidth = lineWidth;
|
|
||||||
|
|
||||||
if (font.isInvalidPDFjsFont) {
|
if (font.isInvalidPDFjsFont) {
|
||||||
const chars = [];
|
const chars = [];
|
||||||
let width = 0;
|
let width = 0;
|
||||||
|
|||||||
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -896,3 +896,4 @@
|
|||||||
!bug2026037.pdf
|
!bug2026037.pdf
|
||||||
!tiling_patterns_variations.pdf
|
!tiling_patterns_variations.pdf
|
||||||
!function_based_shading.pdf
|
!function_based_shading.pdf
|
||||||
|
!issue16091.pdf
|
||||||
|
|||||||
BIN
test/pdfs/issue16091.pdf
Executable file
BIN
test/pdfs/issue16091.pdf
Executable file
Binary file not shown.
@ -14052,5 +14052,12 @@
|
|||||||
"lastPage": 1144,
|
"lastPage": 1144,
|
||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "issue16091",
|
||||||
|
"file": "pdfs/issue16091.pdf",
|
||||||
|
"md5": "ac6b2b69d9b3675b317708ec00aaf56c",
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "eq"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user