-
Notifications
You must be signed in to change notification settings - Fork 64
Open
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".
#[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 #503
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels