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:
commit
ba87d2fe11
7 changed files with 45 additions and 17 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
|
@ -29,6 +29,7 @@
|
|||
!TAMReview.pdf
|
||||
!issue918.pdf
|
||||
!issue1905.pdf
|
||||
!rotated.pdf
|
||||
!issue1249.pdf
|
||||
!smaskdim.pdf
|
||||
!endchar.pdf
|
||||
|
|
1
test/pdfs/TaroUTR50SortedList112.pdf.link
Normal file
1
test/pdfs/TaroUTR50SortedList112.pdf.link
Normal file
|
@ -0,0 +1 @@
|
|||
http://blogs.adobe.com/CCJKType/files/2012/07/TaroUTR50SortedList112.pdf
|
BIN
test/pdfs/rotated.pdf
Normal file
BIN
test/pdfs/rotated.pdf
Normal file
Binary file not shown.
|
@ -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",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue