[Pkg-javascript-commits] [pdf.js] 195/207: Fix another seac regression (issue 4801)
David Prévot
taffit at moszumanska.debian.org
Mon Jul 28 15:36:48 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit f13c217b25dec1350765cc63ad7bfa396280f65e
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date: Mon Jun 23 20:55:51 2014 +0200
Fix another seac regression (issue 4801)
---
src/core/fonts.js | 55 ++++++++++++++++++++++++++++++------------------
test/pdfs/.gitignore | 1 +
test/pdfs/issue4801.pdf | Bin 0 -> 8375 bytes
test/test_manifest.json | 7 ++++++
4 files changed, 42 insertions(+), 21 deletions(-)
diff --git a/src/core/fonts.js b/src/core/fonts.js
index daf6257..0930505 100644
--- a/src/core/fonts.js
+++ b/src/core/fonts.js
@@ -4110,18 +4110,28 @@ var Font = (function FontClosure() {
this.toFontChar = newMapping.toFontChar;
var numGlyphs = font.numGlyphs;
- function getCharCode(charCodeToGlyphId, glyphId, addMap) {
+ function getCharCodes(charCodeToGlyphId, glyphId) {
+ var charCodes = null;
for (var charCode in charCodeToGlyphId) {
if (glyphId === charCodeToGlyphId[charCode]) {
- return charCode | 0;
+ if (!charCodes) {
+ charCodes = [];
+ }
+ charCodes.push(charCode | 0);
}
}
- if (addMap) {
- newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] =
- glyphId;
- return newMapping.nextAvailableFontCharCode++;
+ return charCodes;
+ }
+
+ function createCharCode(charCodeToGlyphId, glyphId) {
+ for (var charCode in charCodeToGlyphId) {
+ if (glyphId === charCodeToGlyphId[charCode]) {
+ return charCode | 0;
+ }
}
- return null;
+ newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] =
+ glyphId;
+ return newMapping.nextAvailableFontCharCode++;
}
var seacs = font.seacs;
@@ -4144,24 +4154,27 @@ var Font = (function FontClosure() {
y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
};
- var charCode = getCharCode(mapping, glyphId);
- if (charCode === null) {
+ var charCodes = getCharCodes(mapping, glyphId);
+ if (!charCodes) {
// There's no point in mapping it if the char code was never mapped
// to begin with.
continue;
}
- // Find a fontCharCode that maps to the base and accent glyphs. If one
- // doesn't exists, create it.
- var charCodeToGlyphId = newMapping.charCodeToGlyphId;
- var baseFontCharCode = getCharCode(charCodeToGlyphId, baseGlyphId,
- true);
- var accentFontCharCode = getCharCode(charCodeToGlyphId, accentGlyphId,
- true);
- seacMap[charCode] = {
- baseFontCharCode: baseFontCharCode,
- accentFontCharCode: accentFontCharCode,
- accentOffset: accentOffset
- };
+ for (var i = 0, ii = charCodes.length; i < ii; i++) {
+ var charCode = charCodes[i];
+ // Find a fontCharCode that maps to the base and accent glyphs.
+ // If one doesn't exists, create it.
+ var charCodeToGlyphId = newMapping.charCodeToGlyphId;
+ var baseFontCharCode = createCharCode(charCodeToGlyphId,
+ baseGlyphId);
+ var accentFontCharCode = createCharCode(charCodeToGlyphId,
+ accentGlyphId);
+ seacMap[charCode] = {
+ baseFontCharCode: baseFontCharCode,
+ accentFontCharCode: accentFontCharCode,
+ accentOffset: accentOffset
+ };
+ }
}
properties.seacMap = seacMap;
}
diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore
index c44306c..ad85981 100644
--- a/test/pdfs/.gitignore
+++ b/test/pdfs/.gitignore
@@ -81,3 +81,4 @@
!issue4246.pdf
!issue4461.pdf
!issue4573.pdf
+!issue4801.pdf
diff --git a/test/pdfs/issue4801.pdf b/test/pdfs/issue4801.pdf
new file mode 100644
index 0000000..e82d5ba
Binary files /dev/null and b/test/pdfs/issue4801.pdf differ
diff --git a/test/test_manifest.json b/test/test_manifest.json
index 9c7496b..cc2ce05 100644
--- a/test/test_manifest.json
+++ b/test/test_manifest.json
@@ -547,6 +547,13 @@
"rounds": 1,
"type": "eq"
},
+ { "id": "issue4801",
+ "file": "pdfs/issue4801.pdf",
+ "md5": "7f32764717447a8b5c8eac08c9ab8380",
+ "link": false,
+ "rounds": 1,
+ "type": "eq"
+ },
{ "id": "glyph_accent",
"file": "pdfs/glyph_accent.pdf",
"md5": "1526e4edaa3ec439ebf156d0a0b385aa",
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list