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

Takes ascent/descent in account in the text layer

This commit is contained in:
Yury Delendik 2014-01-08 13:50:52 -06:00
parent 4d01ff4079
commit 0131101275
5 changed files with 19 additions and 8 deletions

View file

@ -130,8 +130,10 @@ var TextLayerBuilder = function textLayerBuilder(options) {
textDiv.style.fontSize = fontHeight + 'px';
textDiv.style.fontFamily = geom.fontFamily;
textDiv.style.left = (geom.x + (fontHeight * Math.sin(geom.angle))) + 'px';
textDiv.style.top = (geom.y - (fontHeight * Math.cos(geom.angle))) + 'px';
var fontAscent = geom.ascent ? geom.ascent * fontHeight :
geom.descent ? (1 + geom.descent) * fontHeight : fontHeight;
textDiv.style.left = (geom.x + (fontAscent * Math.sin(geom.angle))) + 'px';
textDiv.style.top = (geom.y - (fontAscent * Math.cos(geom.angle))) + 'px';
// The content of the div is set in the `setTextContent` function.