]> git.parisson.com Git - pdf.js.git/commitdiff
Progress
authorArtur Adib <arturadib@gmail.com>
Tue, 25 Oct 2011 16:10:56 +0000 (09:10 -0700)
committerArtur Adib <arturadib@gmail.com>
Tue, 25 Oct 2011 16:10:56 +0000 (09:10 -0700)
19 files changed:
Makefile
src/canvas.js
src/charsets.js
src/cidmaps.js
src/core.js
src/crypto.js
src/fonts.js
src/glyphlist.js
src/metrics.js
src/pattern.js
src/pdf.js
src/utils/cffStandardStrings.js
src/utils/fonts_utils.js
src/worker/console.js
src/worker/message_handler.js
src/worker/processor_handler.js
test/test.py
test/test_slave.html
web/viewer.html

index 9e7c36a8b9e715dac0cd5d5cf3953d52eee2ca9e..46cddc13b8395ac281e9b4194ae1fe98e95924e7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -41,6 +41,15 @@ PDF_WORKER_FILES = \
        worker/processor_handler.js \
        $(NULL) 
 
+# make server
+#
+# This target starts a local web server at localhost:8888. This can be
+# used for testing all browsers.
+server:
+       @cd test; python test.py --port=8888;
+
+test: pdfjs shell-test browser-test
+
 #
 # Bundle pdf.js
 #
@@ -53,22 +62,6 @@ pdfjs:
        rm -f all_files.tmp; \
        cd ..
 
-#
-# Watch for file changes, regenerate pdf.js if change found
-#
-watch:
-       @echo "Watching for file changes in src/"
-       @python watch.py src/*.js - 'make pdfjs'
-
-# make server
-#
-# This target starts a local web server at localhost:8888. This can be
-# used for testing all browsers.
-server:
-       @cd test; python test.py --port=8888;
-
-test: shell-test browser-test
-
 # make browser-test
 #
 # This target runs in-browser tests using two primary arguments: a
@@ -240,5 +233,12 @@ clean:
 help:
        @echo "Read the comments in the Makefile for guidance.";
 
-.PHONY:: all test browser-test font-test shell-test \
+#
+# Watch for file changes, regenerate pdf.js if change found
+#
+watch:
+       @echo "Watching for file changes in src/"
+       @python watch.py src/*.js - 'make pdfjs'
+
+.PHONY:: all pdfjs watch test browser-test font-test shell-test \
        shell-msg lint clean web compiler help server
index f8b3a6d8714cbf220a13fe74d16ad29351c65bff..4139f29ba9cfb6dee10a8af16df77a8a139db51b 100644 (file)
@@ -558,7 +558,7 @@ var CanvasGraphics = (function canvasGraphics() {
           color = base.getRgb(color);
         }
         var pattern = new TilingPattern(IR, color, this.ctx, this.objs);
-      } else if (IR[0] == 'RadialAxialShading' || IR[0] == 'DummyShading') {
+      } else if (IR[0] == 'RadialAxial' || IR[0] == 'Dummy') {
         var pattern = Pattern.shadingFromIR(this.ctx, IR);
       } else {
         throw 'Unkown IR type';
index 7f54ab32753156dffacc855c9c4a00b87646db1f..21554d769eed85cab665bdb2dcf46663e2dc8eb8 100644 (file)
@@ -1,8 +1,6 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
 
-'use strict';
-
 var ISOAdobeCharset = [
   '.notdef', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar',
   'percent', 'ampersand', 'quoteright', 'parenleft', 'parenright',
index 7de3d14f6d46e346271292692bacf88f699d443b..9efb3669efb510103775dc3c4d8534e4a43207b6 100644 (file)
@@ -1,8 +1,6 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
 
-'use strict';
-
 var CIDToUnicodeMaps = {
   'Adobe-Japan1': [[32, 160], {f: 12, c: 33}, [45, 8209], {f: 46, c: 46}, 165,
     {f: 2, c: 93}, [95, 818], [96, 768], {f: 27, c: 97}, 166, 125, [732, 771],
index 05cd8cd32441106185f23460acf24e29ae13b490..b969392cab568ae649fe50f4ae3588f9c4e00511 100644 (file)
@@ -1,8 +1,6 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
 
-'use strict';
-
 var ERRORS = 0, WARNINGS = 1, TODOS = 5;
 var verbosity = WARNINGS;
 
index 5699ea1df9eaca6b7b39196a6b93ddce305f3af3..7721556b4b1ec49c99a4af88ea2d54a96eb62bc2 100644 (file)
@@ -1,8 +1,6 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
 
-'use strict';
-
 var ARCFourCipher = (function arcFourCipher() {
   function constructor(key) {
     this.a = 0;
index 9dc088f6c2c35022d2a23fe7f80c5ba70cc113d0..56e2fc1b0b4d1798d18d05610e6868e84c80a3bb 100644 (file)
@@ -1,7 +1,6 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
 
-'use strict';
 var isWorker = (typeof window == 'undefined');
 
 /**
index 5691f85461ea9dfb2aa64c485bfc20b92f87f870..d81d4c138101d91b3ad44abb2325979c0c1e99b6 100644 (file)
@@ -1,8 +1,6 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
 
-'use strict';
-
 var GlyphsUnicode = {
   A: 0x0041,
   AE: 0x00C6,
index d4d07ec0d036230411419e69d0094cf1d0c7f5f9..9cb8eb0e61e7a2c5109351192f7b6290b6f81ced 100644 (file)
@@ -1,8 +1,6 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
 
-'use strict';
-
 var Metrics = {
   'Courier': 600,
   'Courier-Bold': 600,
index a5c917db702f142319ce354d963aefc085890848..dcfe783797410c2b87db2f4af4d663087fcacc46 100644 (file)
@@ -13,8 +13,7 @@ var Pattern = (function patternPattern() {
   };
 
   constructor.shadingFromIR = function pattern_shadingFromIR(ctx, raw) {
-    var obj = window[raw[0]];
-    return obj.fromIR(ctx, raw);
+    return Shadings[raw[0]].fromIR(ctx, raw);
   }
 
   constructor.parseShading = function pattern_shading(shading, matrix,
@@ -27,34 +26,19 @@ var Pattern = (function patternPattern() {
       case 2:
       case 3:
         // both radial and axial shadings are handled by RadialAxial shading
-        return new RadialAxialShading(dict, matrix, xref, res, ctx);
+        return new Shadings.RadialAxial(dict, matrix, xref, res, ctx);
       default:
-        return new DummyShading();
+        return new Shadings.Dummy();
     }
   };
   return constructor;
 })();
 
-var DummyShading = (function dummyShading() {
-  function constructor() {
-    this.type = 'Pattern';
-  }
-
-  constructor.fromIR = function() {
-    return 'hotpink';
-  }
-
-  constructor.prototype = {
-    getIR: function dummpy_getir() {
-      return ['DummyShading'];
-    }
-  };
-  return constructor;
-})();
+var Shadings = {};
 
 // Radial and axial shading have very similar implementations
 // If needed, the implementations can be broken into two classes
-var RadialAxialShading = (function radialAxialShading() {
+Shadings.RadialAxial = (function radialAxialShading() {
   function constructor(dict, matrix, xref, res, ctx) {
     this.matrix = matrix;
     this.coordsArr = dict.get('Coords');
@@ -163,13 +147,30 @@ var RadialAxialShading = (function radialAxialShading() {
         p1 = Util.applyTransform(p1, matrix);
       }
 
-      return ['RadialAxialShading', type, this.colorStops, p0, p1, r0, r1];
+      return ['RadialAxial', type, this.colorStops, p0, p1, r0, r1];
     }
   };
 
   return constructor;
 })();
 
+Shadings.Dummy = (function dummyShading() {
+  function constructor() {
+    this.type = 'Pattern';
+  }
+
+  constructor.fromIR = function() {
+    return 'hotpink';
+  }
+
+  constructor.prototype = {
+    getIR: function dummpy_getir() {
+      return ['Dummy'];
+    }
+  };
+  return constructor;
+})();
+
 var TilingPattern = (function tilingPattern() {
   var PAINT_TYPE_COLORED = 1, PAINT_TYPE_UNCOLORED = 2;
 
index ba721d0b5218190bec1e3e8e3f182cf5fb59077d..9970f9067a6f8efec26936b4f6c78e673e0385ff 100644 (file)
@@ -4,18 +4,15 @@
 // // TODO: Global namespace
 // var PDF = {};
 
-// Stay away from global
 (function(){
-
+  // Use strict in our context only - users might not want it
   'use strict';
 
-  // All files will be inserted below this point
-  // INSERT_POINT
+  // Files are inserted below - see Makefile  
+  /* INSERT_POINT */
 
-  //
   // Expose API in global object
-  //
   window.PDFDoc = PDFDoc;
   window.getPdf = getPdf;
 
-})(); // self-executing function
+})();
index 743c60b2530f2ebeb310b29e7c8c29f05d919fee..97d7e5a251f30640fb50ccd6df51cbd722e41075 100644 (file)
@@ -1,8 +1,6 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
 
-'use strict';
-
 var CFFEncodingMap = {
   '0': '-reserved-',
   '1': 'hstem',
index 654e98db111cd3158cf626abdf5764305b418207..2a1f0ea72ae02d17c78f2be40e8b1172d11fd415 100644 (file)
@@ -1,8 +1,6 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
 
-'use strict';
-
 /*
  * The Type2 reader code below is only used for debugging purpose since Type2
  * is only a CharString format and is never used directly as a Font file.
index ffcaaf9a215ec014ad22379faffe3b341be64780..6d77e642dda14e14bec44ac9656f8eaef16ad7e3 100644 (file)
@@ -1,8 +1,6 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
 
-'use strict';
-
 var consoleTimer = {};
 var console = {
   log: function log() {
index 70a38e47422b0369d4ef06b42fe21757726e387e..64723f537480bbaee469d239e6932695b808e382 100644 (file)
@@ -1,9 +1,6 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
 /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
 
-'use strict';
-
-
 function MessageHandler(name, comObj) {
   this.name = name;
   this.comObj = comObj;
index 6844168e6acec1d41de0f49b96dbe42d405933df..47fb89ab647a7a76d85883320e53c3e3066c65ab 100644 (file)
@@ -1,8 +1,6 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
 /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
 
-'use strict';
-
 var WorkerProcessorHandler = {
   setup: function(handler) {
     var pdfDoc = null;
index 46106965b3f547e791ef920182c0050b59ae505b..73a776545e473dca724da81ff3b00cb651e68e53 100644 (file)
@@ -318,7 +318,7 @@ def downloadLinkedPDFs(manifestList):
 
 def setUp(options):
     # Only serve files from a pdf.js clone
-    assert not ANAL or os.path.isfile('../pdf.js') and os.path.isdir('../.git')
+    assert not ANAL or os.path.isfile('../build/pdf.js') and os.path.isdir('../.git')
 
     if options.masterMode and os.path.isdir(TMPDIR):
         print 'Temporary snapshot dir tmp/ is still around.'
index 124537a889231f4b073f255bae2217fb9139c99f..70d39017d360e8d534c393a3576e52445ca50b21 100644 (file)
@@ -3,16 +3,8 @@
   <head>
     <title>pdf.js test slave</title>
     <style type="text/css"></style>
-    <script type="text/javascript" src="/pdf.js"></script>
-    <script type="text/javascript" src="/fonts.js"></script>
-    <script type="text/javascript" src="/crypto.js"></script>
-    <script type="text/javascript" src="/glyphlist.js"></script>
-    <script type="text/javascript" src="/metrics.js"></script>
-    <script type="text/javascript" src="/charsets.js"></script>
-    <script type="text/javascript" src="/cidmaps.js"></script>
+    <script type="text/javascript" src="/build/pdf.js"></script>
     <script type="text/javascript" src="driver.js"></script>
-    <script type="text/javascript" src="../worker/message_handler.js"></script>
-    <script type="text/javascript" src="../worker/processor_handler.js"></script>
   </head>
 
   <body>
index f6e492d3e56210ba2e1f201dca0345f7dca5ca9c..e01aab17de7580d42f428bff553c938b03287b48 100644 (file)
@@ -6,7 +6,7 @@
 
         <script type="text/javascript" src="compatibility.js"></script>
         <script type="text/javascript" src="viewer.js"></script>
-        <script type="text/javascript" src="../pdf.js"></script>
+        <script type="text/javascript" src="../build/pdf.js"></script>
   </head>
 
   <body>