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; var cmd = obj.cmd;
switch (cmd) { switch (cmd) {
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 += items[j]; chunk += fontCharsToUnicode(items[j], font);
} 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
@ -543,17 +543,17 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
} }
break; break;
case 'Tj': case 'Tj':
chunk += args[0]; chunk += fontCharsToUnicode(args[0], font);
break; break;
case "'": case "'":
chunk += args[0] + ' '; chunk += fontCharsToUnicode(args[0], font) + ' ';
break; break;
case '"': case '"':
chunk += args[2] + ' '; chunk += fontCharsToUnicode(args[2], font) + ' ';
break; break;
} // switch } // switch
if (chunk !== '') { if (chunk !== '') {
text += fontCharsToUnicode(chunk, font.translated); text += chunk;
chunk = ''; chunk = '';
} }