improv: reuse loaded fonts by cosmic-text for svg renderer

This commit is contained in:
Hojjat 2026-05-29 17:16:30 -06:00 committed by Michael Murphy
parent ebb3b125bf
commit 5013f63956
2 changed files with 18 additions and 5 deletions

View file

@ -161,6 +161,14 @@ impl FontSystem {
&mut self.raw
}
/// Returns a reference to the underlying [`fontdb::Database`].
///
/// Unlike going through [`raw`](Self::raw) and `db_mut`, this does not
/// clear `cosmic-text`'s internal font-match cache.
pub fn db(&self) -> &cosmic_text::fontdb::Database {
self.raw.db()
}
/// Loads a font from its bytes.
pub fn load_font(&mut self, bytes: Cow<'static, [u8]>) {
if let Cow::Borrowed(bytes) = bytes {