Merge pull request #2167 from jviereck/textLayer-whitespaces
Tune whitespace insertion
This commit is contained in:
commit
5cf5ef357f
@ -510,6 +510,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
getTextContent: function partialEvaluatorGetIRQueue(
|
getTextContent: function partialEvaluatorGetIRQueue(
|
||||||
stream, resources, state) {
|
stream, resources, state) {
|
||||||
var bidiTexts;
|
var bidiTexts;
|
||||||
|
var kSpaceFactor = 0.35;
|
||||||
|
var kMultipleSpaceFactor = 1.5;
|
||||||
|
|
||||||
if (!state) {
|
if (!state) {
|
||||||
bidiTexts = [];
|
bidiTexts = [];
|
||||||
@ -551,8 +553,13 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
if (typeof items[j] === 'string') {
|
if (typeof items[j] === 'string') {
|
||||||
chunk += fontCharsToUnicode(items[j], font);
|
chunk += fontCharsToUnicode(items[j], font);
|
||||||
} else if (items[j] < 0 && font.spaceWidth > 0) {
|
} else if (items[j] < 0 && font.spaceWidth > 0) {
|
||||||
var numFakeSpaces = Math.round(-items[j] / font.spaceWidth);
|
var fakeSpaces = -items[j] / font.spaceWidth;
|
||||||
if (numFakeSpaces > 0) {
|
if (fakeSpaces > kMultipleSpaceFactor) {
|
||||||
|
fakeSpaces = Math.round(fakeSpaces);
|
||||||
|
while (fakeSpaces--) {
|
||||||
|
chunk += ' ';
|
||||||
|
}
|
||||||
|
} else if (fakeSpaces > kSpaceFactor) {
|
||||||
chunk += ' ';
|
chunk += ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user