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

@ -9,7 +9,6 @@ use rustc_hash::{FxHashMap, FxHashSet};
use std::borrow::Cow;
use std::cell::RefCell;
use std::collections::hash_map;
use std::sync::Arc;
#[allow(missing_debug_implementations)]
pub struct Pipeline {
@ -32,9 +31,7 @@ impl Pipeline {
}
pub fn load_font(&mut self, bytes: Cow<'static, [u8]>) {
self.font_system.get_mut().db_mut().load_font_source(
cosmic_text::fontdb::Source::Binary(Arc::new(bytes.into_owned())),
);
self.font_system.load_font(bytes);
self.cache = RefCell::new(Cache::new());
}