Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions examples/ui/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,14 @@ use bevy::{
color::palettes::css::GOLD,
diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin},
prelude::*,
text::{CosmicFontSystem, FontFeatureTag, FontFeatures, Underline},
text::{FontFeatureTag, FontFeatures, Underline},
};

fn main() {
let mut app = App::new();
app.add_plugins((DefaultPlugins, FrameTimeDiagnosticsPlugin::default()))
.add_systems(Startup, setup)
.add_systems(Update, (text_update_system, text_color_system));

let mut f = app.world_mut().resource_mut::<CosmicFontSystem>();
f.db_mut().load_system_fonts();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to this pr, but is there any documentation or example of loading the system fonts?

Copy link
Contributor Author

@ickshonpe ickshonpe Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No not really, the support is quite half baked atm. The changes from #22156 just make it possible to use system fonts loaded with cosmic text's font database API. I just made an issue a moment ago, #22391, about adding an official system fonts example.


app.run();
}

Expand All @@ -40,7 +36,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
Underline,
TextFont {
// This font is loaded and will be used instead of the default font.
font: "Comic Sans MS".into(),
font: asset_server.load("fonts/FiraSans-Bold.ttf").into(),
font_size: 67.0,
..default()
},
Expand Down