mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Fixes lineWidth/scale calculation for the fonts
This commit is contained in:
parent
9d3afdd2e0
commit
37fb625e87
1 changed files with 7 additions and 2 deletions
|
@ -799,7 +799,9 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||
this.applyTextTransforms();
|
||||
|
||||
var lineWidth = current.lineWidth;
|
||||
var scale = Math.abs(current.textMatrix[0] * fontMatrix[0]);
|
||||
var a1 = current.textMatrix[0], b1 = current.textMatrix[1];
|
||||
var a2 = fontMatrix[0], b2 = fontMatrix[1];
|
||||
var scale = Math.sqrt((a1 * a1 + b1 * b1) * (a2 * a2 + b2 * b2));
|
||||
if (scale == 0 || lineWidth == 0)
|
||||
lineWidth = this.getSinglePixelWidth();
|
||||
else
|
||||
|
@ -1340,7 +1342,10 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||
},
|
||||
getSinglePixelWidth: function CanvasGraphics_getSinglePixelWidth(scale) {
|
||||
var inverse = this.ctx.mozCurrentTransformInverse;
|
||||
return Math.abs(inverse[0] + inverse[2]);
|
||||
// max of the current horizontal and vertical scale
|
||||
return Math.sqrt(Math.max(
|
||||
(inverse[0] * inverse[0] + inverse[1] * inverse[1]),
|
||||
(inverse[2] * inverse[2] + inverse[3] * inverse[3])));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue