|
|
@ -138,16 +138,16 @@ var bidi = PDFJS.bidi = (function bidiClosure() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function bidiResult(content, direction) { |
|
|
|
function BidiResult(str, isLTR) { |
|
|
|
this.content = content; |
|
|
|
this.str = str; |
|
|
|
this.direction = direction; |
|
|
|
this.ltr = isLTR; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function bidi(str, startLevel) { |
|
|
|
function bidi(str, startLevel) { |
|
|
|
var direction = ''; |
|
|
|
var isLTR = true; |
|
|
|
var strLength = str.length; |
|
|
|
var strLength = str.length; |
|
|
|
if (strLength == 0) |
|
|
|
if (strLength == 0) |
|
|
|
return new bidiResult(str, direction); |
|
|
|
return new BidiResult(str, ltr); |
|
|
|
|
|
|
|
|
|
|
|
// get types, fill arrays
|
|
|
|
// get types, fill arrays
|
|
|
|
|
|
|
|
|
|
|
@ -181,16 +181,16 @@ var bidi = PDFJS.bidi = (function bidiClosure() { |
|
|
|
// if less than 30% chars are rtl then string is primarily ltr
|
|
|
|
// if less than 30% chars are rtl then string is primarily ltr
|
|
|
|
// if more than 30% chars are rtl then string is primarily rtl
|
|
|
|
// if more than 30% chars are rtl then string is primarily rtl
|
|
|
|
if (numBidi == 0) { |
|
|
|
if (numBidi == 0) { |
|
|
|
direction = 'ltr'; |
|
|
|
isLTR = true; |
|
|
|
return new bidiResult(str, direction); |
|
|
|
return new BidiResult(str, isLTR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (startLevel == -1) { |
|
|
|
if (startLevel == -1) { |
|
|
|
if ((strLength / numBidi) < 0.3) { |
|
|
|
if ((strLength / numBidi) < 0.3) { |
|
|
|
direction = 'ltr'; |
|
|
|
isLTR = true; |
|
|
|
startLevel = 0; |
|
|
|
startLevel = 0; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
direction = 'rtl'; |
|
|
|
isLTR = false; |
|
|
|
startLevel = 1; |
|
|
|
startLevel = 1; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -444,7 +444,7 @@ var bidi = PDFJS.bidi = (function bidiClosure() { |
|
|
|
result += ch; |
|
|
|
result += ch; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return new bidiResult(result, direction); |
|
|
|
return new BidiResult(result, isLTR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return bidi; |
|
|
|
return bidi; |
|
|
|