Merge pull request #14232 from brendandahl/show-text-pattern
Use correct matrix for patterns with showText.
This commit is contained in:
commit
8222d6530b
@ -2146,10 +2146,17 @@ class CanvasGraphics {
|
|||||||
!current.patternFill;
|
!current.patternFill;
|
||||||
|
|
||||||
ctx.save();
|
ctx.save();
|
||||||
|
ctx.transform.apply(ctx, current.textMatrix);
|
||||||
|
ctx.translate(current.x, current.y + current.textRise);
|
||||||
|
|
||||||
|
if (fontDirection > 0) {
|
||||||
|
ctx.scale(textHScale, -1);
|
||||||
|
} else {
|
||||||
|
ctx.scale(textHScale, 1);
|
||||||
|
}
|
||||||
|
|
||||||
let patternTransform;
|
let patternTransform;
|
||||||
if (current.patternFill) {
|
if (current.patternFill) {
|
||||||
// TODO: Patterns are not applied correctly to text if a non-embedded
|
|
||||||
// font is used. E.g. issue 8111 and ShowText-ShadingPattern.pdf.
|
|
||||||
ctx.save();
|
ctx.save();
|
||||||
const pattern = current.fillColor.getPattern(
|
const pattern = current.fillColor.getPattern(
|
||||||
ctx,
|
ctx,
|
||||||
@ -2160,14 +2167,6 @@ class CanvasGraphics {
|
|||||||
ctx.restore();
|
ctx.restore();
|
||||||
ctx.fillStyle = pattern;
|
ctx.fillStyle = pattern;
|
||||||
}
|
}
|
||||||
ctx.transform.apply(ctx, current.textMatrix);
|
|
||||||
ctx.translate(current.x, current.y + current.textRise);
|
|
||||||
|
|
||||||
if (fontDirection > 0) {
|
|
||||||
ctx.scale(textHScale, -1);
|
|
||||||
} else {
|
|
||||||
ctx.scale(textHScale, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
let lineWidth = current.lineWidth;
|
let lineWidth = current.lineWidth;
|
||||||
let resetLineWidthToOne = false;
|
let resetLineWidthToOne = false;
|
||||||
|
@ -112,7 +112,7 @@ class RadialAxialShadingPattern extends BaseShadingPattern {
|
|||||||
tmpCtx.fillStyle = this._createGradient(tmpCtx);
|
tmpCtx.fillStyle = this._createGradient(tmpCtx);
|
||||||
tmpCtx.fill();
|
tmpCtx.fill();
|
||||||
|
|
||||||
pattern = ctx.createPattern(tmpCanvas.canvas, "repeat");
|
pattern = ctx.createPattern(tmpCanvas.canvas, "no-repeat");
|
||||||
this.cachedCanvasPatterns.set(this, pattern);
|
this.cachedCanvasPatterns.set(this, pattern);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
2
test/pdfs/.gitignore
vendored
2
test/pdfs/.gitignore
vendored
@ -326,6 +326,7 @@
|
|||||||
!bug1065245.pdf
|
!bug1065245.pdf
|
||||||
!issue6769.pdf
|
!issue6769.pdf
|
||||||
!bug1151216.pdf
|
!bug1151216.pdf
|
||||||
|
!issue8111.pdf
|
||||||
!bug1175962.pdf
|
!bug1175962.pdf
|
||||||
!bug1020226.pdf
|
!bug1020226.pdf
|
||||||
!issue9534_reduced.pdf
|
!issue9534_reduced.pdf
|
||||||
@ -374,6 +375,7 @@
|
|||||||
!issue4573.pdf
|
!issue4573.pdf
|
||||||
!issue4722.pdf
|
!issue4722.pdf
|
||||||
!issue4800.pdf
|
!issue4800.pdf
|
||||||
|
!issue9243.pdf
|
||||||
!issue13147.pdf
|
!issue13147.pdf
|
||||||
!issue11477_reduced.pdf
|
!issue11477_reduced.pdf
|
||||||
!text_clip_cff_cid.pdf
|
!text_clip_cff_cid.pdf
|
||||||
|
BIN
test/pdfs/issue8111.pdf
Normal file
BIN
test/pdfs/issue8111.pdf
Normal file
Binary file not shown.
110
test/pdfs/issue9243.pdf
Normal file
110
test/pdfs/issue9243.pdf
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
%PDF-1.4
|
||||||
|
1 0 obj
|
||||||
|
<< /Type /Catalog
|
||||||
|
/Outlines 2 0 R
|
||||||
|
/Pages 3 0 R
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
2 0 obj
|
||||||
|
<< /Type /Outlines
|
||||||
|
/Count 0
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
3 0 obj
|
||||||
|
<< /Type /Pages
|
||||||
|
/Kids [
|
||||||
|
9 0 R
|
||||||
|
]
|
||||||
|
/Count 1
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
4 0 obj
|
||||||
|
<<
|
||||||
|
/Title (Shading pattern test)
|
||||||
|
/Author (Luis)
|
||||||
|
/Producer (SciSoft PDF exporter)
|
||||||
|
/CreationDate (D:20171205161319-03'00')
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
5 0 obj
|
||||||
|
<< /FunctionType 2
|
||||||
|
/Domain [ 0.000000 1.000000 ]
|
||||||
|
/C0 [ 0.100000 0.700000 0.700000 ]
|
||||||
|
/C1 [ 0.000000 0.000000 0.700000 ]
|
||||||
|
/N 1.000000
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
6 0 obj
|
||||||
|
<< /ShadingType 2
|
||||||
|
/ColorSpace /DeviceRGB
|
||||||
|
/Function 5 0 R
|
||||||
|
/Coords [ 0.000000 0.000000 432.000000 432.000000 ]
|
||||||
|
/Domain [ 0.000000 1.000000 ]
|
||||||
|
/Extend [ false false ]
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
7 0 obj
|
||||||
|
<< /Type /Pattern
|
||||||
|
/PatternType 2
|
||||||
|
/Shading 6 0 R
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
8 0 obj
|
||||||
|
<< /Type /Font /Subtype /Type1
|
||||||
|
/Name /F8
|
||||||
|
/BaseFont /Helvetica-Bold
|
||||||
|
/Encoding /WinAnsiEncoding
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
9 0 obj
|
||||||
|
<< /Type /Page
|
||||||
|
/Parent 3 0 R
|
||||||
|
/MediaBox [ 0 0 432 144 ]
|
||||||
|
/Contents 10 0 R
|
||||||
|
/Resources
|
||||||
|
<< /ProcSet [ /PDF /Text ]
|
||||||
|
/Font <<
|
||||||
|
/F8 8 0 R
|
||||||
|
>>
|
||||||
|
/Pattern << /PT7 7 0 R >>
|
||||||
|
>>
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
10 0 obj
|
||||||
|
<< /Length 11 0 R >>
|
||||||
|
stream
|
||||||
|
/Pattern cs
|
||||||
|
/PT7 scn
|
||||||
|
BT
|
||||||
|
/F8 72 Tf
|
||||||
|
36 36 Td
|
||||||
|
0 Tr
|
||||||
|
(SHADING) Tj
|
||||||
|
ET
|
||||||
|
endstream
|
||||||
|
endobj
|
||||||
|
11 0 obj
|
||||||
|
64
|
||||||
|
endobj
|
||||||
|
xref
|
||||||
|
0 12
|
||||||
|
0000000000 65535 f
|
||||||
|
0000000009 00000 n
|
||||||
|
0000000080 00000 n
|
||||||
|
0000000129 00000 n
|
||||||
|
0000000214 00000 n
|
||||||
|
0000000365 00000 n
|
||||||
|
0000000526 00000 n
|
||||||
|
0000000722 00000 n
|
||||||
|
0000000794 00000 n
|
||||||
|
0000000915 00000 n
|
||||||
|
0000001145 00000 n
|
||||||
|
0000001263 00000 n
|
||||||
|
trailer
|
||||||
|
<< /Size 12
|
||||||
|
/Root 1 0 R
|
||||||
|
/Info 4 0 R
|
||||||
|
>>
|
||||||
|
startxref
|
||||||
|
1285
|
||||||
|
%%EOF
|
@ -178,6 +178,12 @@
|
|||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "issue8111",
|
||||||
|
"file": "pdfs/issue8111.pdf",
|
||||||
|
"md5": "14a2b3c19ed3d6cd7e138cdc141aa4a8",
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "issue13343",
|
{ "id": "issue13343",
|
||||||
"file": "pdfs/issue13343.pdf",
|
"file": "pdfs/issue13343.pdf",
|
||||||
"md5": "f8bf1888839e15254555092c504e1900",
|
"md5": "f8bf1888839e15254555092c504e1900",
|
||||||
@ -2580,6 +2586,12 @@
|
|||||||
"link": true,
|
"link": true,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "issue9243",
|
||||||
|
"file": "pdfs/issue9243.pdf",
|
||||||
|
"md5": "f6b8c5c62b8875f7d9dfcd2b25d3aab8",
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "issue8424",
|
{ "id": "issue8424",
|
||||||
"file": "pdfs/issue8424.pdf",
|
"file": "pdfs/issue8424.pdf",
|
||||||
"md5": "3de1ea4c085e8fe8e156153418058955",
|
"md5": "3de1ea4c085e8fe8e156153418058955",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user