Merge branch 'master' of https://github.com/andreasgal/pdf.js.git into imagecache
This commit is contained in:
commit
ec41fda318
10
fonts.js
10
fonts.js
@ -11,6 +11,7 @@ var kMaxWaitForFontFace = 1000;
|
|||||||
|
|
||||||
// Unicode Private Use Area
|
// Unicode Private Use Area
|
||||||
var kCmapGlyphOffset = 0xE000;
|
var kCmapGlyphOffset = 0xE000;
|
||||||
|
var kSizeOfGlyphArea = 0x1900;
|
||||||
|
|
||||||
// PDF Glyph Space Units are one Thousandth of a TextSpace Unit
|
// PDF Glyph Space Units are one Thousandth of a TextSpace Unit
|
||||||
// except for Type 3 fonts
|
// except for Type 3 fonts
|
||||||
@ -1217,18 +1218,21 @@ var Font = (function Font() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var encoding = properties.encoding, i;
|
var encoding = properties.encoding, i;
|
||||||
|
|
||||||
|
// offsetting glyphs to avoid problematic unicode ranges
|
||||||
for (i in encoding) {
|
for (i in encoding) {
|
||||||
if (encoding.hasOwnProperty(i)) {
|
if (encoding.hasOwnProperty(i)) {
|
||||||
var unicode = encoding[i].unicode;
|
var unicode = encoding[i].unicode;
|
||||||
if (unicode <= 0x1f || (unicode >= 127 && unicode <= 255))
|
if (unicode <= 0x1f ||
|
||||||
encoding[i].unicode = unicode += kCmapGlyphOffset;
|
(unicode >= 127 && unicode < kSizeOfGlyphArea))
|
||||||
|
encoding[i].unicode += kCmapGlyphOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var glyphs = [];
|
var glyphs = [];
|
||||||
for (i = 1; i < numGlyphs; i++) {
|
for (i = 1; i < numGlyphs; i++) {
|
||||||
glyphs.push({
|
glyphs.push({
|
||||||
unicode: i <= 0x1f || (i >= 127 && i <= 255) ?
|
unicode: i <= 0x1f || (i >= 127 && i < kSizeOfGlyphArea) ?
|
||||||
i + kCmapGlyphOffset : i
|
i + kCmapGlyphOffset : i
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
8
pdf.js
8
pdf.js
@ -5605,7 +5605,9 @@ var CanvasGraphics = (function canvasGraphics() {
|
|||||||
|
|
||||||
var bbox = stream.dict.get('BBox');
|
var bbox = stream.dict.get('BBox');
|
||||||
if (bbox && isArray(bbox) && 4 == bbox.length) {
|
if (bbox && isArray(bbox) && 4 == bbox.length) {
|
||||||
this.rectangle.apply(this, bbox);
|
var width = bbox[2] - bbox[0];
|
||||||
|
var height = bbox[3] - bbox[1];
|
||||||
|
this.rectangle(bbox[0], bbox[1], width, height);
|
||||||
this.clip();
|
this.clip();
|
||||||
this.endPath();
|
this.endPath();
|
||||||
}
|
}
|
||||||
@ -6360,7 +6362,9 @@ var TilingPattern = (function tilingPattern() {
|
|||||||
graphics.transform.apply(graphics, tmpTranslate);
|
graphics.transform.apply(graphics, tmpTranslate);
|
||||||
|
|
||||||
if (bbox && isArray(bbox) && 4 == bbox.length) {
|
if (bbox && isArray(bbox) && 4 == bbox.length) {
|
||||||
graphics.rectangle.apply(graphics, bbox);
|
var bboxWidth = bbox[2] - bbox[0];
|
||||||
|
var bboxHeight = bbox[3] - bbox[1];
|
||||||
|
graphics.rectangle(bbox[0], bbox[1], bboxWidth, bboxHeight);
|
||||||
graphics.clip();
|
graphics.clip();
|
||||||
graphics.endPath();
|
graphics.endPath();
|
||||||
}
|
}
|
||||||
|
BIN
test/pdfs/ThuluthFeatures.pdf
Executable file
BIN
test/pdfs/ThuluthFeatures.pdf
Executable file
Binary file not shown.
10
test/test.py
10
test/test.py
@ -435,9 +435,9 @@ def checkEq(task, results, browser, masterMode):
|
|||||||
# NB: this follows the format of Mozilla reftest
|
# NB: this follows the format of Mozilla reftest
|
||||||
# output so that we can reuse its reftest-analyzer
|
# output so that we can reuse its reftest-analyzer
|
||||||
# script
|
# script
|
||||||
print >>eqLog, 'REFTEST TEST-UNEXPECTED-FAIL |', browser +'-'+ taskId +'-page'+ str(page + 1), '| image comparison (==)'
|
eqLog.write('REFTEST TEST-UNEXPECTED-FAIL | ' + browser +'-'+ taskId +'-page'+ str(page + 1) + ' | image comparison (==)\n')
|
||||||
print >>eqLog, 'REFTEST IMAGE 1 (TEST):', snapshot
|
eqLog.write('REFTEST IMAGE 1 (TEST): ' + snapshot + '\n')
|
||||||
print >>eqLog, 'REFTEST IMAGE 2 (REFERENCE):', ref
|
eqLog.write('REFTEST IMAGE 2 (REFERENCE): ' + ref + '\n')
|
||||||
|
|
||||||
passed = False
|
passed = False
|
||||||
State.numEqFailures += 1
|
State.numEqFailures += 1
|
||||||
@ -457,7 +457,6 @@ def checkEq(task, results, browser, masterMode):
|
|||||||
if passed:
|
if passed:
|
||||||
print 'TEST-PASS | eq test', task['id'], '| in', browser
|
print 'TEST-PASS | eq test', task['id'], '| in', browser
|
||||||
|
|
||||||
|
|
||||||
def checkFBF(task, results, browser):
|
def checkFBF(task, results, browser):
|
||||||
round0, round1 = results[0], results[1]
|
round0, round1 = results[0], results[1]
|
||||||
assert len(round0) == len(round1)
|
assert len(round0) == len(round1)
|
||||||
@ -543,7 +542,8 @@ def runTests(options, browsers):
|
|||||||
teardownBrowsers(browsers)
|
teardownBrowsers(browsers)
|
||||||
t2 = time.time()
|
t2 = time.time()
|
||||||
print "Runtime was", int(t2 - t1), "seconds"
|
print "Runtime was", int(t2 - t1), "seconds"
|
||||||
|
if State.eqLog:
|
||||||
|
State.eqLog.close();
|
||||||
if options.masterMode:
|
if options.masterMode:
|
||||||
maybeUpdateRefImages(options, browsers[0])
|
maybeUpdateRefImages(options, browsers[0])
|
||||||
elif options.reftest and State.numEqFailures > 0:
|
elif options.reftest and State.numEqFailures > 0:
|
||||||
|
@ -69,6 +69,11 @@
|
|||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "load"
|
"type": "load"
|
||||||
},
|
},
|
||||||
|
{ "id": "thuluthfont-pdf",
|
||||||
|
"file": "pdfs/ThuluthFeatures.pdf",
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "wnv_chinese-pdf",
|
{ "id": "wnv_chinese-pdf",
|
||||||
"file": "pdfs/wnv_chinese.pdf",
|
"file": "pdfs/wnv_chinese.pdf",
|
||||||
"link": true,
|
"link": true,
|
||||||
|
Loading…
Reference in New Issue
Block a user