Skip to content

Line Break doesn't clear trailing whitespace #12319

@TheDudeFromCI

Description

@TheDudeFromCI

Bevy version

0.13.0

[Optional] Relevant system information

AdapterInfo { name: "NVIDIA GeForce GTX 1050 Ti", vendor: 4318, device: 7298, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "545.29.06", backend: Vulkan }
SystemInfo { os: "Linux 23.1.3 Manjaro Linux", kernel: "5.15.148-2-MANJARO", cpu: "Intel(R) Core(TM) i5-4690K CPU @ 3.50GHz", core_count: "4", memory: "31.3 GiB" }

What you did

Create a TextBundle node within a parent NodeBundle of a fixed size. The parent node centers the child node using align_items, align_content, justify_items, and justify_content. The text should contain several words and be set to line break on word boundry. The text is set to justify center.

What went wrong

When the line break occurs, the white space char is kept in the same position. This causes the renderer to include this char in the bounding box and thus shifting the center alignment of the text.

Additional information

This will cause the text to be off-center. The effect can clearly be seen with background colors enabled.

Screenshot_20240305_053132

As you can see in the image above, the space between "Streamline" and "UI" is kept in place, causing the text to be shifted by half a char width to the left.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-TextRendering and layout for charactersA-UIGraphical user interfaces, styles, layouts, and widgetsC-BugAn unexpected or incorrect behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions