summaryrefslogtreecommitdiffstats
path: root/native/src/font.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2023-02-24 20:52:10 +0100
committerLibravatar GitHub <noreply@github.com>2023-02-24 20:52:10 +0100
commit368cadd25a8b57ee5c41e45d1abe8d1dfb194c69 (patch)
tree191cb7cc7807a5fe513b3d485b2fda21d3bf0bde /native/src/font.rs
parent573d27eb52bbfacf1b06983b4282f00eb5265bdc (diff)
parent8059c40142d601588e01c152ce1bb72a1295dde8 (diff)
downloadiced-368cadd25a8b57ee5c41e45d1abe8d1dfb194c69.tar.gz
iced-368cadd25a8b57ee5c41e45d1abe8d1dfb194c69.tar.bz2
iced-368cadd25a8b57ee5c41e45d1abe8d1dfb194c69.zip
Merge pull request #1697 from iced-rs/text-glyphon
Text shaping, font fallback, and `iced_wgpu` overhaul
Diffstat (limited to 'native/src/font.rs')
-rw-r--r--native/src/font.rs19
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..15359694
--- /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),
+ })
+}