Fixes RTL text extraction

This commit is contained in:
Yury Delendik 2012-09-14 09:59:11 -07:00
parent a98d84ff64
commit 45741c33a5

View File

@ -528,13 +528,13 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
var cmd = obj.cmd;
switch (cmd) {
case 'Tf':
font = handleSetFont(args[0].name);
font = handleSetFont(args[0].name).translated;
break;
case 'TJ':
var items = args[0];
for (var j = 0, jj = items.length; j < jj; j++) {
if (typeof items[j] === 'string') {
chunk += items[j];
chunk += fontCharsToUnicode(items[j], font);
} else if (items[j] < 0) {
// making all negative offsets a space - better to have
// a space in incorrect place than not have them at all
@ -543,17 +543,17 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
}
break;
case 'Tj':
chunk += args[0];
chunk += fontCharsToUnicode(args[0], font);
break;
case "'":
chunk += args[0] + ' ';
chunk += fontCharsToUnicode(args[0], font) + ' ';
break;
case '"':
chunk += args[2] + ' ';
chunk += fontCharsToUnicode(args[2], font) + ' ';
break;
} // switch
if (chunk !== '') {
text += fontCharsToUnicode(chunk, font.translated);
text += chunk;
chunk = '';
}