Fix custom font definitions getting replaced when `pixels_per_point` is changed
This bug is most noticable when default fonts are disabled.
@@ -578,7 +578,12 @@ impl Context {
if self.fonts.is_none() || new_font_definitions.is_some() || pixels_per_point_changed {
self.fonts = Some(Arc::new(Fonts::from_definitions(
pixels_per_point,
- new_font_definitions.unwrap_or_default(),
+ new_font_definitions.unwrap_or_else(|| {
+ self.fonts
+ .as_ref()
+ .map(|font| font.definitions().clone())
+ .unwrap_or_default()
+ }),
)));
}
}
