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/font.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/font.rs')
-rw-r--r-- | native/src/font.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/native/src/font.rs b/native/src/font.rs new file mode 100644 index 00000000..6840a25f --- /dev/null +++ b/native/src/font.rs @@ -0,0 +1,19 @@ +//! Load and use fonts. +pub use iced_core::Font; + +use crate::command::{self, Command}; +use std::borrow::Cow; + +/// An error while loading a font. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Error {} + +/// Load a font from its bytes. +pub fn load( + bytes: impl Into<Cow<'static, [u8]>>, +) -> Command<Result<(), Error>> { + Command::single(command::Action::LoadFont { + bytes: bytes.into(), + tagger: Box::new(std::convert::identity), + }) +} |