Merge pull request #118 from jviereck/master
Fix #117: Make viewer_worker.html work again
This commit is contained in:
commit
3f91f2f73c
12
pdf.js
12
pdf.js
@ -3807,23 +3807,21 @@ var CanvasGraphics = (function() {
|
|||||||
if (fontDescriptor && fontDescriptor.num) {
|
if (fontDescriptor && fontDescriptor.num) {
|
||||||
var fontDescriptor = this.xref.fetchIfRef(fontDescriptor);
|
var fontDescriptor = this.xref.fetchIfRef(fontDescriptor);
|
||||||
fontName = fontDescriptor.get("FontName").name.replace("+", "_");
|
fontName = fontDescriptor.get("FontName").name.replace("+", "_");
|
||||||
Fonts.setActive(fontName, size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fontName) {
|
if (!fontName) {
|
||||||
// TODO: fontDescriptor is not available, fallback to default font
|
// TODO: fontDescriptor is not available, fallback to default font
|
||||||
this.current.fontSize = size;
|
fontName = "sans-serif";
|
||||||
this.ctx.font = this.current.fontSize + 'px sans-serif';
|
|
||||||
Fonts.setActive("sans-serif", this.current.fontSize);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.current.fontName = fontName;
|
this.current.fontName = fontName;
|
||||||
this.current.fontSize = size;
|
this.current.fontSize = size;
|
||||||
|
|
||||||
this.ctx.font = this.current.fontSize + 'px "' + fontName + '"';
|
|
||||||
if (this.ctx.$setFont) {
|
if (this.ctx.$setFont) {
|
||||||
this.ctx.$setFont(fontName);
|
this.ctx.$setFont(fontName, size);
|
||||||
|
} else {
|
||||||
|
this.ctx.font = size + 'px "' + fontName + '"';
|
||||||
|
Fonts.setActive(fontName, size);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setTextRenderingMode: function(mode) {
|
setTextRenderingMode: function(mode) {
|
||||||
|
@ -251,8 +251,9 @@ function WorkerPDFDoc(canvas) {
|
|||||||
this.strokeStyle = pattern;
|
this.strokeStyle = pattern;
|
||||||
},
|
},
|
||||||
|
|
||||||
"$setFont": function(name) {
|
"$setFont": function(name, size) {
|
||||||
Fonts.active = name;
|
this.font = size + 'px "' + name + '"';
|
||||||
|
Fonts.setActive(name, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user