helper method for FontId

Signed-off-by: kernelkind <kernelkind@gmail.com>
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
kernelkind
2024-12-17 13:48:14 -05:00
committed by William Casarin
parent 3295124915
commit 544a41e695

View File

@@ -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())
}
}