Skip to content

Commit

Permalink
Display warning when font not found
Browse files Browse the repository at this point in the history
  • Loading branch information
Zerthox committed Aug 11, 2024
1 parent 9120d44 commit eea8388
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/elements/text/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ use crate::{
component_wise::ComponentWise,
context::{Context, ContextUpdate, EditState},
render_util::{
debug_optional, draw_text_bg, font_select, helper, input_text_multi_with_menu, Font, Rect,
debug_optional, draw_text_bg, font_select, helper, helper_warn, input_text_multi_with_menu,
Font, Rect,
},
traits::{Render, RenderDebug, RenderOptions},
tree::TreeLeaf,
Expand Down Expand Up @@ -169,6 +170,9 @@ impl RenderOptions for Text {
if font_select(ui, "Font", &mut self.loaded_font) {
self.font_name = self.loaded_font.map(|font| font.name_owned());
}
if self.font_name.is_some() && self.loaded_font.is_none() {
helper_warn(ui, || ui.text("Failed to find font"));
}

self.props.base.render_options(ui, state);
}
Expand Down

0 comments on commit eea8388

Please sign in to comment.