commit 544a41e69500e8fb284f6191432cfb308314b016
parent 32951249159bec08560168d448d109ed8050b4a3
Author: kernelkind <kernelkind@gmail.com>
Date: Tue, 17 Dec 2024 13:48:14 -0500
helper method for FontId
Signed-off-by: kernelkind <kernelkind@gmail.com>
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/crates/notedeck/src/style.rs b/crates/notedeck/src/style.rs
@@ -1,7 +1,9 @@
-use egui::{FontFamily, TextStyle};
+use egui::{Context, FontFamily, FontId, TextStyle};
use strum_macros::EnumIter;
+use crate::fonts::get_font_size;
+
#[derive(Copy, Clone, Eq, PartialEq, Debug, EnumIter)]
pub enum NotedeckTextStyle {
Heading,
@@ -43,4 +45,8 @@ impl NotedeckTextStyle {
Self::Tiny => FontFamily::Proportional,
}
}
+
+ pub fn get_font_id(&self, ctx: &Context) -> FontId {
+ FontId::new(get_font_size(ctx, self), self.font_family())
+ }
}