Fix broken fonts in light theme
This commit is contained in:
40
src/app.rs
40
src/app.rs
@ -15,7 +15,7 @@ use crate::{
|
||||
};
|
||||
use egui::{
|
||||
Align, Button, Context, FontData, FontDefinitions, FontId, Image, Key, Modifiers,
|
||||
PointerButton, RichText, ScrollArea, Widget, include_image,
|
||||
PointerButton, RichText, ScrollArea, Theme, Widget, include_image,
|
||||
};
|
||||
use eyre::eyre;
|
||||
|
||||
@ -202,24 +202,26 @@ impl App {
|
||||
cc.egui_ctx.set_fonts(fonts);
|
||||
|
||||
// markdown font styles
|
||||
cc.egui_ctx.style_mut(|style| {
|
||||
for (name, size) in [
|
||||
("H1", 28.0),
|
||||
("H2", 26.0),
|
||||
("H3", 24.0),
|
||||
("H4", 22.0),
|
||||
("H5", 20.0),
|
||||
("H6", 18.0),
|
||||
] {
|
||||
style.text_styles.insert(
|
||||
egui::TextStyle::Name(name.into()),
|
||||
FontId {
|
||||
size,
|
||||
family: egui::FontFamily::Proportional,
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
for theme in [Theme::Dark, Theme::Light] {
|
||||
cc.egui_ctx.style_mut_of(theme, |style| {
|
||||
for (name, size) in [
|
||||
("H1", 28.0),
|
||||
("H2", 26.0),
|
||||
("H3", 24.0),
|
||||
("H4", 22.0),
|
||||
("H5", 20.0),
|
||||
("H6", 18.0),
|
||||
] {
|
||||
style.text_styles.insert(
|
||||
egui::TextStyle::Name(name.into()),
|
||||
FontId {
|
||||
size,
|
||||
family: egui::FontFamily::Proportional,
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// enable features on egui_extras to add more image types
|
||||
egui_extras::install_image_loaders(&cc.egui_ctx);
|
||||
|
||||
Reference in New Issue
Block a user