Add next line operators for text collection.

This commit is contained in:
Brendan Dahl 2012-04-24 12:29:23 -07:00
parent 8eaf0cdb18
commit 2db0ee6ba3

View File

@ -504,6 +504,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
var args = [], obj; var args = [], obj;
var text = ''; var text = '';
var chunk = null;
var font = null; var font = null;
while (!isEOF(obj = parser.getObj())) { while (!isEOF(obj = parser.getObj())) {
if (isCmd(obj)) { if (isCmd(obj)) {
@ -516,19 +517,28 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
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') {
text += fontCharsToUnicode(items[j], chunk += items[j];
font.translated.properties);
} else if (items[j] < 0) { } else if (items[j] < 0) {
// making all negative offsets a space - better to have // making all negative offsets a space - better to have
// a space in incorrect place than not have them at all // a space in incorrect place than not have them at all
text += ' '; chunk += ' ';
} }
} }
break; break;
case 'Tj': case 'Tj':
text += fontCharsToUnicode(args[0], font.translated.properties); chunk += args[0];
break;
case "'":
text += args[0] + ' ';
break;
case '"':
text += args[2] + ' ';
break; break;
} // switch } // switch
if (chunk !== null) {
text += fontCharsToUnicode(chunk, font.translated.properties);
chunk = null;
}
args = []; args = [];
} else if (obj != null) { } else if (obj != null) {