1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-18 10:52:16 +03:00
wezterm/bidi/README.md
Wez Furlong 601a85e12b Add wezterm-bidi crate
In order to support RTL/BIDI, wezterm needs a bidi implementation.  I
don't think a well-conforming rust implementation exists today; what I
found were implementations that didn't pass 100% of the conformance
tests.

So I decided to port "bidiref", the reference implementation of the UBA
described in http://unicode.org/reports/tr9/ to Rust.

This implementation focuses on conformance: no special measures have
been taken to optimize it so far, with my focus having been to ensure
that all of the approx 780,000 test cases in the unicode data for
unicode 14 pass.  Having the tests passing 100% allows for making
performance improvements with confidence in the future.

The API isn't completely designed/fully baked.  Until I get to hooking
it up to wezterm's shaper, I'm not 100% sure exactly what I'll need.
There's a good discussion on API in
https://github.com/open-i18n/rust-unic/issues/273 that suggests omitting
"legacy" operations such as reordering. I suspect that wezterm may
actually need that function to support monospace text layout in some
terminal scenarios, but regardless: reordering is part of the
conformance test suite so it remains a part of the API.

That said: the API does model the major operations as separate
phases, so you should be able to pay for just what you use:

* Resolving the embedding levels from a paragraph
* Returning paragraph runs of those levels (and their directions)
* Returning the whitespace-level-reset runs for a line-slice within the
  paragraph
* Returning the reordered indices + levels for a line-slice within the
  paragraph.

refs: https://github.com/wez/wezterm/issues/784
refs: https://github.com/kas-gui/kas-text/issues/20
2022-01-24 19:29:03 -07:00

29 lines
796 B
Markdown

# wezterm-bidi - a pure Rust bidi implementation
This crate provides an implementation of the *The Unicode Bidirectional
Algorithm (UBA)* in Rust.
This crate was developed for use in wezterm but does not depend on
other code in wezterm.
The focus for this crate is conformance.
## Status
This crate resolves embedding levels and can reorder line ranges.
The implementation conformant with 100% of the BidiTest.txt and
BidiCharacterTest.txt test cases (approx 780,000 test cases).
## License
MIT compatible License
Copyright © 2022-Present Wez Furlong.
Portions of the code in this crate were derived from the bidiref reference
implementation of the UBA which is:
Copyright © 1991-2022 Unicode, Inc. All rights reserved.
See [LICENSE.md](LICENSE.md) for the full text of the license.