diff options
author | 2023-02-04 11:12:15 +0100 | |
---|---|---|
committer | 2023-02-24 13:29:11 +0100 | |
commit | 238154af4ac8dda7f12dd90aa7be106e933bcb30 (patch) | |
tree | 4c8560b3464f0c900ddf31a3c063e925394923c6 /native/src/text.rs | |
parent | b29de28d1f0f608f8029c93d154cfd1b0f8b8cbb (diff) | |
download | iced-238154af4ac8dda7f12dd90aa7be106e933bcb30.tar.gz iced-238154af4ac8dda7f12dd90aa7be106e933bcb30.tar.bz2 iced-238154af4ac8dda7f12dd90aa7be106e933bcb30.zip |
Implement `font::load` command in `iced_native`
Diffstat (limited to 'native/src/text.rs')
-rw-r--r-- | native/src/text.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/native/src/text.rs b/native/src/text.rs index b7915a55..1bbd36cc 100644 --- a/native/src/text.rs +++ b/native/src/text.rs @@ -2,6 +2,8 @@ use crate::alignment; use crate::{Color, Point, Rectangle, Size, Vector}; +use std::borrow::Cow; + /// A paragraph. #[derive(Debug, Clone, Copy)] pub struct Text<'a, Font> { @@ -72,7 +74,7 @@ pub trait Renderer: crate::Renderer { /// [`ICON_FONT`]: Self::ICON_FONT const ARROW_DOWN_ICON: char; - /// Returns the default [`Font`]. + /// Returns the default [`Self::Font`]. fn default_font(&self) -> Self::Font; /// Returns the default size of [`Text`]. @@ -112,6 +114,9 @@ pub trait Renderer: crate::Renderer { nearest_only: bool, ) -> Option<Hit>; + /// Loads a [`Self::Font`] from its bytes. + fn load_font(&mut self, font: Cow<'static, [u8]>); + /// Draws the given [`Text`]. fn fill_text(&mut self, text: Text<'_, Self::Font>); } |