v1.2.2: text measuring improvements, minor code clean

fixed some clippy warnings, ignored many that I do not care about. also, added demo video and updated koxinga image
This commit is contained in:
stjet
2025-09-28 04:39:41 +00:00
parent 10daa9982b
commit 40f6795163
24 changed files with 173 additions and 119 deletions

View File

@@ -152,11 +152,11 @@ impl WindowLike for AudioPlayer {
let current = &queue[queue.len() - sink_len];
let current_name = current.0.file_name().unwrap().to_string_lossy().into_owned();
let fonts = ["nimbus-roman".to_string(), "shippori-mincho".to_string()];
let cn_width = measure_text(&fonts, current_name.clone()).width;
let cn_width = measure_text(&fonts, &current_name, None).width;
instructions.push(DrawInstructions::Text([self.dimensions[0] / 2 - cn_width / 2, 2], fonts.to_vec(), current_name.clone(), theme_info.text, theme_info.background, Some(0), None));
if let Some(artist) = &current.2 {
let artist_string = "by ".to_string() + &artist;
let as_width = measure_text(&fonts, artist_string.clone()).width;
let as_width = measure_text(&fonts, &artist_string, None).width;
instructions.push(DrawInstructions::Text([self.dimensions[0] / 2 - as_width / 2, LINE_HEIGHT + 2], fonts.to_vec(), artist_string, theme_info.text, theme_info.background, Some(0), None));
}
//in this case no chance of mincho so MONO_WIDTH method of calculating width is ok