From 544a41e69500e8fb284f6191432cfb308314b016 Mon Sep 17 00:00:00 2001 From: kernelkind Date: Tue, 17 Dec 2024 13:48:14 -0500 Subject: [PATCH] helper method for FontId Signed-off-by: kernelkind Signed-off-by: William Casarin --- crates/notedeck/src/style.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/notedeck/src/style.rs b/crates/notedeck/src/style.rs index 160e3e6b..2a890457 100644 --- 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()) + } }