I am trying to build a rust game that requires text rendering. The way that I found is:
let font:&Font = &ttf_context.load_font(FONT_PATH, 128)?;
My issue is that this requires the built binary to need to have the font file. What I want is for the binary to contain the font file within itself.
I briefly tried using include_bytes!()
and include_dir!()
but I couldn't seem to get them to work with &ttf_context.load_font()
which expects a &str of the path which just brings me back to the original problem and I get the error "Couldn't open ./assets/Font.ttf"
Is there a way to include the font file in a way such I can still get its path or is there a different way I should render text?
Edit 1: Can I combine the binary and assets folder into a single file such as a .app
file for macOS or .exe
on windows?