From b15e17587a5ceec9bd0c024b53d506d4fd87d695 Mon Sep 17 00:00:00 2001 From: Valentin Date: Thu, 10 Aug 2023 13:11:56 +0200 Subject: [PATCH] Document when Galleys get invalidated (#3024) --- crates/epaint/src/text/text_layout_types.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/epaint/src/text/text_layout_types.rs b/crates/epaint/src/text/text_layout_types.rs index d6d81d88..28301c85 100644 --- a/crates/epaint/src/text/text_layout_types.rs +++ b/crates/epaint/src/text/text_layout_types.rs @@ -310,7 +310,13 @@ impl Default for TextWrapping { /// /// You can create a [`Galley`] using [`crate::Fonts::layout_job`]; /// -/// This needs to be recreated if `pixels_per_point` (dpi scale) changes. +/// Needs to be recreated if the underlying font atlas texture changes, which +/// happens under the following conditions: +/// - `pixels_per_point` or `max_texture_size` change. These parameters are set +/// in [`crate::text::Fonts::begin_frame`]. When using `egui` they are set +/// from `egui::InputState` and can change at any time. +/// - The atlas has become full. This can happen any time a new glyph is added +/// to the atlas, which in turn can happen any time new text is laid out. #[derive(Clone, Debug, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct Galley {