diff --git a/src/arguments.rs b/src/arguments.rs index 368a7b4..9c9d211 100644 --- a/src/arguments.rs +++ b/src/arguments.rs @@ -1,7 +1,7 @@ use clap::Parser; use crate::config::{ - BACKGROUND_COLOR, BACKGROUND_COLOR_ACTIVE, FONT_COLOR, FONT_COLOR_ACTIVE, + BACKGROUND_COLOR, BACKGROUND_COLOR_ACTIVE, FONT_COLOR, FONT_COLOR_ACTIVE, FONT_POINT_SIZE, MAX_ITEM_DISPLAY_COUNT, }; @@ -25,4 +25,7 @@ pub struct Arguments { #[arg(short, long, help = "The amount of items to display at once", default_value_t = MAX_ITEM_DISPLAY_COUNT)] pub rows: u16, + + #[arg(long, help = "The menu's font size", default_value_t = FONT_POINT_SIZE)] + pub font_size: u16, } diff --git a/src/config.rs b/src/config.rs index a69efd9..83f53dd 100644 --- a/src/config.rs +++ b/src/config.rs @@ -15,4 +15,5 @@ pub struct RunnerMenuSettings { pub background_color: String, pub background_color_active: String, pub rows: u16, + pub font_size: u16, } diff --git a/src/main.rs b/src/main.rs index baaeb9b..97a4eda 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,6 +29,7 @@ fn main() -> Result<(), Box> { background_color: args.background_color, background_color_active: args.background_color_active, rows: args.rows, + font_size: args.font_size, }, ); diff --git a/src/runner/mod.rs b/src/runner/mod.rs index b9bbb0b..8598f55 100644 --- a/src/runner/mod.rs +++ b/src/runner/mod.rs @@ -12,7 +12,7 @@ use sdl2::{ }; use crate::{ - config::{RunnerMenuSettings, FONT_POINT_SIZE, LINE_SPACING, PADDING}, + config::{RunnerMenuSettings, LINE_SPACING, PADDING}, utils::color_from_hex, }; @@ -39,7 +39,7 @@ impl Runner { let font_path = String::from("/usr/share/fonts/OTF/GeistMonoNerdFontMono-Regular.otf"); let font = ttf - .load_font(font_path.clone(), FONT_POINT_SIZE) + .load_font(font_path.clone(), settings.font_size) .expect(&format!("Error loading font {}", font_path)); window_height = @@ -92,7 +92,7 @@ impl Runner { let font = self .ttf - .load_font(font_path.clone(), FONT_POINT_SIZE) + .load_font(font_path.clone(), self.settings.font_size) .expect(&format!("Error loading font {}", font_path)); let creator = self.canvas.texture_creator();