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:
parent
8d6565d1a8
commit
bd4434a7ea
2 changed files with 15 additions and 9 deletions
|
@ -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 = '';
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue