diff options
Diffstat (limited to 'graphics/src/backend.rs')
-rw-r--r-- | graphics/src/backend.rs | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/graphics/src/backend.rs b/graphics/src/backend.rs index 256b7ab5..ae89da06 100644 --- a/graphics/src/backend.rs +++ b/graphics/src/backend.rs @@ -1,8 +1,10 @@ //! Write a graphics backend. -use iced_native::image; -use iced_native::svg; -use iced_native::text; -use iced_native::{Font, Point, Size}; +use iced_core::image; +use iced_core::svg; +use iced_core::text; +use iced_core::{Font, Point, Size}; + +use std::borrow::Cow; /// The graphics backend of a [`Renderer`]. /// @@ -31,6 +33,9 @@ pub trait Text { /// [`ICON_FONT`]: Self::ICON_FONT const ARROW_DOWN_ICON: char; + /// Returns the default [`Font`]. + fn default_font(&self) -> Font; + /// Returns the default size of text. fn default_size(&self) -> f32; @@ -41,8 +46,10 @@ pub trait Text { &self, contents: &str, size: f32, + line_height: text::LineHeight, font: Font, bounds: Size, + shaping: text::Shaping, ) -> (f32, f32); /// Tests whether the provided point is within the boundaries of [`Text`] @@ -56,11 +63,16 @@ pub trait Text { &self, contents: &str, size: f32, + line_height: text::LineHeight, font: Font, bounds: Size, + shaping: text::Shaping, point: Point, nearest_only: bool, ) -> Option<text::Hit>; + + /// Loads a [`Font`] from its bytes. + fn load_font(&mut self, font: Cow<'static, [u8]>); } /// A graphics backend that supports image rendering. |