1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 22:30:03 -04:00

Stop wrapping FontsImpl in an Arc<Mutex<_>>

We never need to clone it, and none of its methods took `self` as
mutable, meaning it wasn't making use of the semantic difference between
the two.

This API is about to get reworked, and simplifying it is a first step.
This commit is contained in:
valadaptive
2025-07-03 18:21:08 -04:00
parent aedd43c88f
commit bbf9ac4d4b
23 changed files with 106 additions and 105 deletions

View File

@@ -238,7 +238,7 @@ impl ColoredText {
pub fn ui(&self, ui: &mut egui::Ui) {
let mut job = self.0.clone();
job.wrap.max_width = ui.available_width();
let galley = ui.fonts(|f| f.layout_job(job));
let galley = ui.fonts_mut(|f| f.layout_job(job));
ui.add(egui::Label::new(galley).selectable(true));
}
}

View File

@@ -90,7 +90,7 @@ impl FrameHistory {
));
let cpu_usage = to_screen.inverse().transform_pos(pointer_pos).y;
let text = format!("{:.1} ms", 1e3 * cpu_usage);
shapes.push(ui.fonts(|f| {
shapes.push(ui.fonts_mut(|f| {
Shape::text(
f,
pos2(rect.left(), y),