Unicode.Bidi
0.4.0
dotnet add package Unicode.Bidi --version 0.4.0
NuGet\Install-Package Unicode.Bidi -Version 0.4.0
<PackageReference Include="Unicode.Bidi" Version="0.4.0" />
<PackageVersion Include="Unicode.Bidi" Version="0.4.0" />
<PackageReference Include="Unicode.Bidi" />
paket add Unicode.Bidi --version 0.4.0
#r "nuget: Unicode.Bidi, 0.4.0"
#:package Unicode.Bidi@0.4.0
#addin nuget:?package=Unicode.Bidi&version=0.4.0
#tool nuget:?package=Unicode.Bidi&version=0.4.0
Unicode.Bidi
.NET port of Rust unicode-bidi. The algorithm tracks crate version 0.3.18; character data tracks Unicode 18.0.0 directly from the Unicode Character Database.
From version 0.4.0, package versions advance independently of the Rust crate. Updating character data can change bidi classification and text ordering; see maintenance for compatibility notes and the update procedure.
The port intentionally keeps source organization close to the Rust crate so individual files can be compared as the implementation grows:
src/Unicode.Bidi/char_datamirrorssrc/char_data.src/Unicode.Bidi/lib.csmirrors the publicBidiInfoconstruction and reordering APIs fromsrc/lib.rs.src/Unicode.Bidi/level.csmirrorssrc/level.rs.src/Unicode.Bidi/format_chars.csmirrorssrc/format_chars.rs.src/Unicode.Bidi/explicit.cs,prepare.cs, andimplicit.csmirror the matching Rust modules.
Indexing Policy
.NET strings are UTF-16, so public text ranges and per-code-unit arrays in this port use UTF-16 code-unit indices. The parity harness compares these results against Rust's unicode_bidi::utf16 module.
Usage
Install the package as Unicode.Bidi and import the root namespace:
using Unicode.Bidi;
BidiInfo info = BidiInfo.Create("abc אבג", Level.Ltr());
ParagraphInfo paragraph = info.Paragraphs[0];
string visual = info.ReorderLine(paragraph, paragraph.Range);
BidiClass alefClass = CharData.BidiClass('\u05D0');
Level explicitLevel = Level.CreateExplicit(1);
Rust-compatible factory names such as BidiInfo.New and Level.New are kept for source traceability. .NET-style Create aliases are available on the main entry points.
Local Validation
dotnet restore UnicodeBidiNet.slnx
dotnet build UnicodeBidiNet.slnx --configuration Release --no-restore
dotnet test UnicodeBidiNet.slnx --configuration Release --no-build --nologo
The parity harness compares selected .NET outputs with the original Rust crate:
./tools/fetch-upstream.sh
python3 tools/parity/run_bidi_parity.py --out-dir artifacts/bidi-parity
The parity run requires cargo because the Rust probe is built against unicode-bidi = "=0.3.18".
If Rust is not installed globally, use the repo-local bootstrap:
./tools/bootstrap-local-rust.sh
python3 tools/parity/run_bidi_parity.py --out-dir artifacts/bidi-parity
Unicode Conformance
The larger Unicode 18.0.0 conformance files are downloaded on demand into artifacts/:
python3 tools/conformance/fetch_unicode_bidi_tests.py
python3 tools/conformance/run_unicode_bidi_conformance.py \
--max-cases 1000 \
--out-dir artifacts/bidi-conformance \
--fail-on-regression
Use --full for a full local/provisioned run. GitHub Actions runs the full corpus on pull requests, pushes to main, and weekly, and also provides a manual Unicode Conformance workflow.
Performance
The repository contains a BenchmarkDotNet and Criterion comparison harness:
python3 benchmarks/run_comparison.py
Use --quick for a short harness check. The manual Performance benchmarks GitHub Actions
workflow runs the same command and uploads both native reports plus the normalized comparison.
See docs/performance.md for the measured .NET/Rust results and lookup-strategy analysis.
Packaging
NuGet packages can be produced locally with:
dotnet pack src/Unicode.Bidi/Unicode.Bidi.csproj --configuration Release --output artifacts/packages
Publishing to nuget.org is done through the manual Publish to NuGet GitHub Actions workflow. A successful publication also creates a matching GitHub Release with the package artifacts attached. See docs/publishing.md for the required NuGet Trusted Publishing policy and publish inputs.
See docs/api-compatibility.md and docs/conformance.md for the current parity notes and conformance workflow.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Unicode.Bidi:
| Package | Downloads |
|---|---|
|
Goo
A retained, declarative UI framework for G#. |
|
|
PdfBox.Net.SkiaSharp
Complete cross-platform SkiaSharp rendering and glyph layout backend for PdfBox.Net. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.4.0 | 5,996 | 11/1/2026 |
| 0.3.18 | 27,961 | 8/1/2026 |
| 0.3.18-preview.1 | 976 | 7/7/2026 |
Algorithm ported from unicode-bidi 0.3.18; Unicode data 18.0.0 generated directly from the Unicode Character Database.