linebender / linebender/parley
Ligatures should be disabled when letter spacing is enabled
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 736
- Forks
- 120
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 53
Description
As the title suggests, ligatures should be disabled when letter spacing is requested. Otherwise, the clusters that are sent to breaking represent ligatures that cannot be broken up.
For example, in the below test, we produce this image. Note how "ffi" in office are out of place and how the "fi" and "fl" ligatures are not broken up like "ff".
```rs
#[test]
fn interaction_letter_spacing_ligatures() {
let mut env = TestEnv::new(test_name!(), None);
let text = samples::LIGATURES;
// Without letter spacing - ligatures should form (if font supports them)
let features_on = FontFeatures::List(Cow::Borrowed(&[FontFeature {
tag: Tag::new(b"liga"),
value: 1,
}]));
let mut builder_no_spacing = env.ranged_builder(text);
builder_no_spacing.push_default(StyleProperty::FontFeatures(features_on.clone()));
builder_no_spacing.push_default(StyleProperty::LetterSpacing(0.0));
let mut layout_no_spacing = builder_no_spacing.build(text);
layout_no_spacing.break_all_lines(None);
layout_no_spacing.align(None, Alignment::Start, AlignmentOptions::default());
env.with_name("no_spacing")
.check_layout_snapshot(&layout_no_spacing);
// With letter spacing - ligatures SHOULD break
let mut builder_with_spacing = env.ranged_builder(text);
builder_with_spacing.push_default(StyleProperty::FontFeatures(features_on));
builder_with_spacing.push_default(StyleProperty::LetterSpacing(2.0));
let mut layout_with_spacing = builder_with_spacing.build(text);
layout_with_spacing.break_all_lines(None);
layout_with_spacing.align(None, Alignment::Start, AlignmentOptions::default());
env.with_name("with_spacing")
.check_layout_snapshot(&layout_with_spacing);
}
```
Seen in https://github.com/linebender/parley/pull/503
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 by running the interaction_letter_spacing_ligatures test shown in the issue and compare its no_spacing and with_spacing snapshots. Trace the layout path used by that test; done means ligatures form without letter spacing but are disabled and breakable when letter spacing is nonzero.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100