Fix custom font definitions getting replaced when pixels_per_point is changed (#564)

- This bug is most noticable when default fonts are disabled.
This commit is contained in:
Jay Oster
2021-07-20 14:06:27 +02:00
committed by GitHub
parent 7c5a2d60c5
commit a9c004d16b
2 changed files with 9 additions and 1 deletions
+6 -1
View File
@@ -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()
}),
)));
}
}