UPDATE: We can now change the font size!

This commit is contained in:
Nicolás Hatcher
2025-02-26 17:58:39 +01:00
committed by Nicolás Hatcher Andrés
parent 7bc563ef29
commit ce7318840d
5 changed files with 46 additions and 1 deletions

View File

@@ -127,6 +127,17 @@ fn update_style(old_value: &Style, style_path: &str, value: &str) -> Result<Styl
"font.color" => {
style.font.color = color(value)?;
}
"font.size_delta" => {
// This is a special case, we need to add the value to the current size
let size_delta: i32 = value
.parse()
.map_err(|_| format!("Invalid value for font size: '{value}'."))?;
let new_size = style.font.sz + size_delta;
if new_size < 1 {
return Err(format!("Invalid value for font size: '{new_size}'."));
}
style.font.sz = new_size;
}
"fill.bg_color" => {
style.fill.bg_color = color(value)?;
style.fill.pattern_type = "solid".to_string();