mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #5995 from CodingFabian/tweak-char-spacing-text-selection
Apply char spacing only when there are chars.
This commit is contained in:
commit
90982332bf
4 changed files with 93 additions and 2 deletions
|
@ -1020,16 +1020,23 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
// var x = pt[0];
|
||||
// var y = pt[1];
|
||||
|
||||
var charSpacing = 0;
|
||||
if (textChunk.str.length > 0) {
|
||||
// Apply char spacing only when there are chars.
|
||||
// As a result there is only spacing between glyphs.
|
||||
charSpacing = textState.charSpacing;
|
||||
}
|
||||
|
||||
var tx = 0;
|
||||
var ty = 0;
|
||||
if (!font.vertical) {
|
||||
var w0 = glyphWidth * textState.fontMatrix[0];
|
||||
tx = (w0 * textState.fontSize + textState.charSpacing) *
|
||||
tx = (w0 * textState.fontSize + charSpacing) *
|
||||
textState.textHScale;
|
||||
width += tx;
|
||||
} else {
|
||||
var w1 = glyphWidth * textState.fontMatrix[0];
|
||||
ty = w1 * textState.fontSize + textState.charSpacing;
|
||||
ty = w1 * textState.fontSize + charSpacing;
|
||||
height += ty;
|
||||
}
|
||||
textState.translateTextMatrix(tx, ty);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue