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:
parent
4d01ff4079
commit
0131101275
5 changed files with 19 additions and 8 deletions
|
@ -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.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue