diff --git a/crates/bevy_ui/src/render/mod.rs b/crates/bevy_ui/src/render/mod.rs index f2fa85a71f3d59..b6ab3cdacea8b4 100644 --- a/crates/bevy_ui/src/render/mod.rs +++ b/crates/bevy_ui/src/render/mod.rs @@ -640,10 +640,15 @@ pub fn extract_uinode_text( // * Multiply by the rounded physical position by the inverse scale factor to return to logical coordinates let logical_top_left = -0.5 * uinode.size(); - let physical_nearest_pixel = (logical_top_left * scale_factor).round(); - let logical_top_left_nearest_pixel = physical_nearest_pixel * inverse_scale_factor; - let transform = Mat4::from(global_transform.affine()) - * Mat4::from_translation(logical_top_left_nearest_pixel.extend(0.)); + + let mut transform = Mat4::from(global_transform.affine()) + * Mat4::from_translation(logical_top_left.extend(0.)) + * Mat4::from_scale(Vec3::splat(scale_factor)); + + transform.w_axis[0] = transform.w_axis[0].round(); + transform.w_axis[1] = transform.w_axis[1].round(); + + transform = transform * Mat4::from_scale(Vec3::splat(inverse_scale_factor)); let mut color = LinearRgba::WHITE; let mut current_section = usize::MAX;