Replace skip_shaping boolean with Shaping enum

This commit is contained in:
Héctor Ramón Jiménez 2023-04-21 20:24:44 +02:00
parent ad111a1df1
commit 0f055c0a13
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
5 changed files with 67 additions and 62 deletions

View file

@ -12,7 +12,7 @@ use unicode_segmentation::UnicodeSegmentation;
use crate::Color;
use crate::{
Attrs, AttrsList, BorrowedWithFontSystem, BufferLine, FontSystem, LayoutGlyph, LayoutLine,
ShapeLine, Wrap,
ShapeLine, Shaping, Wrap,
};
/// Current cursor location
@ -331,7 +331,7 @@ impl Buffer {
redraw: false,
wrap: Wrap::Word,
};
buffer.set_text(font_system, "", Attrs::new(), true);
buffer.set_text(font_system, "", Attrs::new(), Shaping::Basic);
buffer
}
@ -567,14 +567,14 @@ impl Buffer {
font_system: &mut FontSystem,
text: &str,
attrs: Attrs,
skip_shaping: bool,
shaping: Shaping,
) {
self.lines.clear();
for line in text.lines() {
self.lines.push(BufferLine::new(
line.to_string(),
AttrsList::new(attrs),
skip_shaping,
shaping,
));
}
// Make sure there is always one line
@ -582,7 +582,7 @@ impl Buffer {
self.lines.push(BufferLine::new(
String::new(),
AttrsList::new(attrs),
skip_shaping,
shaping,
));
}
@ -781,9 +781,8 @@ impl<'a> BorrowedWithFontSystem<'a, Buffer> {
}
/// Set text of buffer, using provided attributes for each line by default
pub fn set_text(&mut self, text: &str, attrs: Attrs, skip_shaping: bool) {
self.inner
.set_text(self.font_system, text, attrs, skip_shaping);
pub fn set_text(&mut self, text: &str, attrs: Attrs, shaping: Shaping) {
self.inner.set_text(self.font_system, text, attrs, shaping);
}
/// Draw the buffer