eagerly translate all fonts (a no-op currently)
This commit is contained in:
parent
fbb2f497fd
commit
0ef077c44c
14
pdf.js
14
pdf.js
@ -1677,6 +1677,10 @@ var CanvasGraphics = (function() {
|
|||||||
const EO_CLIP = {};
|
const EO_CLIP = {};
|
||||||
|
|
||||||
constructor.prototype = {
|
constructor.prototype = {
|
||||||
|
translateFont: function(fontDict) {
|
||||||
|
return fontDict;
|
||||||
|
},
|
||||||
|
|
||||||
beginDrawing: function(mediaBox) {
|
beginDrawing: function(mediaBox) {
|
||||||
var cw = this.ctx.canvas.width, ch = this.ctx.canvas.height;
|
var cw = this.ctx.canvas.width, ch = this.ctx.canvas.height;
|
||||||
this.ctx.save();
|
this.ctx.save();
|
||||||
@ -1698,7 +1702,6 @@ var CanvasGraphics = (function() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
compile: function(stream, xref, resources) {
|
compile: function(stream, xref, resources) {
|
||||||
console.log("compiling");
|
|
||||||
var xobjs = xref.fetchIfRef(resources.get("XObject")) || new Dict();
|
var xobjs = xref.fetchIfRef(resources.get("XObject")) || new Dict();
|
||||||
|
|
||||||
var parser = new Parser(new Lexer(stream), false);
|
var parser = new Parser(new Lexer(stream), false);
|
||||||
@ -1739,6 +1742,15 @@ var CanvasGraphics = (function() {
|
|||||||
args[0].code = this.compile(xobj, xref, xobj.dict.get("Resources"));
|
args[0].code = this.compile(xobj, xref, xobj.dict.get("Resources"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (cmd == "Tf") { // eagerly collect all fonts
|
||||||
|
var fontRes = resources.get("Font");
|
||||||
|
if (fontRes) {
|
||||||
|
fontRes = xref.fetchIfRef(fontRes);
|
||||||
|
var font = xref.fetchIfRef(fontRes.get(args[0].name));
|
||||||
|
assertWellFormed(IsDict(font));
|
||||||
|
if (!font.translated)
|
||||||
|
font.translated = this.translateFont(font);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
src += "this.";
|
src += "this.";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user