Allow Shaping::Basic only if swash feature is enabled

This commit is contained in:
Héctor Ramón Jiménez 2023-04-21 20:47:02 +02:00
parent 0dce8b75d1
commit 87d75531b7
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
2 changed files with 4 additions and 1 deletions

View file

@ -331,7 +331,7 @@ impl Buffer {
redraw: false, redraw: false,
wrap: Wrap::Word, wrap: Wrap::Word,
}; };
buffer.set_text(font_system, "", Attrs::new(), Shaping::Basic); buffer.set_text(font_system, "", Attrs::new(), Shaping::Advanced);
buffer buffer
} }

View file

@ -21,6 +21,7 @@ pub enum Shaping {
/// ///
/// You should use this strategy when you have complete control of the text /// You should use this strategy when you have complete control of the text
/// and the font you are displaying in your application. /// and the font you are displaying in your application.
#[cfg(feature = "swash")]
Basic, Basic,
/// Advanced text shaping and font fallback. /// Advanced text shaping and font fallback.
/// ///
@ -41,6 +42,7 @@ impl Shaping {
span_rtl: bool, span_rtl: bool,
) -> Vec<ShapeGlyph> { ) -> Vec<ShapeGlyph> {
match self { match self {
#[cfg(feature = "swash")]
Self::Basic => shape_skip(font_system, line, attrs_list, start_run, end_run), Self::Basic => shape_skip(font_system, line, attrs_list, start_run, end_run),
Self::Advanced => { Self::Advanced => {
shape_run(font_system, line, attrs_list, start_run, end_run, span_rtl) shape_run(font_system, line, attrs_list, start_run, end_run, span_rtl)
@ -251,6 +253,7 @@ fn shape_run(
glyphs glyphs
} }
#[cfg(feature = "swash")]
fn shape_skip( fn shape_skip(
font_system: &mut FontSystem, font_system: &mut FontSystem,
line: &str, line: &str,