Implement font::load command in iced_native

This commit is contained in:
Héctor Ramón Jiménez 2023-02-04 11:12:15 +01:00
parent b29de28d1f
commit 238154af4a
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
14 changed files with 384 additions and 241 deletions

View file

@ -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>);
}