diff --git a/Cargo.lock b/Cargo.lock index abbf2b79..649d0941 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -821,6 +821,7 @@ dependencies = [ "cosmic-config", "cosmic-protocols", "cosmic-settings-config", + "cosmic-text", "egui", "egui_plot", "i18n-embed", diff --git a/Cargo.toml b/Cargo.toml index 2e86d4da..0a73f9f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,7 @@ cosmic-comp-config = {path = "cosmic-comp-config"} cosmic-config = {git = "https://github.com/pop-os/libcosmic/", features = ["calloop", "macro"]} cosmic-protocols = {git = "https://github.com/pop-os/cosmic-protocols", rev = "e706814", default-features = false, features = ["server"]} cosmic-settings-config = { git = "https://github.com/pop-os/cosmic-settings-daemon" } +cosmic-text = { git = "https://github.com/pop-os/cosmic-text.git", features = ["shape-run-cache"] } libdisplay-info = "0.2.0" egui = {version = "0.30.0", optional = true} egui_plot = {version = "0.30.0", optional = true} diff --git a/src/utils/iced.rs b/src/utils/iced.rs index c00e6e8a..2c642de7 100644 --- a/src/utils/iced.rs +++ b/src/utils/iced.rs @@ -7,7 +7,7 @@ use std::{ use cosmic::{ iced::{ - advanced::widget::Tree, + advanced::{graphics::text::font_system, widget::Tree}, event::Event, futures::{FutureExt, StreamExt}, keyboard::{Event as KeyboardEvent, Modifiers as IcedModifiers}, @@ -1006,6 +1006,12 @@ where Result::<_, ()>::Ok(damage) }); + + // trim the shape cache + { + let mut font_system = font_system().write().unwrap(); + font_system.raw().shape_run_cache.trim(1024); + } } match MemoryRenderBufferRenderElement::from_buffer(