|
@@ 692-739 (lines=48) @@
|
| 689 |
|
|
| 690 |
|
if (self::$currentState === 'LTR') { |
| 691 |
|
// Move trailing numeric strings to the following RTL text. Include any blanks preceding or following the numeric text too. |
| 692 |
|
if (I18N::direction() === 'rtl' && self::$previousState === 'RTL' && !$theEnd) { |
| 693 |
|
$trailingString = ''; |
| 694 |
|
$savedSpan = $textSpan; |
| 695 |
|
while ($textSpan !== '') { |
| 696 |
|
// Look for trailing spaces and tentatively move them |
| 697 |
|
if (substr($textSpan, -1) === ' ') { |
| 698 |
|
$trailingString = ' ' . $trailingString; |
| 699 |
|
$textSpan = substr($textSpan, 0, -1); |
| 700 |
|
continue; |
| 701 |
|
} |
| 702 |
|
if (substr($textSpan, -6) === ' ') { |
| 703 |
|
$trailingString = ' ' . $trailingString; |
| 704 |
|
$textSpan = substr($textSpan, 0, -1); |
| 705 |
|
continue; |
| 706 |
|
} |
| 707 |
|
if (substr($textSpan, -3) !== WT_UTF8_PDF) { |
| 708 |
|
// There is no trailing numeric string |
| 709 |
|
$textSpan = $savedSpan; |
| 710 |
|
break; |
| 711 |
|
} |
| 712 |
|
|
| 713 |
|
// We have a numeric string |
| 714 |
|
$posStartNumber = strrpos($textSpan, WT_UTF8_LRE); |
| 715 |
|
if ($posStartNumber === false) { |
| 716 |
|
$posStartNumber = 0; |
| 717 |
|
} |
| 718 |
|
$trailingString = substr($textSpan, $posStartNumber, strlen($textSpan) - $posStartNumber) . $trailingString; |
| 719 |
|
$textSpan = substr($textSpan, 0, $posStartNumber); |
| 720 |
|
|
| 721 |
|
// Look for more spaces and move them too |
| 722 |
|
while ($textSpan != '') { |
| 723 |
|
if (substr($textSpan, -1) == ' ') { |
| 724 |
|
$trailingString = ' ' . $trailingString; |
| 725 |
|
$textSpan = substr($textSpan, 0, -1); |
| 726 |
|
continue; |
| 727 |
|
} |
| 728 |
|
if (substr($textSpan, -6) == ' ') { |
| 729 |
|
$trailingString = ' ' . $trailingString; |
| 730 |
|
$textSpan = substr($textSpan, 0, -1); |
| 731 |
|
continue; |
| 732 |
|
} |
| 733 |
|
break; |
| 734 |
|
} |
| 735 |
|
|
| 736 |
|
self::$waitingText = $trailingString . self::$waitingText; |
| 737 |
|
break; |
| 738 |
|
} |
| 739 |
|
} |
| 740 |
|
|
| 741 |
|
$savedSpan = $textSpan; |
| 742 |
|
// Move any trailing <br>, optionally preceded or followed by blanks, outside this LTR span |
|
@@ 959-1006 (lines=48) @@
|
| 956 |
|
} |
| 957 |
|
|
| 958 |
|
// Move trailing numeric strings to the following LTR text. Include any blanks preceding or following the numeric text too. |
| 959 |
|
if (!$theEnd && I18N::direction() !== 'rtl') { |
| 960 |
|
$trailingString = ''; |
| 961 |
|
$savedSpan = $textSpan; |
| 962 |
|
while ($textSpan != '') { |
| 963 |
|
// Look for trailing spaces and tentatively move them |
| 964 |
|
if (substr($textSpan, -1) === ' ') { |
| 965 |
|
$trailingString = ' ' . $trailingString; |
| 966 |
|
$textSpan = substr($textSpan, 0, -1); |
| 967 |
|
continue; |
| 968 |
|
} |
| 969 |
|
if (substr($textSpan, -6) === ' ') { |
| 970 |
|
$trailingString = ' ' . $trailingString; |
| 971 |
|
$textSpan = substr($textSpan, 0, -1); |
| 972 |
|
continue; |
| 973 |
|
} |
| 974 |
|
if (substr($textSpan, -3) !== WT_UTF8_PDF) { |
| 975 |
|
// There is no trailing numeric string |
| 976 |
|
$textSpan = $savedSpan; |
| 977 |
|
break; |
| 978 |
|
} |
| 979 |
|
|
| 980 |
|
// We have a numeric string |
| 981 |
|
$posStartNumber = strrpos($textSpan, WT_UTF8_LRE); |
| 982 |
|
if ($posStartNumber === false) { |
| 983 |
|
$posStartNumber = 0; |
| 984 |
|
} |
| 985 |
|
$trailingString = substr($textSpan, $posStartNumber, strlen($textSpan) - $posStartNumber) . $trailingString; |
| 986 |
|
$textSpan = substr($textSpan, 0, $posStartNumber); |
| 987 |
|
|
| 988 |
|
// Look for more spaces and move them too |
| 989 |
|
while ($textSpan != '') { |
| 990 |
|
if (substr($textSpan, -1) == ' ') { |
| 991 |
|
$trailingString = ' ' . $trailingString; |
| 992 |
|
$textSpan = substr($textSpan, 0, -1); |
| 993 |
|
continue; |
| 994 |
|
} |
| 995 |
|
if (substr($textSpan, -6) == ' ') { |
| 996 |
|
$trailingString = ' ' . $trailingString; |
| 997 |
|
$textSpan = substr($textSpan, 0, -1); |
| 998 |
|
continue; |
| 999 |
|
} |
| 1000 |
|
break; |
| 1001 |
|
} |
| 1002 |
|
|
| 1003 |
|
self::$waitingText = $trailingString . self::$waitingText; |
| 1004 |
|
break; |
| 1005 |
|
} |
| 1006 |
|
} |
| 1007 |
|
|
| 1008 |
|
// Trailing " - " needs to be prefixed to the following span |
| 1009 |
|
if (!$theEnd && substr('...' . $textSpan, -3) == ' - ') { |