chore: use cosmic-text shape cache

This commit is contained in:
Victoria Brekenfeld 2025-04-15 13:32:51 +02:00
parent 155f8d20d0
commit 67d3225ef5
3 changed files with 9 additions and 1 deletions

1
Cargo.lock generated
View file

@ -821,6 +821,7 @@ dependencies = [
"cosmic-config",
"cosmic-protocols",
"cosmic-settings-config",
"cosmic-text",
"egui",
"egui_plot",
"i18n-embed",

View file

@ -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}

View file

@ -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(