From 115c81583e78e2c6509d39801dc45ea157d61de8 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Mon, 11 Oct 2021 18:53:28 +0900 Subject: [PATCH] Minor tweaks to font size of title/artist --- src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3df060e..660bc1f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,6 +21,7 @@ const TIME_MAX_DIFF: f64 = 2.0f64; const INITIAL_FONT_SIZE: u16 = 96; const TITLE_INITIAL_FONT_SIZE: u16 = 196; const TITLE_INITIAL_MIN_FONT_SIZE: u16 = 44; +const TITLE_SCREEN_FACTOR: u16 = 800; const ARTIST_INITIAL_FONT_SIZE: u16 = 48; const TIMER_FONT_SIZE: u16 = 64; const SCREEN_DIFF_MARGIN: f32 = 1.0; @@ -887,11 +888,12 @@ async fn main() -> Result<(), String> { // Get title dimensions early so that artist size is at most title size if !title.is_empty() && !opt.disable_show_title && title_dim_opt.is_none() { let mut length: u16 = title.chars().count().try_into().unwrap_or(u16::MAX); - length /= 8; + length /= 10; if length <= 2 { length = 3; } - title_font_size = TITLE_INITIAL_FONT_SIZE / length as u16; + let screen_factor = 4 * screen_width() as u16 / TITLE_SCREEN_FACTOR; + title_font_size = TITLE_INITIAL_FONT_SIZE / length as u16 + screen_factor; if title_font_size < TITLE_INITIAL_MIN_FONT_SIZE { title_font_size = TITLE_INITIAL_MIN_FONT_SIZE; }