egui/crates
Emil Ernerfeldt cc3b3629b8
Round text galley sizes to nearest ui point size (#4578)
Previously, many labels had non-integer widths. This lead to rounding
errors.

This was most notable for the new `Area` sizing code:

We would run the initial sizing pass, to measure the size of e.g. a
tooltip.
Say the tooltip contains text that was 100.123 ui points wide. With a
16pt border, that becomes 116.123, which is stored in the `Area` state
as the width. The next frame, we use that stored size as the wrapping
width. With perfect precision, we would then tell the label to wrap to
100.123 pts, which the text would _just_ fit in. However, due to
rounding errors we might end up asking it to wrap to 100.12**2** pts,
meaning the last word would now wrap and end up on the next line.

By rounding label sizes to perfect integers, we avoid such rounding
errors, and most ui elements will now end up on perfect integer point
coordinates (and `f32` can precisely express and do arithmetic on all
integers < 2^24).

Visually this has very little impact. Some labels move by a pixel here
and there, mostly for the better.
2024-05-29 18:23:11 +02:00
..
ecolor Move dependencies to workspace (#4495) 2024-05-14 11:02:49 +02:00
eframe Enforce eframe errors are `Send` and `Sync` (#4574) 2024-05-29 13:13:00 +02:00
egui Don't persist `Area` state (#4577) 2024-05-29 15:59:51 +02:00
egui-wgpu Revert update to wgpu 0.20 => downgrade to wgpu 0.19.1 (#4559) 2024-05-28 14:40:43 +02:00
egui-winit Do no use the ahash reimport (#4504) 2024-05-27 16:24:50 +02:00
egui_demo_app Replace some `...` with `…` 2024-05-29 11:48:50 +02:00
egui_demo_lib Replace some `...` with `…` 2024-05-29 11:48:50 +02:00
egui_extras Do no use the ahash reimport (#4504) 2024-05-27 16:24:50 +02:00
egui_glow Do no use the ahash reimport (#4504) 2024-05-27 16:24:50 +02:00
egui_plot Replace some `...` with `…` 2024-05-29 11:48:50 +02:00
egui_web Fix typos (#2866) 2023-04-18 15:52:45 +02:00
emath Add `Ui::is_sizing_pass` for better size estimation of `Area`s, and menus in particular (#4557) 2024-05-29 10:27:04 +02:00
epaint Round text galley sizes to nearest ui point size (#4578) 2024-05-29 18:23:11 +02:00