Merge pull request #6425 from Snuffleupagus/issue-6410
Only choose a (3, 1) cmap table for TrueType fonts that have an encoding specified (issue 6410)
This commit is contained in:
commit
ded4f317b8
@ -3222,7 +3222,7 @@ var Font = (function FontClosure() {
|
|||||||
* Read the appropriate subtable from the cmap according to 9.6.6.4 from
|
* Read the appropriate subtable from the cmap according to 9.6.6.4 from
|
||||||
* PDF spec
|
* PDF spec
|
||||||
*/
|
*/
|
||||||
function readCmapTable(cmap, font, isSymbolicFont) {
|
function readCmapTable(cmap, font, isSymbolicFont, hasEncoding) {
|
||||||
var segment;
|
var segment;
|
||||||
var start = (font.start ? font.start : 0) + cmap.offset;
|
var start = (font.start ? font.start : 0) + cmap.offset;
|
||||||
font.pos = start;
|
font.pos = start;
|
||||||
@ -3253,7 +3253,7 @@ var Font = (function FontClosure() {
|
|||||||
// Continue the loop since there still may be a higher priority
|
// Continue the loop since there still may be a higher priority
|
||||||
// table.
|
// table.
|
||||||
} else if (platformId === 3 && encodingId === 1 &&
|
} else if (platformId === 3 && encodingId === 1 &&
|
||||||
(!isSymbolicFont || !potentialTable)) {
|
((!isSymbolicFont && hasEncoding) || !potentialTable)) {
|
||||||
useTable = true;
|
useTable = true;
|
||||||
if (!isSymbolicFont) {
|
if (!isSymbolicFont) {
|
||||||
canBreak = true;
|
canBreak = true;
|
||||||
@ -4202,13 +4202,14 @@ var Font = (function FontClosure() {
|
|||||||
} else {
|
} else {
|
||||||
// Most of the following logic in this code branch is based on the
|
// Most of the following logic in this code branch is based on the
|
||||||
// 9.6.6.4 of the PDF spec.
|
// 9.6.6.4 of the PDF spec.
|
||||||
var cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont);
|
var hasEncoding =
|
||||||
|
properties.differences.length > 0 || !!properties.baseEncodingName;
|
||||||
|
var cmapTable =
|
||||||
|
readCmapTable(tables.cmap, font, this.isSymbolicFont, hasEncoding);
|
||||||
var cmapPlatformId = cmapTable.platformId;
|
var cmapPlatformId = cmapTable.platformId;
|
||||||
var cmapEncodingId = cmapTable.encodingId;
|
var cmapEncodingId = cmapTable.encodingId;
|
||||||
var cmapMappings = cmapTable.mappings;
|
var cmapMappings = cmapTable.mappings;
|
||||||
var cmapMappingsLength = cmapMappings.length;
|
var cmapMappingsLength = cmapMappings.length;
|
||||||
var hasEncoding = properties.differences.length ||
|
|
||||||
!!properties.baseEncodingName;
|
|
||||||
|
|
||||||
// The spec seems to imply that if the font is symbolic the encoding
|
// The spec seems to imply that if the font is symbolic the encoding
|
||||||
// should be ignored, this doesn't appear to work for 'preistabelle.pdf'
|
// should be ignored, this doesn't appear to work for 'preistabelle.pdf'
|
||||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -98,6 +98,7 @@
|
|||||||
!issue5747.pdf
|
!issue5747.pdf
|
||||||
!issue6099.pdf
|
!issue6099.pdf
|
||||||
!issue6336.pdf
|
!issue6336.pdf
|
||||||
|
!issue6410.pdf
|
||||||
!gradientfill.pdf
|
!gradientfill.pdf
|
||||||
!bug903856.pdf
|
!bug903856.pdf
|
||||||
!bug850854.pdf
|
!bug850854.pdf
|
||||||
|
BIN
test/pdfs/issue6410.pdf
Normal file
BIN
test/pdfs/issue6410.pdf
Normal file
Binary file not shown.
@ -1086,6 +1086,13 @@
|
|||||||
"link": true,
|
"link": true,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "issue6410",
|
||||||
|
"file": "pdfs/issue6410.pdf",
|
||||||
|
"md5": "fd5c5898d5b9754bb546724b7d31bf59",
|
||||||
|
"rounds": 1,
|
||||||
|
"link": false,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "issue6413",
|
{ "id": "issue6413",
|
||||||
"file": "pdfs/issue6413.pdf",
|
"file": "pdfs/issue6413.pdf",
|
||||||
"md5": "08926ac7a46e27a4abbb31256b3a7b29",
|
"md5": "08926ac7a46e27a4abbb31256b3a7b29",
|
||||||
|
Loading…
Reference in New Issue
Block a user