Add function to get layout runs

This commit is contained in:
Jeremy Soller 2022-10-25 11:40:10 -06:00
parent 5603e30a29
commit 330a736136
No known key found for this signature in database
GPG key ID: 87F211AF2BE4C2FE
6 changed files with 254 additions and 238 deletions

View file

@ -25,6 +25,7 @@ use cosmic::{
use cosmic_text::{
FontMatches,
FontSystem,
SwashCache,
TextBuffer,
TextMetrics,
};
@ -63,6 +64,7 @@ pub struct Window {
theme: Theme,
path_opt: Option<PathBuf>,
buffer: Mutex<TextBuffer<'static>>,
cache: Mutex<SwashCache>,
}
#[allow(dead_code)]
@ -139,6 +141,7 @@ impl Application for Window {
theme: Theme::Dark,
path_opt: None,
buffer: Mutex::new(buffer),
cache: Mutex::new(SwashCache::new()),
};
if let Some(arg) = env::args().nth(1) {
window.open(PathBuf::from(arg));
@ -230,7 +233,7 @@ impl Application for Window {
.align_items(Alignment::Center)
.spacing(8)
,
text_box(&self.buffer)
text_box(&self.buffer, &self.cache)
]
.spacing(8)
.padding(16)