Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions rustortion-standalone/src/gui/components/dialogs/tuner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ impl TunerDisplay {

column![
text(bar_str)
.font(iced::Font::MONOSPACE)
.size(24)
.style(move |_: &iced::Theme| iced::widget::text::Style { color: Some(color) }),
row![
Expand Down Expand Up @@ -188,7 +187,6 @@ impl TunerDisplay {
} else {
column![
text("\u{2502}")
.font(iced::Font::MONOSPACE)
.size(24)
.style(|_: &iced::Theme| iced::widget::text::Style {
color: Some(Color::from_rgb(0.3, 0.3, 0.3)),
Expand Down
3 changes: 3 additions & 0 deletions rustortion-standalone/src/gui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub use app::AmplifierApp;
pub use rustortion_ui::messages::Message;

use crate::settings::Settings;
use rustortion_ui::font::{EMBEDDED_FONT, EMBEDDED_FONT_BYTES};

pub fn start(settings: Settings) -> iced::Result {
iced::application(
Expand All @@ -19,6 +20,8 @@ pub fn start(settings: Settings) -> iced::Result {
min_size: Some(iced::Size::new(800.0, 600.0)),
..iced::window::Settings::default()
})
.font(EMBEDDED_FONT_BYTES)
.default_font(EMBEDDED_FONT)
.theme(AmplifierApp::theme)
.title("Rustortion")
.run()
Expand Down
Binary file added rustortion-ui/assets/Inter-Regular.ttf
Binary file not shown.
10 changes: 10 additions & 0 deletions rustortion-ui/src/font.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/// Embedded font bytes (Inter Regular, SIL Open Font License).
///
/// Bundling a font guarantees text renders on all systems regardless of which
/// system fonts are installed. Without this, iced falls back through
/// cosmic-text's hardcoded list (Noto Sans, DejaVu Sans, ...) and text
/// silently disappears on systems that lack those fonts.
pub const EMBEDDED_FONT_BYTES: &[u8] = include_bytes!("../assets/Inter-Regular.ttf");

/// The [`iced::Font`] that references the embedded font by name.
pub const EMBEDDED_FONT: iced::Font = iced::Font::with_name("Inter");
1 change: 1 addition & 0 deletions rustortion-ui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
pub mod app;
pub mod backend;
pub mod components;
pub mod font;
pub mod handlers;
pub mod hotkey;
pub mod i18n;
Expand Down