Browse Source

Fix typos that prevent space insertion for showSpaced in getTextContent

Julian Viereck 13 years ago
parent
commit
897b99500e
  1. 14
      src/evaluator.js

14
src/evaluator.js

@ -533,15 +533,15 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
switch (cmd) { switch (cmd) {
// TODO: Add support for SAVE/RESTORE and XFORM here. // TODO: Add support for SAVE/RESTORE and XFORM here.
case 'Tf': case 'Tf':
font = handleSetFont(args[0].name); font = handleSetFont(args[0].name).translated;
break; break;
case 'TJ': case 'TJ':
var items = args[0]; var items = args[0];
for (var j = 0, jj = items.length; j < jj; j++) { for (var j = 0, jj = items.length; j < jj; j++) {
if (typeof items[j] === 'string') { if (typeof items[j] === 'string') {
chunk += fontCharsToUnicode(items[j], font.translated); chunk += fontCharsToUnicode(items[j], font);
} else if (items[j] < 0 && font.spacedWidth > 0) { } else if (items[j] < 0 && font.spaceWidth > 0) {
var numFakeSpaces = Math.round(-e / font.spacedWidth); var numFakeSpaces = Math.round(-items[j] / font.spaceWidth);
if (numFakeSpaces > 0) { if (numFakeSpaces > 0) {
chunk += ' '; chunk += ' ';
} }
@ -549,13 +549,13 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
} }
break; break;
case 'Tj': case 'Tj':
chunk += fontCharsToUnicode(args[0], font.translated); chunk += fontCharsToUnicode(args[0], font);
break; break;
case "'": case "'":
chunk += fontCharsToUnicode(args[0], font.translated) + ' '; chunk += fontCharsToUnicode(args[0], font) + ' ';
break; break;
case '"': case '"':
chunk += fontCharsToUnicode(args[2], font.translated) + ' '; chunk += fontCharsToUnicode(args[2], font) + ' ';
break; break;
case 'Do': case 'Do':
// Set the chunk such that the following if won't add something // Set the chunk such that the following if won't add something

Loading…
Cancel
Save