Merge pull request #7628 from Snuffleupagus/issue-7580
Fallback to the `StandardEncoding` for Nonsymbolic fonts without `/Encoding` entry (issue 7580)
This commit is contained in:
commit
451956c0b1
@ -1746,11 +1746,18 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||
if (baseEncodingName) {
|
||||
properties.defaultEncoding = getEncoding(baseEncodingName).slice();
|
||||
} else {
|
||||
encoding = (properties.type === 'TrueType' ?
|
||||
WinAnsiEncoding : StandardEncoding);
|
||||
var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
|
||||
var isNonsymbolicFont = !!(properties.flags & FontFlags.Nonsymbolic);
|
||||
// According to "Table 114" in section "9.6.6.1 General" (under
|
||||
// "9.6.6 Character Encoding") of the PDF specification, a Nonsymbolic
|
||||
// font should use the `StandardEncoding` if no encoding is specified.
|
||||
encoding = StandardEncoding;
|
||||
if (properties.type === 'TrueType' && !isNonsymbolicFont) {
|
||||
encoding = WinAnsiEncoding;
|
||||
}
|
||||
// The Symbolic attribute can be misused for regular fonts
|
||||
// Heuristic: we have to check if the font is a standard one also
|
||||
if (!!(properties.flags & FontFlags.Symbolic)) {
|
||||
if (isSymbolicFont) {
|
||||
encoding = MacRomanEncoding;
|
||||
if (!properties.file) {
|
||||
if (/Symbol/i.test(properties.name)) {
|
||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -38,6 +38,7 @@
|
||||
!issue7446.pdf
|
||||
!issue7492.pdf
|
||||
!issue7544.pdf
|
||||
!issue7580.pdf
|
||||
!issue7598.pdf
|
||||
!issue7665.pdf
|
||||
!issue7835.pdf
|
||||
|
85
test/pdfs/issue7580.pdf
Normal file
85
test/pdfs/issue7580.pdf
Normal file
@ -0,0 +1,85 @@
|
||||
%PDF-1.7
|
||||
%âãÏÓ
|
||||
1 0 obj
|
||||
<<
|
||||
/FontName /ArialMT
|
||||
/StemV 50
|
||||
/Ascent 0
|
||||
/Flags 32
|
||||
/Descent 0
|
||||
/ItalicAngle 0
|
||||
/FontBBox [-46 -210 980 728]
|
||||
/Type /FontDescriptor
|
||||
/CapHeight 0
|
||||
>>
|
||||
endobj
|
||||
2 0 obj
|
||||
<<
|
||||
/Pages 3 0 R
|
||||
/Type /Catalog
|
||||
>>
|
||||
endobj
|
||||
3 0 obj
|
||||
<<
|
||||
/MediaBox [0 0 200 50]
|
||||
/Kids [4 0 R]
|
||||
/Type /Pages
|
||||
/Count 1
|
||||
>>
|
||||
endobj
|
||||
4 0 obj
|
||||
<<
|
||||
/Parent 3 0 R
|
||||
/Resources
|
||||
<<
|
||||
/Font
|
||||
<<
|
||||
/F1 5 0 R
|
||||
>>
|
||||
>>
|
||||
/MediaBox [0 0 200 50]
|
||||
/Type /Page
|
||||
/Contents 6 0 R
|
||||
>>
|
||||
endobj
|
||||
5 0 obj
|
||||
<<
|
||||
/BaseFont /ArialMT
|
||||
/LastChar 249
|
||||
/Subtype /TrueType
|
||||
/FontDescriptor 1 0 R
|
||||
/Widths [278 0 0 0 0 0 0 0 0 0 0 584 278 333 278 278 556 556 556 556 556 556 556 556 556 556 278 0 0 0 0 0 1015 667 667 722 722 0 611 0 0 278 500 667 0 0 722 0 667 0 722 0 611 0 667 0 0 0 0 0 0 0 0 0 0 556 556 500 556 556 278 556 556 222 222 500 222 834 556 556 556 0 333 500 278 556 501 722 497 500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 889 0 0 0 0 0 0 0 611]
|
||||
/Type /Font
|
||||
/FirstChar 32
|
||||
>>
|
||||
endobj
|
||||
6 0 obj
|
||||
<<
|
||||
/Length 60
|
||||
>>
|
||||
stream
|
||||
BT
|
||||
10 20 TD
|
||||
/F1 18 Tf
|
||||
(Issue 7580: ae,\361 - o,\371.) Tj
|
||||
ET
|
||||
|
||||
endstream
|
||||
endobj xref
|
||||
0 7
|
||||
0000000000 65535 f
|
||||
0000000015 00000 n
|
||||
0000000177 00000 n
|
||||
0000000228 00000 n
|
||||
0000000310 00000 n
|
||||
0000000439 00000 n
|
||||
0000001123 00000 n
|
||||
trailer
|
||||
|
||||
<<
|
||||
/Root 2 0 R
|
||||
/Size 7
|
||||
>>
|
||||
startxref
|
||||
1235
|
||||
%%EOF
|
@ -1690,6 +1690,20 @@
|
||||
"link": false,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "issue7580-eq",
|
||||
"file": "pdfs/issue7580.pdf",
|
||||
"md5": "44dd5a9b4373fcab9890cf567722a766",
|
||||
"rounds": 1,
|
||||
"link": false,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "issue7580-text",
|
||||
"file": "pdfs/issue7580.pdf",
|
||||
"md5": "44dd5a9b4373fcab9890cf567722a766",
|
||||
"rounds": 1,
|
||||
"link": false,
|
||||
"type": "text"
|
||||
},
|
||||
{ "id": "issue6612-text",
|
||||
"file": "pdfs/issue6612.pdf",
|
||||
"md5": "657f33236496916597cd70ef1222509a",
|
||||
|
Loading…
x
Reference in New Issue
Block a user