2023-02-04 11:12:15 +01:00
|
|
|
//! Load and use fonts.
|
2024-07-05 01:13:28 +02:00
|
|
|
use crate::Action;
|
2025-02-21 01:22:56 +01:00
|
|
|
use crate::task::{self, Task};
|
2023-02-04 11:12:15 +01:00
|
|
|
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.
|
2024-06-14 01:47:39 +02:00
|
|
|
pub fn load(bytes: impl Into<Cow<'static, [u8]>>) -> Task<Result<(), Error>> {
|
2024-07-05 01:13:28 +02:00
|
|
|
task::oneshot(|channel| Action::LoadFont {
|
2023-02-04 11:12:15 +01:00
|
|
|
bytes: bytes.into(),
|
2024-06-14 01:47:39 +02:00
|
|
|
channel,
|
2023-02-04 11:12:15 +01:00
|
|
|
})
|
|
|
|
|
}
|