Skip to content

Commit

Permalink
Fix for issue #6
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaasuni committed Sep 6, 2023
1 parent af59d0e commit 27e61d0
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
23 changes: 23 additions & 0 deletions examples/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/**
* index.php
*
* @since 2011-05-23
* @category Library
* @package Unicode
* @author Nicola Asuni <[email protected]>
* @copyright 2011-2023 Nicola Asuni - Tecnick.com LTD
* @license http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
* @link https://github.com/tecnickcom/tc-lib-unicode
*
* This file is part of tc-lib-unicode software library.
*/

// NOTE: run make deps fonts in the project root to generate the dependencies and example fonts.

// autoloader when using Composer
require ('../vendor/autoload.php');

use \Com\Tecnick\Unicode\Bidi as Bidi;

echo (new Bidi('hello ', null, null, 'R', false))->getString()."\n";
2 changes: 1 addition & 1 deletion src/Bidi/StepL.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ protected function processL1()
*/
protected function processL1b($idx, $jdx)
{
if ($jdx >= $this->numchars) {
if ($jdx >= ($this->numchars - 1)) {
return;
}
if ((($this->chardata[$jdx]['otype'] == 'S') || ($this->chardata[$jdx]['otype'] == 'B'))
Expand Down
10 changes: 10 additions & 0 deletions test/BidiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ public static function bidiStrDataProvider()
json_decode('"\u202EABC\u202C"'),
'CBA'
),
array(
'left to right',
'right to left',
'R'
),
array(
'left to right ',
' right to left',
'R'
),
array(
json_decode('"smith (fabrikam \u0600\u0601\u0602) \u05de\u05d6\u05dc"'),
json_decode('"\u05dc\u05d6\u05de (\u0602\u0601\u0600 fabrikam) smith"'),
Expand Down

0 comments on commit 27e61d0

Please sign in to comment.