]> git.parisson.com Git - pdf.js.git/commitdiff
Ensure divs used to make fonts load are not visible
authorJulian Viereck <julian.viereck@gmail.com>
Thu, 23 Jun 2011 17:43:01 +0000 (19:43 +0200)
committerJulian Viereck <julian.viereck@gmail.com>
Thu, 23 Jun 2011 21:33:25 +0000 (23:33 +0200)
fonts.js
viewer.js
viewer_worker.html
worker_client.js

index 7f4958caf9ec3aaf27399e2f35ff412a20e52fe8..ba40ef8e12f1a673a419d7575f1bf4e1cb6b02a5 100644 (file)
--- a/fonts.js
+++ b/fonts.js
@@ -786,9 +786,9 @@ var Font = (function () {
           styleSheet.insertRule(rule, styleSheet.length);
 
           var div = document.createElement("div");
-          div.innerHTML += "<div style='font-family:" +
-            fontName +
-            ";'>j</div>";
+          var style = 'font-family:"' + fontName + 
+            '";position: absolute;top:-99999;left:-99999;z-index:-99999';
+          div.setAttribute("style", style);
           document.body.appendChild(div);
 
           Fonts[fontName].loading = true;
index d0aeb0b2dfc89fe62150dba371aba92c1fe4e552..41aaf354ca79db922c897a0e831f05013ffb78f2 100644 (file)
--- a/viewer.js
+++ b/viewer.js
@@ -10,7 +10,7 @@ function load(userInput) {
     pageNum = parseInt(queryParams().page) || 1;
     var fileName = userInput;
     if (!userInput) {
-      fileName = "canvas.pdf";
+      fileName = queryParams().file || "compressed.tracemonkey-pldi-09.pdf";
     }
     open(fileName);
 }
index a5ffc6a6e76a535e634d7f621a46f904a1446a0b..d13935f13068ca84b013e58ac64b76fdc1c451bb 100644 (file)
@@ -22,9 +22,7 @@ window.onload = function() {
 </script>
         <link rel="stylesheet" href="viewer.css"></link>
   </head>
-
   <body>
-    <div id="fonts" style="position: absolute;display:block;z-index:-1;"></div>
     <div id="controls">
     <input type="file" style="float: right; margin: auto 32px;" onChange="load(this.value.toString());"></input>
     <!-- This only opens supported PDFs from the source path...
index 385103c30ba37774625394e717a2c95ab796a5df..62a7c1377a5c748f9aaf7943c3a1d516b7a3f5bd 100644 (file)
@@ -174,7 +174,10 @@ function WorkerPDFDoc(canvas) {
       // seems it's loaded once Gecko notices it's used. Therefore,
       // add a div on the page using the loaded font.
       var div = document.createElement("div");
-      document.getElementById("fonts").innerHTML += "<div style='font-family:" + data.fontName + "'>j</div>";
+      var style = 'font-family:"' + data.fontName + 
+        '";position: absolute;top:-99999;left:-99999;z-index:-99999';
+      div.setAttribute("style", style);
+      document.body.appendChild(div);
     },
 
     "jpeg_stream": function(data) {