Merge branch 'master' of https://github.com/andreasgal/pdf.js.git into liveprog
This commit is contained in:
commit
511177576c
18
Makefile
18
Makefile
@ -3,6 +3,9 @@ BUILD_DIR := build
|
|||||||
DEFAULT_BROWSERS := resources/browser_manifests/browser_manifest.json
|
DEFAULT_BROWSERS := resources/browser_manifests/browser_manifest.json
|
||||||
DEFAULT_TESTS := test_manifest.json
|
DEFAULT_TESTS := test_manifest.json
|
||||||
|
|
||||||
|
EXTENSION_SRC := ./extensions/firefox
|
||||||
|
EXTENSION_NAME := pdf.js.xpi
|
||||||
|
|
||||||
# Let folks define custom rules for their clones.
|
# Let folks define custom rules for their clones.
|
||||||
-include local.mk
|
-include local.mk
|
||||||
|
|
||||||
@ -103,14 +106,17 @@ lint:
|
|||||||
# TODO: Use the Closure compiler to optimize the pdf.js files.
|
# TODO: Use the Closure compiler to optimize the pdf.js files.
|
||||||
#
|
#
|
||||||
GH_PAGES = $(BUILD_DIR)/gh-pages
|
GH_PAGES = $(BUILD_DIR)/gh-pages
|
||||||
web: | compiler pages-repo \
|
web: | extension compiler pages-repo \
|
||||||
$(addprefix $(GH_PAGES)/, $(PDF_JS_FILES)) \
|
$(addprefix $(GH_PAGES)/, $(PDF_JS_FILES)) \
|
||||||
$(addprefix $(GH_PAGES)/, $(wildcard web/*.*)) \
|
$(addprefix $(GH_PAGES)/, $(wildcard web/*.*)) \
|
||||||
$(addprefix $(GH_PAGES)/, $(wildcard web/images/*.*))
|
$(addprefix $(GH_PAGES)/, $(wildcard web/images/*.*)) \
|
||||||
|
$(addprefix $(GH_PAGES)/, $(wildcard $(EXTENSION_SRC)/*.xpi))
|
||||||
|
|
||||||
@cp $(GH_PAGES)/web/index.html.template $(GH_PAGES)/index.html;
|
@cp $(GH_PAGES)/web/index.html.template $(GH_PAGES)/index.html;
|
||||||
@cd $(GH_PAGES); git add -A;
|
@cd $(GH_PAGES); git add -A;
|
||||||
|
@echo
|
||||||
@echo "Website built in $(GH_PAGES)."
|
@echo "Website built in $(GH_PAGES)."
|
||||||
|
@echo "Don't forget to cd into $(GH_PAGES)/ and issue 'git commit' to push changes."
|
||||||
|
|
||||||
# make pages-repo
|
# make pages-repo
|
||||||
#
|
#
|
||||||
@ -126,6 +132,7 @@ pages-repo: | $(BUILD_DIR)
|
|||||||
fi;
|
fi;
|
||||||
@mkdir -p $(GH_PAGES)/web;
|
@mkdir -p $(GH_PAGES)/web;
|
||||||
@mkdir -p $(GH_PAGES)/web/images;
|
@mkdir -p $(GH_PAGES)/web/images;
|
||||||
|
@mkdir -p $(GH_PAGES)/$(EXTENSION_SRC);
|
||||||
|
|
||||||
$(GH_PAGES)/%.js: %.js
|
$(GH_PAGES)/%.js: %.js
|
||||||
@cp $< $@
|
@cp $< $@
|
||||||
@ -136,6 +143,9 @@ $(GH_PAGES)/web/%: web/%
|
|||||||
$(GH_PAGES)/web/images/%: web/images/%
|
$(GH_PAGES)/web/images/%: web/images/%
|
||||||
@cp $< $@
|
@cp $< $@
|
||||||
|
|
||||||
|
$(GH_PAGES)/$(EXTENSION_SRC)/%: $(EXTENSION_SRC)/%
|
||||||
|
@cp -R $< $@
|
||||||
|
|
||||||
# # make compiler
|
# # make compiler
|
||||||
# #
|
# #
|
||||||
# # This target downloads the Closure compiler, and places it in the
|
# # This target downloads the Closure compiler, and places it in the
|
||||||
@ -149,13 +159,11 @@ $(GH_PAGES)/web/images/%: web/images/%
|
|||||||
# curl $(COMPILER_URL) > $(BUILD_DIR)/compiler.zip;
|
# curl $(COMPILER_URL) > $(BUILD_DIR)/compiler.zip;
|
||||||
# cd $(BUILD_DIR); unzip compiler.zip compiler.jar;
|
# cd $(BUILD_DIR); unzip compiler.zip compiler.jar;
|
||||||
|
|
||||||
# make firefox-extension
|
# make extension
|
||||||
#
|
#
|
||||||
# This target produce a restartless firefox extension containing a
|
# This target produce a restartless firefox extension containing a
|
||||||
# copy of the pdf.js source.
|
# copy of the pdf.js source.
|
||||||
CONTENT_DIR := content
|
CONTENT_DIR := content
|
||||||
EXTENSION_SRC := ./extensions/firefox
|
|
||||||
EXTENSION_NAME := pdf.js.xpi
|
|
||||||
PDF_WEB_FILES = \
|
PDF_WEB_FILES = \
|
||||||
web/images \
|
web/images \
|
||||||
web/compatibility.js \
|
web/compatibility.js \
|
||||||
|
92
fonts.js
92
fonts.js
@ -26,53 +26,53 @@ var kHintingEnabled = false;
|
|||||||
*/
|
*/
|
||||||
var stdFontMap = {
|
var stdFontMap = {
|
||||||
'ArialNarrow': 'Helvetica',
|
'ArialNarrow': 'Helvetica',
|
||||||
'ArialNarrow_Bold': 'Helvetica-Bold',
|
'ArialNarrow-Bold': 'Helvetica-Bold',
|
||||||
'ArialNarrow_BoldItalic': 'Helvetica-BoldOblique',
|
'ArialNarrow-BoldItalic': 'Helvetica-BoldOblique',
|
||||||
'ArialNarrow_Italic': 'Helvetica-Oblique',
|
'ArialNarrow-Italic': 'Helvetica-Oblique',
|
||||||
'ArialBlack': 'Helvetica',
|
'ArialBlack': 'Helvetica',
|
||||||
'ArialBlack_Bold': 'Helvetica-Bold',
|
'ArialBlack-Bold': 'Helvetica-Bold',
|
||||||
'ArialBlack_BoldItalic': 'Helvetica-BoldOblique',
|
'ArialBlack-BoldItalic': 'Helvetica-BoldOblique',
|
||||||
'ArialBlack_Italic': 'Helvetica-Oblique',
|
'ArialBlack-Italic': 'Helvetica-Oblique',
|
||||||
'Arial': 'Helvetica',
|
'Arial': 'Helvetica',
|
||||||
'Arial_Bold': 'Helvetica-Bold',
|
'Arial-Bold': 'Helvetica-Bold',
|
||||||
'Arial_BoldItalic': 'Helvetica-BoldOblique',
|
'Arial-BoldItalic': 'Helvetica-BoldOblique',
|
||||||
'Arial_Italic': 'Helvetica-Oblique',
|
'Arial-Italic': 'Helvetica-Oblique',
|
||||||
'Arial_BoldItalicMT': 'Helvetica-BoldOblique',
|
'Arial-BoldItalicMT': 'Helvetica-BoldOblique',
|
||||||
'Arial_BoldMT': 'Helvetica-Bold',
|
'Arial-BoldMT': 'Helvetica-Bold',
|
||||||
'Arial_ItalicMT': 'Helvetica-Oblique',
|
'Arial-ItalicMT': 'Helvetica-Oblique',
|
||||||
'ArialMT': 'Helvetica',
|
'ArialMT': 'Helvetica',
|
||||||
'Courier_Bold': 'Courier-Bold',
|
'Courier-Bold': 'Courier-Bold',
|
||||||
'Courier_BoldItalic': 'Courier-BoldOblique',
|
'Courier-BoldItalic': 'Courier-BoldOblique',
|
||||||
'Courier_Italic': 'Courier-Oblique',
|
'Courier-Italic': 'Courier-Oblique',
|
||||||
'CourierNew': 'Courier',
|
'CourierNew': 'Courier',
|
||||||
'CourierNew_Bold': 'Courier-Bold',
|
'CourierNew-Bold': 'Courier-Bold',
|
||||||
'CourierNew_BoldItalic': 'Courier-BoldOblique',
|
'CourierNew-BoldItalic': 'Courier-BoldOblique',
|
||||||
'CourierNew_Italic': 'Courier-Oblique',
|
'CourierNew-Italic': 'Courier-Oblique',
|
||||||
'CourierNewPS_BoldItalicMT': 'Courier-BoldOblique',
|
'CourierNewPS-BoldItalicMT': 'Courier-BoldOblique',
|
||||||
'CourierNewPS_BoldMT': 'Courier-Bold',
|
'CourierNewPS-BoldMT': 'Courier-Bold',
|
||||||
'CourierNewPS_ItalicMT': 'Courier-Oblique',
|
'CourierNewPS-ItalicMT': 'Courier-Oblique',
|
||||||
'CourierNewPSMT': 'Courier',
|
'CourierNewPSMT': 'Courier',
|
||||||
'Helvetica_Bold': 'Helvetica-Bold',
|
'Helvetica-Bold': 'Helvetica-Bold',
|
||||||
'Helvetica_BoldItalic': 'Helvetica-BoldOblique',
|
'Helvetica-BoldItalic': 'Helvetica-BoldOblique',
|
||||||
'Helvetica_Italic': 'Helvetica-Oblique',
|
'Helvetica-Italic': 'Helvetica-Oblique',
|
||||||
'Symbol_Bold': 'Symbol',
|
'Symbol-Bold': 'Symbol',
|
||||||
'Symbol_BoldItalic': 'Symbol',
|
'Symbol-BoldItalic': 'Symbol',
|
||||||
'Symbol_Italic': 'Symbol',
|
'Symbol-Italic': 'Symbol',
|
||||||
'TimesNewRoman': 'Times-Roman',
|
'TimesNewRoman': 'Times-Roman',
|
||||||
'TimesNewRoman_Bold': 'Times-Bold',
|
'TimesNewRoman-Bold': 'Times-Bold',
|
||||||
'TimesNewRoman_BoldItalic': 'Times-BoldItalic',
|
'TimesNewRoman-BoldItalic': 'Times-BoldItalic',
|
||||||
'TimesNewRoman_Italic': 'Times-Italic',
|
'TimesNewRoman-Italic': 'Times-Italic',
|
||||||
'TimesNewRomanPS': 'Times-Roman',
|
'TimesNewRomanPS': 'Times-Roman',
|
||||||
'TimesNewRomanPS_Bold': 'Times-Bold',
|
'TimesNewRomanPS-Bold': 'Times-Bold',
|
||||||
'TimesNewRomanPS_BoldItalic': 'Times-BoldItalic',
|
'TimesNewRomanPS-BoldItalic': 'Times-BoldItalic',
|
||||||
'TimesNewRomanPS_BoldItalicMT': 'Times-BoldItalic',
|
'TimesNewRomanPS-BoldItalicMT': 'Times-BoldItalic',
|
||||||
'TimesNewRomanPS_BoldMT': 'Times-Bold',
|
'TimesNewRomanPS-BoldMT': 'Times-Bold',
|
||||||
'TimesNewRomanPS_Italic': 'Times-Italic',
|
'TimesNewRomanPS-Italic': 'Times-Italic',
|
||||||
'TimesNewRomanPS_ItalicMT': 'Times-Italic',
|
'TimesNewRomanPS-ItalicMT': 'Times-Italic',
|
||||||
'TimesNewRomanPSMT': 'Times-Roman',
|
'TimesNewRomanPSMT': 'Times-Roman',
|
||||||
'TimesNewRomanPSMT_Bold': 'Times-Bold',
|
'TimesNewRomanPSMT-Bold': 'Times-Bold',
|
||||||
'TimesNewRomanPSMT_BoldItalic': 'Times-BoldItalic',
|
'TimesNewRomanPSMT-BoldItalic': 'Times-BoldItalic',
|
||||||
'TimesNewRomanPSMT_Italic': 'Times-Italic'
|
'TimesNewRomanPSMT-Italic': 'Times-Italic'
|
||||||
};
|
};
|
||||||
|
|
||||||
var serifFonts = {
|
var serifFonts = {
|
||||||
@ -441,7 +441,9 @@ var Font = (function Font() {
|
|||||||
if (!file) {
|
if (!file) {
|
||||||
// The file data is not specified. Trying to fix the font name
|
// The file data is not specified. Trying to fix the font name
|
||||||
// to be used with the canvas.font.
|
// to be used with the canvas.font.
|
||||||
var fontName = stdFontMap[name] || name.replace('_', '-');
|
var fontName = name.replace(/,_/g, '-');
|
||||||
|
fontName = stdFontMap[fontName] || fontName;
|
||||||
|
|
||||||
this.bold = (fontName.search(/bold/gi) != -1);
|
this.bold = (fontName.search(/bold/gi) != -1);
|
||||||
this.italic = (fontName.search(/oblique/gi) != -1) ||
|
this.italic = (fontName.search(/oblique/gi) != -1) ||
|
||||||
(fontName.search(/italic/gi) != -1);
|
(fontName.search(/italic/gi) != -1);
|
||||||
@ -2890,7 +2892,15 @@ var Type2CFF = (function type2CFF() {
|
|||||||
if (b <= 21) {
|
if (b <= 21) {
|
||||||
if (b === 12) {
|
if (b === 12) {
|
||||||
++pos;
|
++pos;
|
||||||
var b = (b << 8) | dict[pos];
|
var op = dict[pos];
|
||||||
|
if ((op > 14 && op < 17) ||
|
||||||
|
(op > 23 && op < 30) || op > 38) {
|
||||||
|
warn('Invalid CFF dictionary key: ' + op);
|
||||||
|
// trying to replace it with initialRandomSeed
|
||||||
|
// to pass sanitizer
|
||||||
|
dict[pos] = 19;
|
||||||
|
}
|
||||||
|
var b = (b << 8) | op;
|
||||||
}
|
}
|
||||||
entries.push([b, operands]);
|
entries.push([b, operands]);
|
||||||
operands = [];
|
operands = [];
|
||||||
|
6
pdf.js
6
pdf.js
@ -4791,7 +4791,7 @@ var PartialEvaluator = (function partialEvaluator() {
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
// Using base font name as a font name.
|
// Using base font name as a font name.
|
||||||
baseFontName = baseFontName.name.replace(/,/g, '_');
|
baseFontName = baseFontName.name.replace(/,_/g, '-');
|
||||||
var metricsAndMap = this.getBaseFontMetricsAndMap(baseFontName);
|
var metricsAndMap = this.getBaseFontMetricsAndMap(baseFontName);
|
||||||
|
|
||||||
var properties = {
|
var properties = {
|
||||||
@ -6805,11 +6805,11 @@ var PDFFunction = (function pdfFunction() {
|
|||||||
diff.push(c1[i] - c0[i]);
|
diff.push(c1[i] - c0[i]);
|
||||||
|
|
||||||
this.func = function pdfFunctionConstructInterpolatedFunc(args) {
|
this.func = function pdfFunctionConstructInterpolatedFunc(args) {
|
||||||
var x = args[0];
|
var x = n == 1 ? args[0] : Math.pow(args[0], n);
|
||||||
|
|
||||||
var out = [];
|
var out = [];
|
||||||
for (var j = 0; j < length; ++j)
|
for (var j = 0; j < length; ++j)
|
||||||
out.push(c0[j] + (x^n * diff[i]));
|
out.push(c0[j] + (x * diff[j]));
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
};
|
};
|
||||||
|
@ -178,7 +178,7 @@ function snapshotCurrentPage(task, failure) {
|
|||||||
function sendQuitRequest() {
|
function sendQuitRequest() {
|
||||||
var r = new XMLHttpRequest();
|
var r = new XMLHttpRequest();
|
||||||
r.open('POST', '/tellMeToQuit?path=' + escape(appPath), false);
|
r.open('POST', '/tellMeToQuit?path=' + escape(appPath), false);
|
||||||
r.send('');
|
r.send(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
function quitApp() {
|
function quitApp() {
|
||||||
|
1
test/pdfs/pal-o47.pdf.link
Normal file
1
test/pdfs/pal-o47.pdf.link
Normal file
@ -0,0 +1 @@
|
|||||||
|
http://www1.cpdl.org/wiki/images/sheet/pal-o47.pdf
|
@ -199,6 +199,12 @@
|
|||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "pal-o47",
|
||||||
|
"file": "pdfs/pal-o47.pdf",
|
||||||
|
"link": true,
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "simpletype3font",
|
{ "id": "simpletype3font",
|
||||||
"file": "pdfs/simpletype3font.pdf",
|
"file": "pdfs/simpletype3font.pdf",
|
||||||
"link": false,
|
"link": false,
|
||||||
|
@ -1,21 +1,27 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>pdf.js test slave</title>
|
<title>pdf.js test slave</title>
|
||||||
<style type="text/css"></style>
|
<style type="text/css"></style>
|
||||||
<script type="text/javascript" src="/pdf.js"></script>
|
<script type="text/javascript" src="/pdf.js"></script>
|
||||||
<script type="text/javascript" src="/fonts.js"></script>
|
<script type="text/javascript" src="/fonts.js"></script>
|
||||||
<script type="text/javascript" src="/crypto.js"></script>
|
<script type="text/javascript" src="/crypto.js"></script>
|
||||||
<script type="text/javascript" src="/glyphlist.js"></script>
|
<script type="text/javascript" src="/glyphlist.js"></script>
|
||||||
<script type="text/javascript" src="/metrics.js"></script>
|
<script type="text/javascript" src="/metrics.js"></script>
|
||||||
<script type="text/javascript" src="/charsets.js"></script>
|
<script type="text/javascript" src="/charsets.js"></script>
|
||||||
<script type="text/javascript" src="/cidmaps.js"></script>
|
<script type="text/javascript" src="/cidmaps.js"></script>
|
||||||
<script type="text/javascript" src="driver.js"></script>
|
<script type="text/javascript" src="driver.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body onload="load();">
|
<body>
|
||||||
<pre style="width:800; height:800; overflow: scroll;"id="stdout"></pre>
|
<pre style="width:800px; height:800px; overflow:scroll;" id="stdout"></pre>
|
||||||
<p>Inflight requests: <span id="inFlightCount"></span></p>
|
<p>Inflight requests: <span id="inFlightCount"></span></p>
|
||||||
<div id="content-end"><!-- cleanup() guard --></div>
|
<div id="content-end"></div>
|
||||||
</body>
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
'use strict';
|
||||||
|
load();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user