From 2fab0b1ed7950cfebd24ad13f089a343b3d90db4 Mon Sep 17 00:00:00 2001 From: Tim de Koning Date: Wed, 18 Jan 2012 12:00:59 +0100 Subject: [PATCH] Font rendering fix for < IE9 Fabric expects text to be rendered as Canvas elements. Cufon however falls back to VML rendering when canvas is not available in the browser. This mod of the Cufon library ALWAYS enabled the canvas rendering engine for Cufon. This way font-rendering is available on IE7 and IE8 when excanvas is available. --- lib/cufon.js | 442 +++++++++++++++++++++++----------------------- src/text.class.js | 151 ++++++++-------- 2 files changed, 299 insertions(+), 294 deletions(-) diff --git a/lib/cufon.js b/lib/cufon.js index b78f16ce..77beb216 100644 --- a/lib/cufon.js +++ b/lib/cufon.js @@ -4,38 +4,38 @@ */ var Cufon = (function() { - - var api = function() { + + var api = function() { return api.replace.apply(null, arguments); }; - + var DOM = api.DOM = { - + ready: (function() { - + var complete = false, readyStatus = { loaded: 1, complete: 1 }; - + var queue = [], perform = function() { if (complete) return; complete = true; for (var fn; fn = queue.shift(); fn()); }; - + // Gecko, Opera, WebKit r26101+ - + if (fabric.document.addEventListener) { fabric.document.addEventListener('DOMContentLoaded', perform, false); fabric.window.addEventListener('pageshow', perform, false); // For cached Gecko pages } - + // Old WebKit, Internet Explorer - + if (!fabric.window.opera && fabric.document.readyState) (function() { readyStatus[fabric.document.readyState] ? perform() : setTimeout(arguments.callee, 10); })(); - + // Internet Explorer - + if (fabric.document.readyState && fabric.document.createStyleSheet) (function() { try { fabric.document.body.doScroll('left'); @@ -45,39 +45,39 @@ var Cufon = (function() { setTimeout(arguments.callee, 1); } })(); - + addEvent(fabric.window, 'load', perform); // Fallback - + return function(listener) { if (!arguments.length) perform(); else complete ? listener() : queue.push(listener); }; - + })() - + }; var CSS = api.CSS = { - + Size: function(value, base) { - + this.value = parseFloat(value); this.unit = String(value).match(/[a-z%]*$/)[0] || 'px'; - + this.convert = function(value) { return value / base * this.value; }; - + this.convertFrom = function(value) { return value / this.value * base; }; - + this.toString = function() { return this.value + this.unit; }; }, - + getStyle: function(el) { return new Style(el.style); /* @@ -87,7 +87,7 @@ var Cufon = (function() { return new Style(el.style); */ }, - + quotedList: cached(function(value) { // doesn't work properly with empty quoted strings (""), but // it's not worth the extra code. @@ -95,22 +95,22 @@ var Cufon = (function() { while (match = re.exec(value)) list.push(match[3] || match[1]); return list; }), - + ready: (function() { - + var complete = false; - + var queue = [], perform = function() { complete = true; for (var fn; fn = queue.shift(); fn()); }; - + // Safari 2 does not include