mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Merge pull request #2809 from divergentdave/TJ_text_selection
Fix text selection for oddly-spaced TJ commands (Issue #2808)
This commit is contained in:
commit
5b195ea7e0
1 changed files with 6 additions and 3 deletions
|
@ -1053,6 +1053,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||
var canvasWidth = 0.0;
|
||||
var textSelection = textLayer ? true : false;
|
||||
var vertical = font.vertical;
|
||||
var spacingAccumulator = 0;
|
||||
|
||||
if (textSelection) {
|
||||
ctx.save();
|
||||
|
@ -1072,12 +1073,14 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||
}
|
||||
|
||||
if (textSelection)
|
||||
canvasWidth += spacingLength;
|
||||
spacingAccumulator += spacingLength;
|
||||
} else if (isString(e)) {
|
||||
var shownCanvasWidth = this.showText(e, true);
|
||||
|
||||
if (textSelection)
|
||||
canvasWidth += shownCanvasWidth;
|
||||
if (textSelection) {
|
||||
canvasWidth += spacingAccumulator + shownCanvasWidth;
|
||||
spacingAccumulator = 0;
|
||||
}
|
||||
} else {
|
||||
error('TJ array element ' + e + ' is not string or num');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue