mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Make worker work again after latest font changes
This commit is contained in:
parent
2e7df01459
commit
391c26b407
2 changed files with 17 additions and 22 deletions
14
fonts.js
14
fonts.js
|
@ -3,6 +3,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
var isWorker = (typeof window == "undefined");
|
||||
|
||||
/**
|
||||
* Maximum file size of the font.
|
||||
*/
|
||||
|
@ -36,9 +38,12 @@ var kDisableFonts = false;
|
|||
|
||||
var Fonts = (function () {
|
||||
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;
|
||||
|
@ -120,7 +125,6 @@ var Fonts = (function () {
|
|||
|
||||
var FontLoader = {
|
||||
bind: function(fonts) {
|
||||
var worker = (typeof window == "undefined");
|
||||
var ready = true;
|
||||
|
||||
for (var i = 0; i < fonts.length; i++) {
|
||||
|
@ -140,7 +144,7 @@ var FontLoader = {
|
|||
for (var j = 0; j < length; j++)
|
||||
str += String.fromCharCode(data[j]);
|
||||
|
||||
worker ? obj.bindWorker(str) : obj.bindDOM(str);
|
||||
isWorker ? obj.bindWorker(str) : obj.bindDOM(str);
|
||||
}
|
||||
|
||||
return ready;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue