linebender / linebender/parley
Turn non-breaking space (and other whitespace) into a space
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 736
- Forks
- 120
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 53
Description
LLM contribution: Fable for investigation and to generate test.
If a font is missing non breaking space (U+00A0), HarfRust shapes them in the same way as a space (if the font supports that). This also applies for some different space characters (Claude claims U+2000..=U+200A, U+205F, but not U+3000 - https://crbug.com/1193282).
I believe this is a Parley level font selection question, rather than a Parley Core (soon to be Engine) thing?
Reproduction failing test (Fable authored, based on our Roboto not having NARROW NO-BREAK SPACE):
```rust
#[test]
fn space_like_char_missing_from_font_should_not_trigger_fallback() {
let mut env = TestEnv::new(test_name!(), None);
let text = "a\u{202F}b";
let mut builder = env.ranged_builder(text);
builder.push_default(StyleProperty::FontSize(2048.0));
let mut layout = builder.build(text);
layout.break_all_lines(None);
let num_runs: usize = layout.lines().map(|line| line.runs().count()).sum();
assert_eq!(
num_runs, 1,
"U+202F was itemized to a fallback font instead of using Roboto's space glyph"
);
assert_eq!(layout.width(), 2516.0);
}
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided space_like_char_missing_from_font_should_not_trigger_fallback test, using TestEnv, ranged_builder, and layout itemization as the entry points. Run the failing test and inspect how U+202F is assigned to a font. Done means the test passes with one run and the expected width, without causing fallback for the covered space-like characters.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 66/100