# The unibidi-lua Package
unibidi-lua version 1.0, 2026-05-19

## Description
The unibidi-lua Lua module is an implementation of the Unicode Bidirectional Algorithm,
based on the ConTeXt project's implementation for various LuaTeX formats, and plain lua.

## Conformance
The unibidi-lua package aims to fully conform to the
[Unicode Bidirectional Algorithm](https://www.unicode.org/reports/tr9/)
(Unicode Standard Annex #9). It is tested against the official Unicode
conformance test files
[BidiTest.txt](https://www.unicode.org/Public/UCD/latest/ucd/BidiTest.txt) and
[BidiCharacterTest.txt](https://www.unicode.org/Public/UCD/latest/ucd/BidiCharacterTest.txt).


At the time of this writing, Unicode 17.0 was the latest version, and all the tests pass.

## Maintenance
This package is currently maintained at https://codeberg.org/polyglossia/unibidi-lua.

Issues can be reported at the issue tracker.

### Testing
Testing can be done with `l3build check`. Note that you need the files 
[BidiCharacterTest.txt](https://www.unicode.org/Public/UCD/latest/ucd/BidiCharacterTest.txt) and
[BidiTest.txt](https://www.unicode.org/Public/UCD/latest/ucd/BidiTest.txt) somewhere LuaTeX
can find them. If you don't have them, you can run `l3build getunicodetests` to download them to
"./testfiles/unicode/support". If you wish you can also ignore these tests by passing the -c flag
to `l3build check`.

### Updating the Data File
To update "unibidi-lua-data.lua", run `l3build gendata`, this will parse
the files [BidiMirroring.txt](https://www.unicode.org/Public/UCD/latest/ucd/BidiMirroring.txt),
[BidiBrackets.txt](https://www.unicode.org/Public/UCD/latest/ucd/BidiBrackets.txt), and
[DerivedBidiClass.txt](https://www.unicode.org/Public/UCD/latest/ucd/extracted/DerivedBidiClass.txt).
Usually they exist in a TeX installation (in the unicode-data package), but
if they are not they will be downloaded temporarily.

## Documentation
To print the documentation run `optex -jobname unibidi-lua-doc '\docgen unibidi-lua'`

## Installation
To install for the use of LuaTeX, you can either run `l3build install`, put the files
"unibidi-lua.lua", "unibidi-lua-data.lua", "unibidi-lua-interface.lua", "unibidi-lua.tex", "unibidi-lua.opm"
and "unibidi-lua.sty" in a place LuaTeX can find, or install with your TeX distribution.

For the use of plain lua, put the files "unibidi-lua.lua" and "unibidi-lua-data.lua"
somewhere the lua interpreter can find it.
## License
The unibidi-lua package, as a derived work of ConTeXt, is distributed under the GNU GPLv2 license:

http://www.gnu.org/licenses/old-licenses/gpl-2.0.html

This license requires the license itself to be distributed with the work.
For its full text see the file COPYING.

Parts of unibidi-lua.lua are
© PRAGMA ADE / ConTeXt Development Team.
## DISCLAIMER

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; version 2.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
