Apply char spacing only when there are chars.

This commit is contained in:
Fabian Lange 2015-05-10 11:28:15 +02:00
parent 1a3310d537
commit c2013094e7
4 changed files with 93 additions and 2 deletions

View File

@ -1009,16 +1009,23 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
// var x = pt[0];
// var y = pt[1];
var charSpacing = 0;
if (textChunk.str.length > 0) {
// Apply char spacing only when there are chars.
// As a result there is only spacing between glyphs.
charSpacing = textState.charSpacing;
}
var tx = 0;
var ty = 0;
if (!font.vertical) {
var w0 = glyphWidth * textState.fontMatrix[0];
tx = (w0 * textState.fontSize + textState.charSpacing) *
tx = (w0 * textState.fontSize + charSpacing) *
textState.textHScale;
width += tx;
} else {
var w1 = glyphWidth * textState.fontMatrix[0];
ty = w1 * textState.fontSize + textState.charSpacing;
ty = w1 * textState.fontSize + charSpacing;
height += ty;
}
textState.translateTextMatrix(tx, ty);

View File

@ -6,6 +6,7 @@
!issue2391-1.pdf
!issue2391-2.pdf
!issue5801.pdf
!issue5972.pdf
!filled-background.pdf
!ArabicCIDTrueType.pdf
!ThuluthFeatures.pdf

76
test/pdfs/issue5972.pdf Normal file
View File

@ -0,0 +1,76 @@
%PDF-1.7
%âãÏÓ
1 0 obj
<<
/Type /Encoding
/BaseEncoding /WinAnsiEncoding
>>
endobj
2 0 obj
<<
/Pages 3 0 R
/Type /Catalog
>>
endobj
3 0 obj
<<
/MediaBox [0 0 200 50]
/Kids [4 0 R]
/Count 1
/Type /Pages
>>
endobj
4 0 obj
<<
/Parent 3 0 R
/MediaBox [0 0 200 50]
/Resources
<<
/Font
<<
/F1 5 0 R
>>
>>
/Contents 6 0 R
/Type /Page
>>
endobj
5 0 obj
<<
/BaseFont /Times-Italic
/Subtype /Type1
/Encoding 1 0 R
/Type /Font
>>
endobj
6 0 obj
<<
/Length 73
>>
stream
BT
10 15 TD
/F1 40 Tf
-8 Tc
[ (f) 20 (ore) 15 (w) 20 (or) 20 (d) ] TJ
ET
endstream
endobj xref
0 7
0000000000 65535 f
0000000015 00000 n
0000000085 00000 n
0000000136 00000 n
0000000218 00000 n
0000000347 00000 n
0000000438 00000 n
trailer
<<
/Root 2 0 R
/Size 7
>>
startxref
563
%%EOF

View File

@ -1095,6 +1095,13 @@
"link": false,
"type": "eq"
},
{ "id": "issue5972",
"file": "pdfs/issue5972.pdf",
"md5": "51f03e1d38410b04c9dda7e75fe8a0a3",
"rounds": 1,
"link": false,
"type": "text"
},
{ "id": "pdfkit_compressed",
"file": "pdfs/pdfkit_compressed.pdf",
"md5": "ffe9c571d0a1572e234253e6c7cdee6c",