From cdf1db35fc8e9329f6ac342c81d4d34b4ee1c72c Mon Sep 17 00:00:00 2001 From: notmasteryet Date: Fri, 10 Feb 2012 12:55:11 -0600 Subject: [PATCH] Using sans-serif instead of loaded fonts; fix IE9 dataset compatibility shim --- web/compatibility.js | 13 ++++++++----- web/viewer.css | 1 + web/viewer.js | 1 - 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/web/compatibility.js b/web/compatibility.js index b22153516..9f139b7dd 100644 --- a/web/compatibility.js +++ b/web/compatibility.js @@ -217,12 +217,15 @@ var div = document.createElement('div'); if ('dataset' in div) return; // dataset property exists - Object.defineProperty(HTMLElement.prototype, 'dataset', { - get: function htmlElementDatasetGetter() { - // adding dataset field to the actual object - return (this.dataset = {}); + var oldCreateElement = document.createElement; + document.createElement = function newCreateElement() { + var result = oldCreateElement.apply(document, arguments); + if (arguments[0] === 'div') { + // creating dataset property for the div elements + result.dataset = {}; } - }); + return result; + }; })(); // Check console compatability diff --git a/web/viewer.css b/web/viewer.css index 681e5046a..4d0c64dad 100644 --- a/web/viewer.css +++ b/web/viewer.css @@ -252,6 +252,7 @@ canvas { right: 0; bottom: 0; color: #000; + font-family: sans-serif; } .textLayer > div { diff --git a/web/viewer.js b/web/viewer.js index 5a1a1df03..d5162a194 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -1083,7 +1083,6 @@ var TextLayerBuilder = function textLayerBuilder(textLayerDiv) { textDiv.dataset.canvasWidth = text.canvasWidth * text.geom.hScale; textDiv.style.fontSize = fontHeight + 'px'; - textDiv.style.fontFamily = fontName || 'sans-serif'; textDiv.style.left = text.geom.x + 'px'; textDiv.style.top = (text.geom.y - fontHeight) + 'px'; textDiv.textContent = text.str;