1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Apply bidi algorithm to the text in the worker

This commit is contained in:
Julian Viereck 2012-09-14 19:34:54 -07:00
parent 8d6565d1a8
commit bd4434a7ea
2 changed files with 15 additions and 9 deletions

View file

@ -507,7 +507,12 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
getTextContent: function partialEvaluatorGetIRQueue(stream, resources, state) {
if (!state) {
state = [];
var text = [];
var dirs = [];
state = {
text: text,
dirs: dirs
};
}
var self = this;
@ -585,9 +590,6 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
if ('Form' !== type.name)
break;
// Add some spacing between the text here and the text of the
// xForm.
state = this.getTextContent(
xobj,
xobj.dict.get('Resources') || resources,
@ -596,7 +598,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
break;
} // switch
if (chunk !== '') {
state.push(chunk);
var bidiText = PDFJS.bidi(chunk, -1);
text.push(bidiText.str);
dirs.push(bidiText.ltr);
chunk = '';
}