Invalidate existing paragraphs when new fonts are loaded

This commit is contained in:
Héctor Ramón Jiménez 2023-09-09 11:21:32 +02:00
parent 837529bc99
commit 3450987355
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
6 changed files with 127 additions and 33 deletions

View file

@ -7,7 +7,6 @@ use crate::layer::Text;
use std::borrow::Cow;
use std::cell::RefCell;
use std::sync::Arc;
#[allow(missing_debug_implementations)]
pub struct Pipeline {
@ -47,9 +46,7 @@ impl Pipeline {
}
pub fn load_font(&mut self, bytes: Cow<'static, [u8]>) {
let _ = self.font_system.get_mut().db_mut().load_font_source(
glyphon::fontdb::Source::Binary(Arc::new(bytes.into_owned())),
);
self.font_system.load_font(bytes);
self.cache = RefCell::new(Cache::new());
}