Skip to main content

load_font_from_path

Function load_font_from_path 

Source
pub fn load_font_from_path(path: &str) -> Font
Expand description

Loads a .ttf/.otf font from path 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_path("src/Arial.ttf");

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