linebender / linebender/parley

Refine line breaking around graphemes and grapheme clusters

Open
#555 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
736
Forks
120
Avg merge
1d 3h
Merged PRs (30d)
53

Description

CRLF is treated as two line breaks, [though it should be treated as one](https://www.unicode.org/reports/tr13/tr13-9.html#Interpreting_characters_in_text:~:text=on%20input%20and%20in%20interpretation%2C%20treat%20CR%2C%20LF%2C%20CRLF%2C%20and%20NEL%20the%20same). In this case, we'd want to break around the whole grapheme cluster `\r\n`.

Using `examples/vello_cpu_render/src/main.rs`:

```rust
let text = String::from(
"Start\nSome text here. Let's make it a bit longer so that line wrapping kicks in 😊. And also some اللغة العربية arabic text.\r\nThis is underlining pq and strikethrough t",
);
```
Image

```rust
let text = String::from(
"Start\r\nSome text here. Let's make it a bit longer so that line wrapping kicks in 😊. And also some اللغة العربية arabic text.\r\nThis is underlining pq and strikethrough t",
);
```
Image

However, for ligatures, which form a single grapheme cluster, we still need to wrap on characters, e.g if layout width is 1px:
Current behaviour:
Image
Expected:
Image

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 with examples/vello_cpu_render/src/main.rs and reproduce the two CRLF cases and the 1px ligature case. Trace the line-breaking and grapheme-cluster handling used by the example; done means CRLF breaks as one cluster while ligatures can still wrap between characters at very narrow widths.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.