From 5d722407ff7bac19b79ddafc705894738ebbf4aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20=C3=96dmark?= Date: Mon, 23 Oct 2023 23:23:04 +0200 Subject: [PATCH] store systemfont atlases in the pipeline --- crates/bevy_text/src/pipeline.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/crates/bevy_text/src/pipeline.rs b/crates/bevy_text/src/pipeline.rs index 0180cab7ce9829..23fd61deb20fb4 100644 --- a/crates/bevy_text/src/pipeline.rs +++ b/crates/bevy_text/src/pipeline.rs @@ -72,10 +72,8 @@ impl Default for SwashCache { pub struct TextPipeline { /// Identifies a font [`ID`](cosmic_text::fontdb::ID) by its [`Font`] [`Asset`](bevy_asset::Asset) [`HandleId`]. map_handle_to_font_id: HashMap, cosmic_text::fontdb::ID>, - /// Identifies a [`FontAtlasSet`] handle by its font [`ID`](cosmic_text::fontdb::ID). - /// - /// Note that this is a strong handle, so that textures are not dropped. - map_font_id_to_handle: HashMap>, + /// Identifies a [`FontAtlasSet`] by its font [`ID`](cosmic_text::fontdb::ID). + map_font_id_to_atlas: HashMap, /// The font system is used to retrieve fonts and their information, including glyph outlines. /// /// See [`cosmic_text::FontSystem`] for more information. @@ -303,12 +301,11 @@ impl TextPipeline { weight: query.weight, metadata: 0, })[0]; - let handle = self - .map_font_id_to_handle + let atlas = self + .map_font_id_to_atlas .entry(font_id) .or_default(); - - font_atlas_sets.get_mut(handle.clone().untyped().id()).unwrap() + atlas } };