Ensure divs used to make fonts load are not visible

This commit is contained in:
Julian Viereck 2011-06-23 19:43:01 +02:00
parent c35e1e7552
commit 171ab51c56
4 changed files with 8 additions and 7 deletions

View File

@ -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;

View File

@ -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);
}

View 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...

View 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) {