Skip to main content

load_font_from_bytes

Function load_font_from_bytes 

Source
pub fn load_font_from_bytes(bytes: &[u8]) -> Font
Expand description

Loads a .ttf/.otf font from bytes and returns the Font object. (Do not load the font every frame, it will lag)

ยงExamples

// Put this before the `flake::run()` to avoid loading it each frame
let font = load_font_from_bytes(include_bytes!("Arial.ttf"));

flake::run(|| {
    draw_text("Hello", 10.0, 10.0, 32.0, Some(&font), WHITE)
})