Adding TextBounds to Text2d causes weird offsets #18789
Labels
A-Text
Rendering and layout for characters
C-Bug
An unexpected or incorrect behavior
S-Needs-Investigation
This issue requires detective work to figure out what's going wrong
Bevy 0.15.3; Rust 1.86.0; macOS 15.3.2.
AdapterInfo { name: "Apple M3 Max", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
Initial discussion in #18679 and might be related to #12319.
I wanted to draw a 2d shape such as a square and have some text centred, vertically and horizontally, on top of the shape. Using code such as:
I was expecting the text to be centred, however the
TextBounds
component, especially combined with wrapping, appears to be adding weird offsets depending on the length of the string, the length of words within the string, and where the line breaks can be inserted.This image shows the output of my reproducer code:

The code to reproduce this image (without the annotations):
The text was updated successfully, but these errors were encountered: