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 05:06:27 -07:00 committed by GitHub
parent 7c5a2d60c5
commit a9c004d16b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -13,6 +13,9 @@ NOTE: [`eframe`](eframe/CHANGELOG.md), [`egui_web`](egui_web/CHANGELOG.md) and [
* [Progress bar](https://github.com/emilk/egui/pull/519)
* `Grid::num_columns`: allow the last column to take up the rest of the space of the parent `Ui`.
### Fixed 🐛
* Fix custom font definitions getting replaced when `pixels_per_point` is changed.
## 0.13.1 - 2021-06-28 - Plot fixes

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()
}),
)));
}
}