add contextual alternatives
This commit is contained in:
parent
50373cd6d7
commit
f5879b3425
2 changed files with 8 additions and 0 deletions
|
|
@ -134,6 +134,8 @@ pub struct FontFeatures {
|
||||||
pub standard_ligatures: bool,
|
pub standard_ligatures: bool,
|
||||||
/// Contextual ligatures (context-dependent ligatures)
|
/// Contextual ligatures (context-dependent ligatures)
|
||||||
pub contextual_ligatures: bool,
|
pub contextual_ligatures: bool,
|
||||||
|
/// Contextual alternates (glyph substitutions based on context)
|
||||||
|
pub contextual_alternates: bool,
|
||||||
/// Discretionary ligatures (optional stylistic ligatures)
|
/// Discretionary ligatures (optional stylistic ligatures)
|
||||||
pub discretionary_ligatures: bool,
|
pub discretionary_ligatures: bool,
|
||||||
}
|
}
|
||||||
|
|
@ -145,6 +147,7 @@ impl FontFeatures {
|
||||||
kerning: true,
|
kerning: true,
|
||||||
standard_ligatures: true,
|
standard_ligatures: true,
|
||||||
contextual_ligatures: true,
|
contextual_ligatures: true,
|
||||||
|
contextual_alternates: true,
|
||||||
discretionary_ligatures: true,
|
discretionary_ligatures: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,11 @@ fn shape_fallback(
|
||||||
attrs.font_features.contextual_ligatures as u32,
|
attrs.font_features.contextual_ligatures as u32,
|
||||||
0..usize::MAX,
|
0..usize::MAX,
|
||||||
));
|
));
|
||||||
|
features.push(rustybuzz::Feature::new(
|
||||||
|
rustybuzz::ttf_parser::Tag::from_bytes(b"calt"),
|
||||||
|
attrs.font_features.contextual_alternates as u32,
|
||||||
|
0..usize::MAX,
|
||||||
|
));
|
||||||
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"),
|
||||||
attrs.font_features.discretionary_ligatures as u32,
|
attrs.font_features.discretionary_ligatures as u32,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue