Fix examples

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

View file

@ -2,7 +2,7 @@
use cosmic_text::{ use cosmic_text::{
Action, Attrs, AttrsList, Buffer, BufferLine, Color, Edit, Editor, Family, FontSystem, Metrics, Action, Attrs, AttrsList, Buffer, BufferLine, Color, Edit, Editor, Family, FontSystem, Metrics,
Style, SwashCache, Weight, Shaping, Style, SwashCache, Weight,
}; };
use orbclient::{EventOption, Renderer, Window, WindowFlag}; use orbclient::{EventOption, Renderer, Window, WindowFlag};
use std::{ use std::{
@ -143,7 +143,7 @@ fn main() {
editor editor
.buffer_mut() .buffer_mut()
.lines .lines
.push(BufferLine::new(line_text, attrs_list)); .push(BufferLine::new(line_text, attrs_list, Shaping::Advanced));
} }
let mut swash_cache = SwashCache::new(); let mut swash_cache = SwashCache::new();

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT OR Apache-2.0 // SPDX-License-Identifier: MIT OR Apache-2.0
use cosmic_text::{Attrs, Buffer, Color, FontSystem, Metrics, SwashCache}; use cosmic_text::{Attrs, Buffer, Color, FontSystem, Metrics, Shaping, SwashCache};
use std::cmp::{self, Ordering}; use std::cmp::{self, Ordering};
use termion::{color, cursor}; use termion::{color, cursor};
@ -28,7 +28,7 @@ fn main() {
let attrs = Attrs::new(); let attrs = Attrs::new();
// Add some text! // Add some text!
buffer.set_text(" Hi, Rust! 🦀", attrs); buffer.set_text(" Hi, Rust! 🦀", attrs, Shaping::Advanced);
// Perform shaping as desired // Perform shaping as desired
buffer.shape_until_scroll(); buffer.shape_until_scroll();