Skip to content

Commit 0946a59

Browse files
authored
perf(fonts): use font atlas for faster lookups (#123)
1 parent 6d9b9a7 commit 0946a59

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ratatui-core = { version = "0.1.0-alpha.6", features = ["underline-color"] }
1919
thiserror = { version = "2.0.16", default-features = false }
2020
embedded-graphics = "0.8.1"
2121
embedded-graphics-simulator = "0.7.0"
22-
embedded-graphics-unicodefonts = "0.1.0"
22+
embedded-graphics-unicodefonts = "0.2.0"
2323
weact-studio-epd = { version = "0.1.2", features = ["blocking"] }
2424
ratatui = { version = "0.30.0-alpha.5", default-features = false }
2525
rstest = "0.25.0"

mousefood/src/backend.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ where
5656
fn default() -> Self {
5757
Self {
5858
flush_callback: Box::new(|_| {}),
59-
font_regular: default_font::regular,
59+
font_regular: default_font::get_regular(),
6060
font_bold: None,
6161
font_italic: None,
6262
vertical_alignment: TerminalAlignment::Start,

mousefood/src/default_font.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#[cfg(feature = "fonts")]
2-
pub use embedded_graphics_unicodefonts::MONO_6X10 as regular;
2+
pub use embedded_graphics_unicodefonts::mono_6x10_atlas as get_regular;
33

44
#[cfg(not(feature = "fonts"))]
5-
pub use embedded_graphics::mono_font::ascii::FONT_6X10 as regular;
5+
pub fn get_regular() -> embedded_graphics::mono_font::MonoFont<'static> {
6+
embedded_graphics::mono_font::ascii::FONT_6X10
7+
}

0 commit comments

Comments
 (0)