Merge pull request #19735 from Snuffleupagus/Type3WordSpacing
Apply char/word-spacing correctly for missing Type3-glyphs
This commit is contained in:
commit
45cbe8bb0d
@ -2264,9 +2264,7 @@ class CanvasGraphics {
|
|||||||
const operatorList = font.charProcOperatorList[glyph.operatorListId];
|
const operatorList = font.charProcOperatorList[glyph.operatorListId];
|
||||||
if (!operatorList) {
|
if (!operatorList) {
|
||||||
warn(`Type3 character "${glyph.operatorListId}" is not available.`);
|
warn(`Type3 character "${glyph.operatorListId}" is not available.`);
|
||||||
continue;
|
} else if (this.contentVisible) {
|
||||||
}
|
|
||||||
if (this.contentVisible) {
|
|
||||||
this.processingType3 = glyph;
|
this.processingType3 = glyph;
|
||||||
this.save();
|
this.save();
|
||||||
ctx.scale(fontSize, fontSize);
|
ctx.scale(fontSize, fontSize);
|
||||||
|
|||||||
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -190,6 +190,7 @@
|
|||||||
!issue4706.pdf
|
!issue4706.pdf
|
||||||
!rotation.pdf
|
!rotation.pdf
|
||||||
!simpletype3font.pdf
|
!simpletype3font.pdf
|
||||||
|
!Type3WordSpacing.pdf
|
||||||
!sizes.pdf
|
!sizes.pdf
|
||||||
!javauninstall-7r.pdf
|
!javauninstall-7r.pdf
|
||||||
!file_url_link.pdf
|
!file_url_link.pdf
|
||||||
|
|||||||
139
test/pdfs/Type3WordSpacing.pdf
Normal file
139
test/pdfs/Type3WordSpacing.pdf
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
%PDF-1.7
|
||||||
|
%âãÏÓ
|
||||||
|
|
||||||
|
1 0 obj
|
||||||
|
<< /Type /Catalog
|
||||||
|
/Pages 2 0 R
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
|
||||||
|
2 0 obj
|
||||||
|
<< /Type /Pages
|
||||||
|
/Kids [ 3 0 R ]
|
||||||
|
/Count 1
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
|
||||||
|
3 0 obj
|
||||||
|
<< /Type /Page
|
||||||
|
/Parent 2 0 R
|
||||||
|
/MediaBox [ 0 0 300 80 ]
|
||||||
|
/Contents 4 0 R
|
||||||
|
/Resources <<
|
||||||
|
/Font << /FTyp3 5 0 R >>
|
||||||
|
>>
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
|
||||||
|
4 0 obj
|
||||||
|
<<
|
||||||
|
/Length 715
|
||||||
|
>>
|
||||||
|
stream
|
||||||
|
0 0 1 rg % Blue non-stroking (fill)
|
||||||
|
1 0 0 RG % Red stroking
|
||||||
|
|
||||||
|
BT
|
||||||
|
/FTyp3 10 Tf % Select Type 3 font
|
||||||
|
0 Tr % Text render mode: 0=fill, 1=stroke, 2=fill then stroke
|
||||||
|
|
||||||
|
0 10 TD
|
||||||
|
50 Tw % Adjust this to: 0, 50, etc
|
||||||
|
( ab ba abba) Tj
|
||||||
|
|
||||||
|
T*
|
||||||
|
40 Tw % Adjust this to: 0, 50, etc
|
||||||
|
( ab ba abba) Tj
|
||||||
|
|
||||||
|
T*
|
||||||
|
30 Tw % Adjust this to: 0, 50, etc
|
||||||
|
( ab ba abba) Tj
|
||||||
|
|
||||||
|
T*
|
||||||
|
20 Tw % Adjust this to: 0, 50, etc
|
||||||
|
( ab ba abba) Tj
|
||||||
|
|
||||||
|
T*
|
||||||
|
10 Tw % Adjust this to: 0, 50, etc
|
||||||
|
( ab ba abba) Tj
|
||||||
|
|
||||||
|
T*
|
||||||
|
0 Tw % Adjust this to: 0, 50, etc
|
||||||
|
( ab ba abba) Tj
|
||||||
|
ET
|
||||||
|
endstream
|
||||||
|
endobj
|
||||||
|
|
||||||
|
5 0 obj
|
||||||
|
<< /Type /Font
|
||||||
|
/Subtype /Type3
|
||||||
|
/FontBBox [ 0 0 750 750 ]
|
||||||
|
/FontMatrix [ 0.001 0 0 0.001 0 0 ]
|
||||||
|
/CharProcs 7 0 R
|
||||||
|
/Encoding 6 0 R
|
||||||
|
/FirstChar 97 % "a"
|
||||||
|
/LastChar 98 % "b"
|
||||||
|
/Widths [ 1000 1000 ]
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
|
||||||
|
6 0 obj
|
||||||
|
<< /Type /Encoding
|
||||||
|
/Differences [ 97 /square /triangle ]
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
|
||||||
|
7 0 obj
|
||||||
|
<< /square 8 0 R
|
||||||
|
/triangle 9 0 R
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
|
||||||
|
% Type 3 SQUARE glyph description = "a"
|
||||||
|
8 0 obj
|
||||||
|
<<
|
||||||
|
/Length 273
|
||||||
|
>>
|
||||||
|
stream
|
||||||
|
1000 0 0 0 750 750 d1 % NO explicit colour
|
||||||
|
50 w % Explicitly set line width as depend on it for stroking
|
||||||
|
[ 150 150 ] 0 d % Explicitly set dashing as depend on it for stroking
|
||||||
|
30 30 720 720 re S % Stroke (only) with inherited colour
|
||||||
|
endstream
|
||||||
|
endobj
|
||||||
|
|
||||||
|
% Type 3 TRIANGLE glyph description = "b"
|
||||||
|
9 0 obj
|
||||||
|
<<
|
||||||
|
/Length 316
|
||||||
|
>>
|
||||||
|
stream
|
||||||
|
1000 0 0 0 750 750 d1 % NO explicit colour
|
||||||
|
20 w % Explicitly set line width as depend on it for stroking
|
||||||
|
[ 100 100 ] 0 d % Explicitly set dashing as depend on it for stroking
|
||||||
|
20 20 m
|
||||||
|
350 730 l
|
||||||
|
730 20 l
|
||||||
|
b* % Close then Fill then Stroke with inherited colours
|
||||||
|
endstream
|
||||||
|
endobj
|
||||||
|
xref
|
||||||
|
0 10
|
||||||
|
0000000000 65535 f
|
||||||
|
0000000019 00000 n
|
||||||
|
0000000087 00000 n
|
||||||
|
0000000168 00000 n
|
||||||
|
0000000353 00000 n
|
||||||
|
0000001130 00000 n
|
||||||
|
0000001439 00000 n
|
||||||
|
0000001539 00000 n
|
||||||
|
0000001657 00000 n
|
||||||
|
0000002035 00000 n
|
||||||
|
trailer
|
||||||
|
<<
|
||||||
|
/Root 1 0 R
|
||||||
|
/Size 10
|
||||||
|
>>
|
||||||
|
startxref
|
||||||
|
2413
|
||||||
|
%%EOF
|
||||||
@ -2843,6 +2843,14 @@
|
|||||||
"lastPage": 1,
|
"lastPage": 1,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "Type3WordSpacing",
|
||||||
|
"file": "pdfs/Type3WordSpacing.pdf",
|
||||||
|
"md5": "8c75440e5b95cf521d186f862b404516",
|
||||||
|
"link": false,
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "issue13372",
|
"id": "issue13372",
|
||||||
"file": "pdfs/issue13372.pdf",
|
"file": "pdfs/issue13372.pdf",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user