bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Text is cut off in `render_ui_to_texture` example with high scale factors.

Open rparrett opened this issue 1 year ago • 2 comments

Or perhaps a better title is "bevy_ui text rendering always uses the primary window's scale factor, even when rendering to a texture."

Bevy version

9f8db0d

Relevant system information

AdapterInfo { name: "Apple M1 Max", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
SystemInfo { os: "MacOS 13.6.2 ", kernel: "22.6.0", cpu: "", core_count: "10", memory: "64.0 GiB" }

What you did

Have high DPI screen or override scale factor with

.add_plugins(DefaultPlugins.set(WindowPlugin {
    primary_window: Some(Window {
        resolution: WindowResolution::default().with_scale_factor_override(2.),
        ..default()
    }),
    ..default()
}))

cargo run --example render_ui_to_texture

What went wrong

Cube says This is a cu.

Screenshot 2024-01-16 at 3 39 35 PM

Additional information

Related issue: https://github.com/bevyengine/bevy/issues/5621

If it is true that we now generally support "window-independent ui scaling," then it looks like some code in bevy_ui needs to be updated: https://github.com/bevyengine/bevy/blob/39cca41f3f602b19e9c9596e46fc3093bfadd553/crates/bevy_ui/src/widget/text.rs#L234-L238

If not, that issue may need to be reopened, and perhaps this one closed.

rparrett avatar Jan 16 '24 22:01 rparrett

As of https://github.com/bevyengine/bevy/pull/10559, this should probably be thought of as per-camera UI scaling rather than per-window UI scaling.

nicoburns avatar Jan 17 '24 03:01 nicoburns

As far as I can tell, text_system was just missed in #10559.

rparrett avatar Jan 17 '24 03:01 rparrett