mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-24 17:18:07 +02:00
eagerly translate all fonts (a no-op currently)
This commit is contained in:
parent
662fab04ca
commit
d94b3006a3
1 changed files with 13 additions and 1 deletions
14
pdf.js
14
pdf.js
|
@ -1677,6 +1677,10 @@ var CanvasGraphics = (function() {
|
|||
const EO_CLIP = {};
|
||||
|
||||
constructor.prototype = {
|
||||
translateFont: function(fontDict) {
|
||||
return fontDict;
|
||||
},
|
||||
|
||||
beginDrawing: function(mediaBox) {
|
||||
var cw = this.ctx.canvas.width, ch = this.ctx.canvas.height;
|
||||
this.ctx.save();
|
||||
|
@ -1698,7 +1702,6 @@ var CanvasGraphics = (function() {
|
|||
},
|
||||
|
||||
compile: function(stream, xref, resources) {
|
||||
console.log("compiling");
|
||||
var xobjs = xref.fetchIfRef(resources.get("XObject")) || new Dict();
|
||||
|
||||
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"));
|
||||
}
|
||||
}
|
||||
} 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.";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue