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();
if attrs.font_features.kerning {
features.push(rustybuzz::Feature::new(
rustybuzz::ttf_parser::Tag::from_bytes(b"kern"),
1,
0..usize::MAX,
));
}
features.push(rustybuzz::Feature::new(
rustybuzz::ttf_parser::Tag::from_bytes(b"kern"),
if attrs.font_features.kerning { 1 } else { 0 },
0..usize::MAX,
));
if attrs.font_features.standard_ligatures {
features.push(rustybuzz::Feature::new(
rustybuzz::ttf_parser::Tag::from_bytes(b"liga"),
1,
0..usize::MAX,
));
}
features.push(rustybuzz::Feature::new(
rustybuzz::ttf_parser::Tag::from_bytes(b"liga"),
if attrs.font_features.standard_ligatures { 1 } else { 0 },
0..usize::MAX,
));
if attrs.font_features.contextual_ligatures {
features.push(rustybuzz::Feature::new(
rustybuzz::ttf_parser::Tag::from_bytes(b"clig"),
1,
0..usize::MAX,
));
}
features.push(rustybuzz::Feature::new(
rustybuzz::ttf_parser::Tag::from_bytes(b"clig"),
if attrs.font_features.contextual_ligatures { 1 } else { 0 },
0..usize::MAX,
));
if attrs.font_features.discretionary_ligatures {
features.push(rustybuzz::Feature::new(
rustybuzz::ttf_parser::Tag::from_bytes(b"dlig"),
1,
0..usize::MAX,
));
}
features.push(rustybuzz::Feature::new(
rustybuzz::ttf_parser::Tag::from_bytes(b"dlig"),
if attrs.font_features.discretionary_ligatures { 1 } else { 0 },
0..usize::MAX,
));
let shape_plan = rustybuzz::ShapePlan::new(
font.rustybuzz(),