Use cosmic-text shape-run-cache
This commit is contained in:
parent
19f5b6e0eb
commit
bf7668dbd7
4 changed files with 8 additions and 15 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
|
@ -953,8 +953,8 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cosmic-text"
|
name = "cosmic-text"
|
||||||
version = "0.10.0"
|
version = "0.11.1"
|
||||||
source = "git+https://github.com/pop-os/cosmic-text.git#be471833c9ee563866f07593354a41dd40761a18"
|
source = "git+https://github.com/pop-os/cosmic-text.git#cb447ea8c6717d558994575b93a00baa549d01f8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.4.2",
|
"bitflags 2.4.2",
|
||||||
"fontdb",
|
"fontdb",
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ palette = "0.7"
|
||||||
|
|
||||||
[dependencies.cosmic-text]
|
[dependencies.cosmic-text]
|
||||||
git = "https://github.com/pop-os/cosmic-text.git"
|
git = "https://github.com/pop-os/cosmic-text.git"
|
||||||
|
features = ["shape-run-cache"]
|
||||||
|
|
||||||
[dependencies.libcosmic]
|
[dependencies.libcosmic]
|
||||||
git = "https://github.com/pop-os/libcosmic.git"
|
git = "https://github.com/pop-os/libcosmic.git"
|
||||||
|
|
|
||||||
|
|
@ -371,6 +371,8 @@ impl Terminal {
|
||||||
buffer.set_size(font_system.raw(), width as f32, height as f32);
|
buffer.set_size(font_system.raw(), width as f32, height as f32);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
self.needs_update = true;
|
||||||
|
|
||||||
log::debug!("resize {:?}", instant.elapsed());
|
log::debug!("resize {:?}", instant.elapsed());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -780,9 +782,11 @@ impl Terminal {
|
||||||
buffer.set_redraw(true);
|
buffer.set_redraw(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Shape and trim shape run cache
|
||||||
{
|
{
|
||||||
let mut font_system = font_system().write().unwrap();
|
let mut font_system = font_system().write().unwrap();
|
||||||
buffer.shape_until_scroll(font_system.raw(), true);
|
buffer.shape_until_scroll(font_system.raw(), true);
|
||||||
|
font_system.raw().shape_run_cache.trim(1024);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ use alacritty_terminal::{
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
cosmic_theme::palette::{blend::Compose, WithAlpha},
|
cosmic_theme::palette::{blend::Compose, WithAlpha},
|
||||||
iced::{
|
iced::{
|
||||||
advanced::graphics::text::{font_system, Raw},
|
advanced::graphics::text::Raw,
|
||||||
event::{Event, Status},
|
event::{Event, Status},
|
||||||
keyboard::{Event as KeyEvent, KeyCode, Modifiers},
|
keyboard::{Event as KeyEvent, KeyCode, Modifiers},
|
||||||
mouse::{self, Button, Event as MouseEvent, ScrollDelta},
|
mouse::{self, Button, Event as MouseEvent, ScrollDelta},
|
||||||
|
|
@ -147,12 +147,6 @@ where
|
||||||
terminal.needs_update = false;
|
terminal.needs_update = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure terminal is shaped
|
|
||||||
terminal.with_buffer_mut(|buffer| {
|
|
||||||
let mut font_system = font_system().write().unwrap();
|
|
||||||
buffer.shape_until_scroll(font_system.raw(), true);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Calculate layout lines
|
// Calculate layout lines
|
||||||
terminal.with_buffer(|buffer| {
|
terminal.with_buffer(|buffer| {
|
||||||
let mut layout_lines = 0;
|
let mut layout_lines = 0;
|
||||||
|
|
@ -250,12 +244,6 @@ where
|
||||||
terminal.needs_update = false;
|
terminal.needs_update = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure terminal is shaped
|
|
||||||
terminal.with_buffer_mut(|buffer| {
|
|
||||||
let mut font_system = font_system().write().unwrap();
|
|
||||||
buffer.shape_until_scroll(font_system.raw(), true);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Render default background
|
// Render default background
|
||||||
{
|
{
|
||||||
let meta = &terminal.metadata_set[terminal.default_attrs().metadata];
|
let meta = &terminal.metadata_set[terminal.default_attrs().metadata];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue