linebender / linebender/resvg

bidi: incorrect ordering of bi-directional line

Open
#447 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
4.1k
Forks
348
Avg merge
1d 14h
Merged PRs (30d)
3

Description

Using [this SVG](https://upload.wikimedia.org/wikipedia/commons/9/9b/SVG_Test_TextAlign.svg),

Firefox renders like this:
![bidi-FF](https://user-images.githubusercontent.com/134893/131882554-dd27cbb6-07ac-4045-90d6-150c7b160806.png)
Resvg renders like this:
![bidi-resvg](https://user-images.githubusercontent.com/134893/131882621-74889570-8e22-453b-b575-02abe5d5efe5.png)
KAS-text renders like this:
![bidi-kas-text](https://user-images.githubusercontent.com/134893/131882754-12ff3159-4bf5-4c47-83ba-68496b7fc314.png)
And QT renders like this:
![bidi-qt](https://user-images.githubusercontent.com/134893/131882809-e1ec6eba-6c7d-46e4-ab64-3f4ffde12106.png)
Bonus: Libreoffice:
![bidi-libreoffice](https://user-images.githubusercontent.com/134893/131882949-f99e6bb0-d6f8-4a40-b9fc-4af7f178d573.png)

The text is split at word boundaries as follows (more granularity than required):
```
level: Level(1) num glyphs: 2 text: نص
level: Level(1) num glyphs: 1
level: Level(1) num glyphs: 7 text: المرساة
level: Level(1) num glyphs: 1
level: Level(2) num glyphs: 2 text: 15
level: Level(1) num glyphs: 1
level: Level(2) num glyphs: 2 text: kV
```
According to the [Unicode BIDI algorithm](http://www.unicode.org/reports/tr9/#L2), Firefox and KAS-text are the only correct entries here.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the ordering difference with the linked SVG and compare the rendered line with the Unicode BIDI algorithm and the Firefox/KAS-text examples. Trace the Rust text-layout path responsible for bidirectional line ordering; done means the output follows the algorithm’s expected ordering for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.