Handle the case where configured font name is not available
This can happen if configured font name is uninstalled for example. Pick the first font name available if that's the case. Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
This commit is contained in:
parent
5eba6eb4d6
commit
59804dc8ab
1 changed files with 8 additions and 0 deletions
|
|
@ -247,6 +247,14 @@ impl App {
|
|||
}
|
||||
|
||||
fn set_curr_font_weights_and_stretches(&mut self) {
|
||||
// check if config font_name is available first, if not, set it to first name in list
|
||||
if !self.font_names.contains(&self.config.font_name) {
|
||||
log::error!("'{}' is not in the font list", self.config.font_name);
|
||||
log::error!("setting font name to '{}'", self.font_names[0]);
|
||||
self.config.font_name = self.font_names[0].clone();
|
||||
let _ = self.save_config();
|
||||
}
|
||||
|
||||
let curr_font_faces = &self.font_name_faces_map[&self.config.font_name];
|
||||
|
||||
self.curr_font_stretches = curr_font_faces
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue