Fixes Text rotation issue #2095
This commit is contained in:
parent
ce218d021f
commit
21a8d62624
7 changed files with 44 additions and 17 deletions
|
@ -194,15 +194,18 @@ SimpleTextLayerBuilder.prototype = {
|
|||
appendText: function SimpleTextLayerBuilder_AppendText(geom) {
|
||||
var ctx = this.ctx, viewport = this.viewport;
|
||||
// vScale and hScale already contain the scaling to pixel units
|
||||
var fontHeight = geom.fontSize * geom.vScale;
|
||||
var fontHeight = geom.fontSize * Math.abs(geom.vScale);
|
||||
ctx.save();
|
||||
ctx.beginPath();
|
||||
ctx.strokeStyle = 'red';
|
||||
ctx.fillStyle = 'yellow';
|
||||
ctx.rect(geom.x, geom.y - fontHeight,
|
||||
geom.canvasWidth * geom.hScale, fontHeight);
|
||||
ctx.translate(geom.x + (fontHeight * Math.sin(geom.angle)),
|
||||
geom.y - (fontHeight * Math.cos(geom.angle)));
|
||||
ctx.rotate(geom.angle);
|
||||
ctx.rect(0, 0, geom.canvasWidth * Math.abs(geom.hScale), fontHeight);
|
||||
ctx.stroke();
|
||||
ctx.fill();
|
||||
|
||||
ctx.restore();
|
||||
var textContent = this.textContent.bidiTexts[this.textCounter].str;
|
||||
ctx.font = fontHeight + 'px ' + geom.fontFamily;
|
||||
ctx.fillStyle = 'black';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue