Comments
This commit is contained in:
parent
dc33b24fae
commit
a1853185b1
@ -103,6 +103,7 @@ var CanvasGraphics = (function canvasGraphics() {
|
||||
this.ctx.transform(0, -1, -1, 0, cw, ch);
|
||||
break;
|
||||
}
|
||||
// Scale so that canvas units are the same as PDF user space units
|
||||
this.ctx.scale(cw / mediaBox.width, ch / mediaBox.height);
|
||||
this.textDivs = [];
|
||||
this.textLayerQueue = [];
|
||||
@ -491,14 +492,18 @@ var CanvasGraphics = (function canvasGraphics() {
|
||||
pushTextDivs: function canvasGraphicsPushTextDivs(text) {
|
||||
var div = document.createElement('div');
|
||||
var fontSize = this.current.fontSize;
|
||||
var fontHeight = text.geom.vScale * fontSize;
|
||||
|
||||
// vScale and hScale already contain the scaling to pixel units
|
||||
// as mozCurrentTransform reflects ctx.scale() changes
|
||||
// (see beginDrawing())
|
||||
var fontHeight = fontSize * text.geom.vScale;
|
||||
div.dataset.canvasWidth = text.canvasWidth * text.geom.hScale;
|
||||
|
||||
div.style.fontSize = fontHeight + 'px';
|
||||
div.style.fontFamily = this.current.font.loadedName || 'sans-serif';
|
||||
div.style.left = text.geom.x + 'px';
|
||||
div.style.top = (text.geom.y - fontHeight) + 'px';
|
||||
div.innerHTML = text.str;
|
||||
div.dataset.canvasWidth = text.canvasWidth * text.geom.hScale;
|
||||
div.dataset.textLength = text.length;
|
||||
this.textDivs.push(div);
|
||||
},
|
||||
|
@ -3,6 +3,9 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
// The Metrics object contains glyph widths (in glyph space units).
|
||||
// As per PDF spec, for most fonts (Type 3 being an exception) a glyph
|
||||
// space unit corresponds to 1/1000th of text space unit.
|
||||
var Metrics = {
|
||||
'Courier': 600,
|
||||
'Courier-Bold': 600,
|
||||
|
Loading…
Reference in New Issue
Block a user