1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 06:40:06 -04:00

Add justified and/or center- and right-aligned text

Label text will now be centered, right-aligned and/or
justified based on the layout.

Galleys are no longer always pivoted in the left top corner,
so now have a Rect rather than just a size.
This commit is contained in:
Emil Ernerfeldt
2021-09-07 20:37:50 +02:00
parent cbafd10ee4
commit acb5501fe4
23 changed files with 316 additions and 112 deletions

View File

@@ -569,7 +569,7 @@ fn text_layout_ui(ui: &mut egui::Ui) {
let galley = ui.fonts().layout_job(job);
let (response, painter) = ui.allocate_painter(galley.size, Sense::hover());
let (response, painter) = ui.allocate_painter(galley.size(), Sense::hover());
painter.add(Shape::galley(response.rect.min, galley));
ui.vertical_centered(|ui| {