-
Hey there! In #8445, a technique to change the font is mentioned. I don't particularly love this method, mostly because I want to alter the TextPlugin's defaults instead of checking to see if there's a font I should replace each frame. Are there any methods to change the default font that are more like the following for 0.12.1? use bevy::{prelude::*, text::TextPlugin};
fn main() {
App::new()
.add_plugins(DefaultPlugins.set(TextPlugin.with_some_config(ThatChangesTheFont::new())))
.run();
}
Official SupportThe Bevy 0.11 release notes mention that you can now change the default font, but doesn't exactly state how to do so. Does anyone have experience with setting the global default font? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
If I understood the example correctly, you don't need to do that each frame, it's only one time when your font is loaded. |
Beta Was this translation helpful? Give feedback.
Bevy itself is embedding a tiny stripped-down font in the binary, bypassing the asset server. But the example you linked is making the assumption that you want to load a normal font the normal way through the asset server and not bloat up your binary. In that case, you need to poll until the font is actually loaded (an asynchronous process that may take more than one frame) before you can replace it.
If you're okay with embedding the font, I think you can simplify like this: