feat: font size argument
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
@@ -15,4 +15,5 @@ pub struct RunnerMenuSettings {
|
||||
pub background_color: String,
|
||||
pub background_color_active: String,
|
||||
pub rows: u16,
|
||||
pub font_size: u16,
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
background_color: args.background_color,
|
||||
background_color_active: args.background_color_active,
|
||||
rows: args.rows,
|
||||
font_size: args.font_size,
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user