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
@ -1053,6 +1053,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||||||
var canvasWidth = 0.0;
|
var canvasWidth = 0.0;
|
||||||
var textSelection = textLayer ? true : false;
|
var textSelection = textLayer ? true : false;
|
||||||
var vertical = font.vertical;
|
var vertical = font.vertical;
|
||||||
|
var spacingAccumulator = 0;
|
||||||
|
|
||||||
if (textSelection) {
|
if (textSelection) {
|
||||||
ctx.save();
|
ctx.save();
|
||||||
@ -1072,12 +1073,14 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (textSelection)
|
if (textSelection)
|
||||||
canvasWidth += spacingLength;
|
spacingAccumulator += spacingLength;
|
||||||
} else if (isString(e)) {
|
} else if (isString(e)) {
|
||||||
var shownCanvasWidth = this.showText(e, true);
|
var shownCanvasWidth = this.showText(e, true);
|
||||||
|
|
||||||
if (textSelection)
|
if (textSelection) {
|
||||||
canvasWidth += shownCanvasWidth;
|
canvasWidth += spacingAccumulator + shownCanvasWidth;
|
||||||
|
spacingAccumulator = 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
error('TJ array element ' + e + ' is not string or num');
|
error('TJ array element ' + e + ' is not string or num');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user