use_font_data

Function use_font_data 

Source
pub fn use_font_data<F>(closure: F) -> Rc<Font>
where F: Fn() -> &'static [u8],
Expand description

Get a from data.

A font is a rather heavy resource, the best way to use it is probably to create it once and pass it down using a context or prop drilling.

Example:

use appy::{*, hooks::*, components::*, types::*};

#[main_window]
pub fn main()->Elements {
    let font=use_font_data(||include_bytes!("../core/Roboto-Regular.ttf"));

    apx!{
	    <Text text="Hello World" font=font size=100/>
    }
}