From 416d269f978826cef860a9e7ad1eec5888a637ea Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Sat, 25 Oct 2025 13:07:55 +0100 Subject: [PATCH 1/7] Added a new `RunGeometry` struct to replace the tuple structs used to store each run's bounds and decoration geometry. Renamed `TextLayoutInfo::section_geometry` to `TextLayoutInfo::run_geometry`. --- crates/bevy_sprite_render/src/text2d/mod.rs | 36 ++++---- crates/bevy_text/src/pipeline.rs | 87 +++++++++++++++---- crates/bevy_ui_render/src/lib.rs | 47 +++------- ...fo_section_geometry_is_now_run_geometry.md | 6 ++ 4 files changed, 105 insertions(+), 71 deletions(-) create mode 100644 release-content/migration-guides/text_layout_info_section_geometry_is_now_run_geometry.md diff --git a/crates/bevy_sprite_render/src/text2d/mod.rs b/crates/bevy_sprite_render/src/text2d/mod.rs index 74e6a69823b5a..a2acc718cf086 100644 --- a/crates/bevy_sprite_render/src/text2d/mod.rs +++ b/crates/bevy_sprite_render/src/text2d/mod.rs @@ -71,13 +71,13 @@ pub fn extract_text2d_sprite( let top_left = (Anchor::TOP_LEFT.0 - anchor.as_vec()) * size; - for &(section_index, rect, _, _, _) in text_layout_info.section_geometry.iter() { - let section_entity = computed_block.entities()[section_index].entity; + for run in text_layout_info.run_geometry.iter() { + let section_entity = computed_block.entities()[run.span_index].entity; let Ok(text_background_color) = text_background_colors_query.get(section_entity) else { continue; }; let render_entity = commands.spawn(TemporaryRenderEntity).id(); - let offset = Vec2::new(rect.center().x, -rect.center().y); + let offset = Vec2::new(run.rect.center().x, -run.rect.center().y); let transform = *global_transform * GlobalTransform::from_translation(top_left.extend(0.)) * scaling @@ -94,7 +94,7 @@ pub fn extract_text2d_sprite( anchor: Vec2::ZERO, rect: None, scaling_mode: None, - custom_size: Some(rect.size()), + custom_size: Some(run.rect.size()), }, }); } @@ -149,10 +149,8 @@ pub fn extract_text2d_sprite( end += 1; } - for &(section_index, rect, strikethrough_y, stroke, underline_y) in - text_layout_info.section_geometry.iter() - { - let section_entity = computed_block.entities()[section_index].entity; + for run in text_layout_info.run_geometry.iter() { + let section_entity = computed_block.entities()[run.span_index].entity; let Ok((_, has_strikethrough, has_underline)) = decoration_query.get(section_entity) else { @@ -161,7 +159,7 @@ pub fn extract_text2d_sprite( if has_strikethrough { let render_entity = commands.spawn(TemporaryRenderEntity).id(); - let offset = Vec2::new(rect.center().x, -strikethrough_y - 0.5 * stroke); + let offset = run.strikethrough_position() * Vec2::new(1., -1.); let transform = shadow_transform * GlobalTransform::from_translation(offset.extend(0.)); extracted_sprites.sprites.push(ExtractedSprite { @@ -176,14 +174,14 @@ pub fn extract_text2d_sprite( anchor: Vec2::ZERO, rect: None, scaling_mode: None, - custom_size: Some(Vec2::new(rect.size().x, stroke)), + custom_size: Some(run.strikethrough_size()), }, }); } if has_underline { let render_entity = commands.spawn(TemporaryRenderEntity).id(); - let offset = Vec2::new(rect.center().x, -underline_y - 0.5 * stroke); + let offset = run.strikethrough_position() * Vec2::new(1., -1.); let transform = shadow_transform * GlobalTransform::from_translation(offset.extend(0.)); extracted_sprites.sprites.push(ExtractedSprite { @@ -198,7 +196,7 @@ pub fn extract_text2d_sprite( anchor: Vec2::ZERO, rect: None, scaling_mode: None, - custom_size: Some(Vec2::new(rect.size().x, stroke)), + custom_size: Some(run.strikethrough_size()), }, }); } @@ -266,10 +264,8 @@ pub fn extract_text2d_sprite( end += 1; } - for &(section_index, rect, strikethrough_y, stroke, underline_y) in - text_layout_info.section_geometry.iter() - { - let section_entity = computed_block.entities()[section_index].entity; + for run in text_layout_info.run_geometry.iter() { + let section_entity = computed_block.entities()[run.span_index].entity; let Ok((text_color, has_strike_through, has_underline)) = decoration_query.get(section_entity) else { @@ -277,7 +273,7 @@ pub fn extract_text2d_sprite( }; if has_strike_through { let render_entity = commands.spawn(TemporaryRenderEntity).id(); - let offset = Vec2::new(rect.center().x, -strikethrough_y - 0.5 * stroke); + let offset = run.strikethrough_position() * Vec2::new(1., -1.); let transform = *global_transform * GlobalTransform::from_translation(top_left.extend(0.)) * scaling @@ -294,14 +290,14 @@ pub fn extract_text2d_sprite( anchor: Vec2::ZERO, rect: None, scaling_mode: None, - custom_size: Some(Vec2::new(rect.size().x, stroke)), + custom_size: Some(run.strikethrough_size()), }, }); } if has_underline { let render_entity = commands.spawn(TemporaryRenderEntity).id(); - let offset = Vec2::new(rect.center().x, -underline_y - 0.5 * stroke); + let offset = run.underline_position() * Vec2::new(1., -1.); let transform = *global_transform * GlobalTransform::from_translation(top_left.extend(0.)) * scaling @@ -318,7 +314,7 @@ pub fn extract_text2d_sprite( anchor: Vec2::ZERO, rect: None, scaling_mode: None, - custom_size: Some(Vec2::new(rect.size().x, stroke)), + custom_size: Some(run.underline_size()), }, }); } diff --git a/crates/bevy_text/src/pipeline.rs b/crates/bevy_text/src/pipeline.rs index 7f267e52020c6..a61df195f0fc1 100644 --- a/crates/bevy_text/src/pipeline.rs +++ b/crates/bevy_text/src/pipeline.rs @@ -238,7 +238,7 @@ impl TextPipeline { swash_cache: &mut SwashCache, ) -> Result<(), TextError> { layout_info.glyphs.clear(); - layout_info.section_geometry.clear(); + layout_info.run_geometry.clear(); layout_info.size = Default::default(); // Clear this here at the focal point of text rendering to ensure the field's lifecycle has strong boundaries. @@ -305,18 +305,20 @@ impl TextPipeline { match current_section { Some(section) => { if section != layout_glyph.metadata { - layout_info.section_geometry.push(( - section, - Rect::new( + layout_info.run_geometry.push(RunGeometry { + span_index: section, + rect: Rect::new( start, run.line_top, end, run.line_top + run.line_height, ), - (run.line_y - self.glyph_info[section].3).round(), - self.glyph_info[section].4, - (run.line_y - self.glyph_info[section].5).round(), - )); + strikethrough_y: (run.line_y - self.glyph_info[section].3) + .round(), + strikethrough_thickness: self.glyph_info[section].4, + underline_y: (run.line_y - self.glyph_info[section].5).round(), + underline_thickness: self.glyph_info[section].4, + }); start = end.max(layout_glyph.x); current_section = Some(layout_glyph.metadata); } @@ -401,13 +403,14 @@ impl TextPipeline { Ok(()) }); if let Some(section) = current_section { - layout_info.section_geometry.push(( - section, - Rect::new(start, run.line_top, end, run.line_top + run.line_height), - (run.line_y - self.glyph_info[section].3).round(), - self.glyph_info[section].4, - (run.line_y - self.glyph_info[section].5).round(), - )); + layout_info.run_geometry.push(RunGeometry { + span_index: section, + rect: Rect::new(start, run.line_top, end, run.line_top + run.line_height), + strikethrough_y: (run.line_y - self.glyph_info[section].3).round(), + strikethrough_thickness: self.glyph_info[section].4, + underline_y: (run.line_y - self.glyph_info[section].5).round(), + underline_thickness: self.glyph_info[section].4, + }); } result @@ -487,13 +490,61 @@ pub struct TextLayoutInfo { pub scale_factor: f32, /// Scaled and positioned glyphs in screenspace pub glyphs: Vec, - /// Geometry of each text segment: (section index, bounding rect, strikethrough offset, stroke thickness, underline offset) - /// A text section spanning more than one line will have multiple segments. - pub section_geometry: Vec<(usize, Rect, f32, f32, f32)>, + /// Geometry of each text run used to render text decorations like background colors, strikethrough, and underline. + /// A run in bevy_text is a contiguous sequence of glyphs on a line that share the same text attributes like `Font`, + /// `TextColor`, and `LineHeight`. + pub run_geometry: Vec, /// The glyphs resulting size pub size: Vec2, } +/// Geometry of a text run used to render text decorations like background colors, strikethrough, and underline. +/// A run in bevy_text is a contiguous sequence of glyphs on a line that share the same text attributes like `Font`, +/// `TextColor`, and `LineHeight`. +#[derive(Default, Debug, Clone, Reflect)] +pub struct RunGeometry { + /// The index of the text entity in [`ComputedTextBlock`] that this run belongs to. + pub span_index: usize, + /// Bounding box around the text run + pub rect: Rect, + /// Y position of the strikethrough in the text layout. + pub strikethrough_y: f32, + /// Strikethrough stroke thickness. + pub strikethrough_thickness: f32, + /// Y position of the underline in the text layout. + pub underline_y: f32, + /// Underline stroke thickness. + pub underline_thickness: f32, +} + +impl RunGeometry { + /// Returns the center of the strikethrough in the text layout. + pub fn strikethrough_position(&self) -> Vec2 { + Vec2::new( + self.rect.center().x, + self.strikethrough_y + 0.5 * self.strikethrough_thickness, + ) + } + + /// Returns the size of the strikethrough. + pub fn strikethrough_size(&self) -> Vec2 { + Vec2::new(self.rect.size().x, self.strikethrough_thickness) + } + + /// Get the center of the underline in the text layout. + pub fn underline_position(&self) -> Vec2 { + Vec2::new( + self.rect.center().x, + self.underline_y + 0.5 * self.underline_thickness, + ) + } + + /// Returns the size of the underline. + pub fn underline_size(&self) -> Vec2 { + Vec2::new(self.rect.size().x, self.underline_thickness) + } +} + /// Size information for a corresponding [`ComputedTextBlock`] component. /// /// Generated via [`TextPipeline::create_text_measure`]. diff --git a/crates/bevy_ui_render/src/lib.rs b/crates/bevy_ui_render/src/lib.rs index 209dc84a9eec9..56fc9305a9d5e 100644 --- a/crates/bevy_ui_render/src/lib.rs +++ b/crates/bevy_ui_render/src/lib.rs @@ -1094,10 +1094,8 @@ pub fn extract_text_shadows( end += 1; } - for &(section_index, rect, strikethrough_y, stroke, underline_y) in - text_layout_info.section_geometry.iter() - { - let section_entity = computed_block.entities()[section_index].entity; + for run in text_layout_info.run_geometry.iter() { + let section_entity = computed_block.entities()[run.span_index].entity; let Ok((has_strikethrough, has_underline)) = text_decoration_query.get(section_entity) else { continue; @@ -1111,15 +1109,12 @@ pub fn extract_text_shadows( image: AssetId::default(), extracted_camera_entity, transform: node_transform - * Affine2::from_translation(Vec2::new( - rect.center().x, - strikethrough_y + 0.5 * stroke, - )), + * Affine2::from_translation(run.strikethrough_position()), item: ExtractedUiItem::Node { color: shadow.color.into(), rect: Rect { min: Vec2::ZERO, - max: Vec2::new(rect.size().x, stroke), + max: run.strikethrough_size(), }, atlas_scaling: None, flip_x: false, @@ -1139,16 +1134,12 @@ pub fn extract_text_shadows( clip: clip.map(|clip| clip.clip), image: AssetId::default(), extracted_camera_entity, - transform: node_transform - * Affine2::from_translation(Vec2::new( - rect.center().x, - underline_y + 0.5 * stroke, - )), + transform: node_transform * Affine2::from_translation(run.underline_position()), item: ExtractedUiItem::Node { color: shadow.color.into(), rect: Rect { min: Vec2::ZERO, - max: Vec2::new(rect.size().x, stroke), + max: run.underline_size(), }, atlas_scaling: None, flip_x: false, @@ -1211,10 +1202,8 @@ pub fn extract_text_decorations( let transform = Affine2::from(global_transform) * Affine2::from_translation(-0.5 * uinode.size()); - for &(section_index, rect, strikethrough_y, stroke, underline_y) in - text_layout_info.section_geometry.iter() - { - let section_entity = computed_block.entities()[section_index].entity; + for run in text_layout_info.run_geometry.iter() { + let section_entity = computed_block.entities()[run.span_index].entity; let Ok(((text_background_color, maybe_strikethrough, maybe_underline), text_color)) = text_background_colors_query.get(section_entity) else { @@ -1228,12 +1217,12 @@ pub fn extract_text_decorations( clip: clip.map(|clip| clip.clip), image: AssetId::default(), extracted_camera_entity, - transform: transform * Affine2::from_translation(rect.center()), + transform: transform * Affine2::from_translation(run.rect.center()), item: ExtractedUiItem::Node { color: text_background_color.0.to_linear(), rect: Rect { min: Vec2::ZERO, - max: rect.size(), + max: run.rect.size(), }, atlas_scaling: None, flip_x: false, @@ -1253,16 +1242,12 @@ pub fn extract_text_decorations( clip: clip.map(|clip| clip.clip), image: AssetId::default(), extracted_camera_entity, - transform: transform - * Affine2::from_translation(Vec2::new( - rect.center().x, - strikethrough_y + 0.5 * stroke, - )), + transform: transform * Affine2::from_translation(run.strikethrough_position()), item: ExtractedUiItem::Node { color: text_color.0.to_linear(), rect: Rect { min: Vec2::ZERO, - max: Vec2::new(rect.size().x, stroke), + max: run.strikethrough_size(), }, atlas_scaling: None, flip_x: false, @@ -1282,16 +1267,12 @@ pub fn extract_text_decorations( clip: clip.map(|clip| clip.clip), image: AssetId::default(), extracted_camera_entity, - transform: transform - * Affine2::from_translation(Vec2::new( - rect.center().x, - underline_y + 0.5 * stroke, - )), + transform: transform * Affine2::from_translation(run.underline_position()), item: ExtractedUiItem::Node { color: text_color.0.to_linear(), rect: Rect { min: Vec2::ZERO, - max: Vec2::new(rect.size().x, stroke), + max: run.underline_size(), }, atlas_scaling: None, flip_x: false, diff --git a/release-content/migration-guides/text_layout_info_section_geometry_is_now_run_geometry.md b/release-content/migration-guides/text_layout_info_section_geometry_is_now_run_geometry.md new file mode 100644 index 0000000000000..2a0b5fad8fec9 --- /dev/null +++ b/release-content/migration-guides/text_layout_info_section_geometry_is_now_run_geometry.md @@ -0,0 +1,6 @@ +--- +title: "`TextLayoutInfo`'s `section_geometry` field is now `run_geometry`" +pull_requests: [] +--- + +`TextLayoutInfo`'s `section_geometry` field is renamed to `run_geometry` and its `Vec` now contains a list of `RunGeometry`s instead of tuples. From 797f24e8a378121656eff1e4658c84bff18cebe3 Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Sat, 25 Oct 2025 13:09:27 +0100 Subject: [PATCH 2/7] Renamed `rect` field to `bounds` --- crates/bevy_sprite_render/src/text2d/mod.rs | 4 ++-- crates/bevy_text/src/pipeline.rs | 14 +++++++------- crates/bevy_ui_render/src/lib.rs | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/crates/bevy_sprite_render/src/text2d/mod.rs b/crates/bevy_sprite_render/src/text2d/mod.rs index a2acc718cf086..6830c9c972969 100644 --- a/crates/bevy_sprite_render/src/text2d/mod.rs +++ b/crates/bevy_sprite_render/src/text2d/mod.rs @@ -77,7 +77,7 @@ pub fn extract_text2d_sprite( continue; }; let render_entity = commands.spawn(TemporaryRenderEntity).id(); - let offset = Vec2::new(run.rect.center().x, -run.rect.center().y); + let offset = Vec2::new(run.bounds.center().x, -run.bounds.center().y); let transform = *global_transform * GlobalTransform::from_translation(top_left.extend(0.)) * scaling @@ -94,7 +94,7 @@ pub fn extract_text2d_sprite( anchor: Vec2::ZERO, rect: None, scaling_mode: None, - custom_size: Some(run.rect.size()), + custom_size: Some(run.bounds.size()), }, }); } diff --git a/crates/bevy_text/src/pipeline.rs b/crates/bevy_text/src/pipeline.rs index a61df195f0fc1..7c29d112b90cb 100644 --- a/crates/bevy_text/src/pipeline.rs +++ b/crates/bevy_text/src/pipeline.rs @@ -307,7 +307,7 @@ impl TextPipeline { if section != layout_glyph.metadata { layout_info.run_geometry.push(RunGeometry { span_index: section, - rect: Rect::new( + bounds: Rect::new( start, run.line_top, end, @@ -405,7 +405,7 @@ impl TextPipeline { if let Some(section) = current_section { layout_info.run_geometry.push(RunGeometry { span_index: section, - rect: Rect::new(start, run.line_top, end, run.line_top + run.line_height), + bounds: Rect::new(start, run.line_top, end, run.line_top + run.line_height), strikethrough_y: (run.line_y - self.glyph_info[section].3).round(), strikethrough_thickness: self.glyph_info[section].4, underline_y: (run.line_y - self.glyph_info[section].5).round(), @@ -506,7 +506,7 @@ pub struct RunGeometry { /// The index of the text entity in [`ComputedTextBlock`] that this run belongs to. pub span_index: usize, /// Bounding box around the text run - pub rect: Rect, + pub bounds: Rect, /// Y position of the strikethrough in the text layout. pub strikethrough_y: f32, /// Strikethrough stroke thickness. @@ -521,27 +521,27 @@ impl RunGeometry { /// Returns the center of the strikethrough in the text layout. pub fn strikethrough_position(&self) -> Vec2 { Vec2::new( - self.rect.center().x, + self.bounds.center().x, self.strikethrough_y + 0.5 * self.strikethrough_thickness, ) } /// Returns the size of the strikethrough. pub fn strikethrough_size(&self) -> Vec2 { - Vec2::new(self.rect.size().x, self.strikethrough_thickness) + Vec2::new(self.bounds.size().x, self.strikethrough_thickness) } /// Get the center of the underline in the text layout. pub fn underline_position(&self) -> Vec2 { Vec2::new( - self.rect.center().x, + self.bounds.center().x, self.underline_y + 0.5 * self.underline_thickness, ) } /// Returns the size of the underline. pub fn underline_size(&self) -> Vec2 { - Vec2::new(self.rect.size().x, self.underline_thickness) + Vec2::new(self.bounds.size().x, self.underline_thickness) } } diff --git a/crates/bevy_ui_render/src/lib.rs b/crates/bevy_ui_render/src/lib.rs index 56fc9305a9d5e..c7c3ff7620671 100644 --- a/crates/bevy_ui_render/src/lib.rs +++ b/crates/bevy_ui_render/src/lib.rs @@ -1217,12 +1217,12 @@ pub fn extract_text_decorations( clip: clip.map(|clip| clip.clip), image: AssetId::default(), extracted_camera_entity, - transform: transform * Affine2::from_translation(run.rect.center()), + transform: transform * Affine2::from_translation(run.bounds.center()), item: ExtractedUiItem::Node { color: text_background_color.0.to_linear(), rect: Rect { min: Vec2::ZERO, - max: run.rect.size(), + max: run.bounds.size(), }, atlas_scaling: None, flip_x: false, From 8fd930e703958e4b7437fe3416cb02167774d516 Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Sat, 25 Oct 2025 13:34:25 +0100 Subject: [PATCH 3/7] Added backticks to comments. --- crates/bevy_text/src/pipeline.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/bevy_text/src/pipeline.rs b/crates/bevy_text/src/pipeline.rs index 7c29d112b90cb..dc22ae21a90a3 100644 --- a/crates/bevy_text/src/pipeline.rs +++ b/crates/bevy_text/src/pipeline.rs @@ -491,16 +491,16 @@ pub struct TextLayoutInfo { /// Scaled and positioned glyphs in screenspace pub glyphs: Vec, /// Geometry of each text run used to render text decorations like background colors, strikethrough, and underline. - /// A run in bevy_text is a contiguous sequence of glyphs on a line that share the same text attributes like `Font`, - /// `TextColor`, and `LineHeight`. + /// A run in `bevy_text` is a contiguous sequence of glyphs on a line that share the same text attributes like font, + /// font size, and line height. A text entity that extends over multiple lines will have multiple corresponding runs. pub run_geometry: Vec, /// The glyphs resulting size pub size: Vec2, } /// Geometry of a text run used to render text decorations like background colors, strikethrough, and underline. -/// A run in bevy_text is a contiguous sequence of glyphs on a line that share the same text attributes like `Font`, -/// `TextColor`, and `LineHeight`. +/// A run in `bevy_text` is a contiguous sequence of glyphs on a line that share the same text attributes like font, +/// font size, and line height. #[derive(Default, Debug, Clone, Reflect)] pub struct RunGeometry { /// The index of the text entity in [`ComputedTextBlock`] that this run belongs to. From cb13154b92d7194e574adb7dca0e078314a519d9 Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Mon, 27 Oct 2025 11:43:15 +0000 Subject: [PATCH 4/7] Updated the migration guide. --- crates/bevy_text/src/pipeline.rs | 2 ++ ...ext_layout_info_section_geometry_is_now_run_geometry.md | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/bevy_text/src/pipeline.rs b/crates/bevy_text/src/pipeline.rs index dc22ae21a90a3..a2dc194e9cc45 100644 --- a/crates/bevy_text/src/pipeline.rs +++ b/crates/bevy_text/src/pipeline.rs @@ -493,6 +493,8 @@ pub struct TextLayoutInfo { /// Geometry of each text run used to render text decorations like background colors, strikethrough, and underline. /// A run in `bevy_text` is a contiguous sequence of glyphs on a line that share the same text attributes like font, /// font size, and line height. A text entity that extends over multiple lines will have multiple corresponding runs. + /// + /// The coordinates are unscaled and relative to the top left corner of the text layout. pub run_geometry: Vec, /// The glyphs resulting size pub size: Vec2, diff --git a/release-content/migration-guides/text_layout_info_section_geometry_is_now_run_geometry.md b/release-content/migration-guides/text_layout_info_section_geometry_is_now_run_geometry.md index 2a0b5fad8fec9..b2ccd939e9b40 100644 --- a/release-content/migration-guides/text_layout_info_section_geometry_is_now_run_geometry.md +++ b/release-content/migration-guides/text_layout_info_section_geometry_is_now_run_geometry.md @@ -1,6 +1,9 @@ --- -title: "`TextLayoutInfo`'s `section_geometry` field is now `run_geometry`" +title: "`TextLayoutInfo`'s `section_rects` field has been replaced with `run_geometry`" pull_requests: [] --- -`TextLayoutInfo`'s `section_geometry` field is renamed to `run_geometry` and its `Vec` now contains a list of `RunGeometry`s instead of tuples. +`TextLayoutInfo`'s `section_rects` field has been removed. +In its place is a new field `run_geometry` that contains the non-glyph layout geometry for a run of glyphs: its span index, bounding rectangle, underline position and thickness, and strikethrough position and thickness. A run in `bevy_text` is a contiguous sequence of glyphs on a line that share the same text attributes like font, font size, and line height. The coordinates stored in `run_geometry` are unscaled and relative to the top left corner of the text layout. + +Unlike the `section_rects` tuples, `RunGeometry` does not include an `Entity` id. To find the corresponding text entity, call the `entities` method on the root text entity’s `ComputedTextBlock` component and use the `span_index` to index into the returned slice. From 1c81dd04138d3806e255349e9fea6506f411b6b6 Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Mon, 27 Oct 2025 11:49:37 +0000 Subject: [PATCH 5/7] Renamed migration guide --- ...xt_layout_info_section_rects_is_replaced_by_run_geometry.md} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename release-content/migration-guides/{text_layout_info_section_geometry_is_now_run_geometry.md => text_layout_info_section_rects_is_replaced_by_run_geometry.md} (75%) diff --git a/release-content/migration-guides/text_layout_info_section_geometry_is_now_run_geometry.md b/release-content/migration-guides/text_layout_info_section_rects_is_replaced_by_run_geometry.md similarity index 75% rename from release-content/migration-guides/text_layout_info_section_geometry_is_now_run_geometry.md rename to release-content/migration-guides/text_layout_info_section_rects_is_replaced_by_run_geometry.md index b2ccd939e9b40..cc57f8937cfaa 100644 --- a/release-content/migration-guides/text_layout_info_section_geometry_is_now_run_geometry.md +++ b/release-content/migration-guides/text_layout_info_section_rects_is_replaced_by_run_geometry.md @@ -4,6 +4,6 @@ pull_requests: [] --- `TextLayoutInfo`'s `section_rects` field has been removed. -In its place is a new field `run_geometry` that contains the non-glyph layout geometry for a run of glyphs: its span index, bounding rectangle, underline position and thickness, and strikethrough position and thickness. A run in `bevy_text` is a contiguous sequence of glyphs on a line that share the same text attributes like font, font size, and line height. The coordinates stored in `run_geometry` are unscaled and relative to the top left corner of the text layout. +In its place is a new field `run_geometry` that contains the non-glyph layout geometry for a run of glyphs: its span index, bounding rectangle, underline position and thickness, and strikethrough position and thickness. A run in `bevy_text` is a contiguous sequence of glyphs on the same line that share the same text attributes like font, font size, and line height. The coordinates stored in `run_geometry` are unscaled and relative to the top left corner of the text layout. Unlike the `section_rects` tuples, `RunGeometry` does not include an `Entity` id. To find the corresponding text entity, call the `entities` method on the root text entity’s `ComputedTextBlock` component and use the `span_index` to index into the returned slice. From 53d0fc558543e896fa04228408d4eca99d135055 Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Mon, 27 Oct 2025 11:51:01 +0000 Subject: [PATCH 6/7] migration guide edit for clarity --- ...ext_layout_info_section_rects_is_replaced_by_run_geometry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-content/migration-guides/text_layout_info_section_rects_is_replaced_by_run_geometry.md b/release-content/migration-guides/text_layout_info_section_rects_is_replaced_by_run_geometry.md index cc57f8937cfaa..0a0a6a07815d5 100644 --- a/release-content/migration-guides/text_layout_info_section_rects_is_replaced_by_run_geometry.md +++ b/release-content/migration-guides/text_layout_info_section_rects_is_replaced_by_run_geometry.md @@ -4,6 +4,6 @@ pull_requests: [] --- `TextLayoutInfo`'s `section_rects` field has been removed. -In its place is a new field `run_geometry` that contains the non-glyph layout geometry for a run of glyphs: its span index, bounding rectangle, underline position and thickness, and strikethrough position and thickness. A run in `bevy_text` is a contiguous sequence of glyphs on the same line that share the same text attributes like font, font size, and line height. The coordinates stored in `run_geometry` are unscaled and relative to the top left corner of the text layout. +In its place is a new field `run_geometry` that contains the non-glyph layout geometry for a run of glyphs: the run's span index, bounding rectangle, underline position and thickness, and strikethrough position and thickness. A run in `bevy_text` is a contiguous sequence of glyphs on the same line that share the same text attributes like font, font size, and line height. The coordinates stored in `run_geometry` are unscaled and relative to the top left corner of the text layout. Unlike the `section_rects` tuples, `RunGeometry` does not include an `Entity` id. To find the corresponding text entity, call the `entities` method on the root text entity’s `ComputedTextBlock` component and use the `span_index` to index into the returned slice. From 19b84484b3c936099af55ce2aa0acdc2dc3e0b2c Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Mon, 27 Oct 2025 11:54:39 +0000 Subject: [PATCH 7/7] Another migration guide edit. --- ...ext_layout_info_section_rects_is_replaced_by_run_geometry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-content/migration-guides/text_layout_info_section_rects_is_replaced_by_run_geometry.md b/release-content/migration-guides/text_layout_info_section_rects_is_replaced_by_run_geometry.md index 0a0a6a07815d5..bbbdfc76cb43c 100644 --- a/release-content/migration-guides/text_layout_info_section_rects_is_replaced_by_run_geometry.md +++ b/release-content/migration-guides/text_layout_info_section_rects_is_replaced_by_run_geometry.md @@ -6,4 +6,4 @@ pull_requests: [] `TextLayoutInfo`'s `section_rects` field has been removed. In its place is a new field `run_geometry` that contains the non-glyph layout geometry for a run of glyphs: the run's span index, bounding rectangle, underline position and thickness, and strikethrough position and thickness. A run in `bevy_text` is a contiguous sequence of glyphs on the same line that share the same text attributes like font, font size, and line height. The coordinates stored in `run_geometry` are unscaled and relative to the top left corner of the text layout. -Unlike the `section_rects` tuples, `RunGeometry` does not include an `Entity` id. To find the corresponding text entity, call the `entities` method on the root text entity’s `ComputedTextBlock` component and use the `span_index` to index into the returned slice. +Unlike the tuples of `section_rects`, `RunGeometry` does not include an `Entity` id. To find the corresponding text entity, call the `entities` method on the root text entity’s `ComputedTextBlock` component and use the `span_index` to index into the returned slice.