more explicit about setting features

This commit is contained in:
Stewart Connor 2025-03-21 17:12:38 +11:00
parent d071d1a1c3
commit 81ca98d5db

View file

@ -144,37 +144,29 @@ fn shape_fallback(
let mut features = Vec::new(); let mut features = Vec::new();
if attrs.font_features.kerning {
features.push(rustybuzz::Feature::new( features.push(rustybuzz::Feature::new(
rustybuzz::ttf_parser::Tag::from_bytes(b"kern"), rustybuzz::ttf_parser::Tag::from_bytes(b"kern"),
1, if attrs.font_features.kerning { 1 } else { 0 },
0..usize::MAX, 0..usize::MAX,
)); ));
}
if attrs.font_features.standard_ligatures {
features.push(rustybuzz::Feature::new( features.push(rustybuzz::Feature::new(
rustybuzz::ttf_parser::Tag::from_bytes(b"liga"), rustybuzz::ttf_parser::Tag::from_bytes(b"liga"),
1, if attrs.font_features.standard_ligatures { 1 } else { 0 },
0..usize::MAX, 0..usize::MAX,
)); ));
}
if attrs.font_features.contextual_ligatures {
features.push(rustybuzz::Feature::new( features.push(rustybuzz::Feature::new(
rustybuzz::ttf_parser::Tag::from_bytes(b"clig"), rustybuzz::ttf_parser::Tag::from_bytes(b"clig"),
1, if attrs.font_features.contextual_ligatures { 1 } else { 0 },
0..usize::MAX, 0..usize::MAX,
)); ));
}
if attrs.font_features.discretionary_ligatures {
features.push(rustybuzz::Feature::new( features.push(rustybuzz::Feature::new(
rustybuzz::ttf_parser::Tag::from_bytes(b"dlig"), rustybuzz::ttf_parser::Tag::from_bytes(b"dlig"),
1, if attrs.font_features.discretionary_ligatures { 1 } else { 0 },
0..usize::MAX, 0..usize::MAX,
)); ));
}
let shape_plan = rustybuzz::ShapePlan::new( let shape_plan = rustybuzz::ShapePlan::new(
font.rustybuzz(), font.rustybuzz(),