Browse Source

Removes duplicate entries after reading cmap table

Yury Delendik 12 years ago
parent
commit
bb2570c9c1
  1. 12
      src/core/fonts.js
  2. 1
      test/pdfs/.gitignore
  3. BIN
      test/pdfs/issue3025.pdf
  4. 6
      test/test_manifest.json

12
src/core/fonts.js

@ -3077,6 +3077,17 @@ var Font = (function FontClosure() {
error('cmap table has unsupported format: ' + format); error('cmap table has unsupported format: ' + format);
} }
// removing duplicate entries
mappings.sort(function (a, b) {
return a.charcode - b.charcode;
});
for (var i = 1; i < mappings.length; i++) {
if (mappings[i - 1].charcode === mappings[i].charcode) {
mappings.splice(i, 1);
i--;
}
}
return { return {
platformId: potentialTable.platformId, platformId: potentialTable.platformId,
encodingId: potentialTable.encodingId, encodingId: potentialTable.encodingId,
@ -3758,7 +3769,6 @@ var Font = (function FontClosure() {
if (isTrueType) { if (isTrueType) {
var isGlyphLocationsLong = int16([tables.head.data[50], var isGlyphLocationsLong = int16([tables.head.data[50],
tables.head.data[51]]); tables.head.data[51]]);
sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs,
isGlyphLocationsLong, hintsValid, dupFirstEntry); isGlyphLocationsLong, hintsValid, dupFirstEntry);
} }

1
test/pdfs/.gitignore vendored

@ -50,6 +50,7 @@
!noembed-eucjp.pdf !noembed-eucjp.pdf
!noembed-sjis.pdf !noembed-sjis.pdf
!vertical.pdf !vertical.pdf
!issue3025.pdf
!issue2099-1.pdf !issue2099-1.pdf
!issue3371.pdf !issue3371.pdf
!issue2956.pdf !issue2956.pdf

BIN
test/pdfs/issue3025.pdf

Binary file not shown.

6
test/test_manifest.json

@ -1363,6 +1363,12 @@
"rounds": 1, "rounds": 1,
"type": "eq" "type": "eq"
}, },
{ "id": "issue3025",
"file": "pdfs/issue3025.pdf",
"md5": "8e4e8eacbd7c4c248deeca0ec49d38da",
"rounds": 1,
"type": "eq"
},
{ "id": "issue2177-eq", { "id": "issue2177-eq",
"file": "pdfs/issue2177.pdf", "file": "pdfs/issue2177.pdf",
"md5": "48a808278bf31de8414c4e03ecd0900a", "md5": "48a808278bf31de8414c4e03ecd0900a",

Loading…
Cancel
Save