Skip to content

Commit f0014bf

Browse files
committed
Remove system_fonts references and code that was left over from before be71200
1 parent 52d1640 commit f0014bf

File tree

4 files changed

+1
-56
lines changed

4 files changed

+1
-56
lines changed

Cargo.toml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2174,16 +2174,6 @@ description = "Demonstrates how the to use the size constraints to control the s
21742174
category = "UI (User Interface)"
21752175
wasm = true
21762176

2177-
[[example]]
2178-
name = "system_fonts"
2179-
path = "examples/ui/system_fonts.rs"
2180-
2181-
[package.metadata.example.system_fonts]
2182-
name = "System Fonts"
2183-
description = "Demonstrates using system fonts."
2184-
category = "UI (User Interface)"
2185-
wasm = false
2186-
21872177
[[example]]
21882178
name = "text"
21892179
path = "examples/ui/text.rs"

crates/bevy_text/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
//! and is distinguished by its style (e.g. italic), its weight (e.g. bold) and its stretch (e.g. condensed).
1010
//!
1111
//! In Bevy, [`Font`]s are loaded by the [`FontLoader`](FontLoader) as assets,
12-
//! or they can be loaded as system fonts through [`TextPipeline::load_system_fonts`].
1312
//!
1413
//! # `TextPipeline`
1514
//!

crates/bevy_text/src/pipeline.rs

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ use bevy_math::Vec2;
66
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
77
use bevy_render::texture::Image;
88
use bevy_sprite::TextureAtlas;
9-
use bevy_utils::{
10-
tracing::{error, info, warn},
11-
HashMap,
12-
};
9+
use bevy_utils::{tracing::warn, HashMap};
1310

1411
use cosmic_text::{Attrs, Buffer, Metrics, Shaping, Wrap};
1512

@@ -42,19 +39,6 @@ impl Default for FontSystem {
4239
}
4340
}
4441

45-
impl FontSystem {
46-
fn load_system_fonts(&mut self) {
47-
match self.0.try_lock() {
48-
Ok(mut font_system) => {
49-
font_system.db_mut().load_system_fonts();
50-
}
51-
Err(err) => {
52-
error!("Failed to acquire mutex: {:?}", err);
53-
}
54-
};
55-
}
56-
}
57-
5842
/// A wrapper around a [`cosmic_text::SwashCache`]
5943
pub struct SwashCache(cosmic_text::SwashCache);
6044

@@ -301,33 +285,6 @@ impl TextPipeline {
301285
buffer: Mutex::new(buffer),
302286
})
303287
}
304-
305-
/// Attempts to load system fonts.
306-
///
307-
/// Supports Windows, Linux and macOS.
308-
///
309-
/// System fonts loading is a surprisingly complicated task,
310-
/// mostly unsolvable without interacting with system libraries.
311-
/// And since [`fontdb`](cosmic_text::fontdb) tries to be small and portable, this method
312-
/// will simply scan some predefined directories.
313-
/// Which means that fonts that are not in those directories must
314-
/// be added manually.
315-
///
316-
/// This allows access to any installed system fonts
317-
///
318-
/// # Timing
319-
///
320-
/// This function takes some time to run. On the release build, it can take up to a second,
321-
/// while debug builds can take up to ten times longer. For this reason, it should only be
322-
/// called once, and the resulting [`FontSystem`] should be shared.
323-
///
324-
/// This should ideally run in a background thread.
325-
// TODO: This should run in a background thread.
326-
pub fn load_system_fonts(&mut self) {
327-
info!("Loading system fonts");
328-
self.font_system.load_system_fonts();
329-
info!("Loaded system fonts");
330-
}
331288
}
332289

333290
/// Render information for a corresponding [`Text`](crate::Text) component.

examples/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,6 @@ Example | Description
364364
[Overflow and Clipping Debug](../examples/ui/overflow_debug.rs) | An example to debug overflow and clipping behavior
365365
[Relative Cursor Position](../examples/ui/relative_cursor_position.rs) | Showcases the RelativeCursorPosition component
366366
[Size Constraints](../examples/ui/size_constraints.rs) | Demonstrates how the to use the size constraints to control the size of a UI node.
367-
[System Fonts](../examples/ui/system_fonts.rs) | Demonstrates using system fonts.
368367
[Text](../examples/ui/text.rs) | Illustrates creating and updating text
369368
[Text Debug](../examples/ui/text_debug.rs) | An example for debugging text layout
370369
[Text Wrap Debug](../examples/ui/text_wrap_debug.rs) | Demonstrates text wrapping

0 commit comments

Comments
 (0)