fixed case when font cannot be found
This commit is contained in:
parent
4404871212
commit
7b659fd605
4
fonts.js
4
fonts.js
@ -69,7 +69,11 @@ var Fonts = (function Fonts() {
|
|||||||
var sizes = current.sizes;
|
var sizes = current.sizes;
|
||||||
if (!(measureCache = sizes[size]))
|
if (!(measureCache = sizes[size]))
|
||||||
measureCache = sizes[size] = Object.create(null);
|
measureCache = sizes[size] = Object.create(null);
|
||||||
|
} else {
|
||||||
|
charsCache = null;
|
||||||
|
measureCache = null
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.font = (size * kScalePrecision) + 'px "' + fontName + '"';
|
ctx.font = (size * kScalePrecision) + 'px "' + fontName + '"';
|
||||||
},
|
},
|
||||||
charsToUnicode: function fonts_chars2Unicode(chars) {
|
charsToUnicode: function fonts_chars2Unicode(chars) {
|
||||||
|
10
pdf.js
10
pdf.js
@ -3930,10 +3930,12 @@ var CanvasGraphics = (function() {
|
|||||||
text = Fonts.charsToUnicode(text);
|
text = Fonts.charsToUnicode(text);
|
||||||
this.ctx.translate(this.current.x, -1 * this.current.y);
|
this.ctx.translate(this.current.x, -1 * this.current.y);
|
||||||
|
|
||||||
var font = Fonts.lookupById(this.current.font.id);
|
var font = this.current.font;
|
||||||
if (font && font.properties.textMatrix)
|
if (font) {
|
||||||
this.ctx.transform.apply(this.ctx, font.properties.textMatrix);
|
var fontInfo = Fonts.lookupById(font.id);
|
||||||
|
if (fontInfo && fontInfo.properties.textMatrix)
|
||||||
|
this.ctx.transform.apply(this.ctx, fontInfo.properties.textMatrix);
|
||||||
|
}
|
||||||
this.ctx.fillText(text, 0, 0);
|
this.ctx.fillText(text, 0, 0);
|
||||||
this.current.x += Fonts.measureText(text);
|
this.current.x += Fonts.measureText(text);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user