* http://cgit.freedesktop.org/poppler/poppler/tree/poppler/GfxFont.cc#n65
*/
-var Fonts = (function () {
+var Fonts = (function Fonts() {
var kScalePrecision = 40;
- var fonts = Object.create(null);
- var ctx = document.createElement("canvas").getContext("2d");
- ctx.scale(1 / kScalePrecision, 1);
+ var fonts = Object.create(null);
+
+ if (!isWorker) {
+ var ctx = document.createElement("canvas").getContext("2d");
+ ctx.scale(1 / kScalePrecision, 1);
+ }
function Font(name, data, properties) {
this.name = name;