1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Merge pull request #3373 from SSk123/master

rotation causes textLayer to get messed up
This commit is contained in:
Yury Delendik 2013-06-29 17:24:12 -07:00
commit ba87d2fe11
7 changed files with 45 additions and 17 deletions

View file

@ -197,15 +197,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';
@ -409,6 +412,7 @@ function info(message) {
}
function clear(ctx) {
ctx.beginPath();
ctx.clearRect(0, 0, canvas.width, canvas.height);
}

View file

@ -29,6 +29,7 @@
!TAMReview.pdf
!issue918.pdf
!issue1905.pdf
!rotated.pdf
!issue1249.pdf
!smaskdim.pdf
!endchar.pdf

View file

@ -0,0 +1 @@
http://blogs.adobe.com/CCJKType/files/2012/07/TaroUTR50SortedList112.pdf

BIN
test/pdfs/rotated.pdf Normal file

Binary file not shown.

View file

@ -178,6 +178,20 @@
"rounds": 1,
"type": "eq"
},
{ "id": "taro-text",
"file": "pdfs/TaroUTR50SortedList112.pdf",
"md5": "ce63eab622ff473a43f8a8de85ef8a46",
"link":true,
"rounds": 1,
"lastPage": 4,
"type": "text"
},
{ "id": "rotated-text",
"file": "pdfs/rotated.pdf",
"md5": "aed187f53e969ccdcbab0bb4c59f9e46",
"rounds": 1,
"type": "text"
},
{
"id": "issue3115",
"file": "pdfs/issue3115.pdf",