diff options
Diffstat (limited to 'graphics/src/compositor.rs')
-rw-r--r-- | graphics/src/compositor.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/graphics/src/compositor.rs b/graphics/src/compositor.rs index 86472a58..47521eb0 100644 --- a/graphics/src/compositor.rs +++ b/graphics/src/compositor.rs @@ -5,9 +5,11 @@ use crate::futures::{MaybeSend, MaybeSync}; use crate::{Error, Settings, Viewport}; use raw_window_handle::{HasDisplayHandle, HasWindowHandle}; -use std::future::Future; use thiserror::Error; +use std::borrow::Cow; +use std::future::Future; + /// A graphics compositor that can draw to windows. pub trait Compositor: Sized { /// The iced renderer of the backend. @@ -60,6 +62,14 @@ pub trait Compositor: Sized { /// Returns [`Information`] used by this [`Compositor`]. fn fetch_information(&self) -> Information; + /// Loads a font from its bytes. + fn load_font(&mut self, font: Cow<'static, [u8]>) { + crate::text::font_system() + .write() + .expect("Write to font system") + .load_font(font); + } + /// Presents the [`Renderer`] primitives to the next frame of the given [`Surface`]. /// /// [`Renderer`]: Self::Renderer @@ -168,6 +178,8 @@ impl Compositor for () { ) { } + fn load_font(&mut self, _font: Cow<'static, [u8]>) {} + fn fetch_information(&self) -> Information { Information { adapter: String::from("Null Renderer"), |