-
Hello everyone, I'm writing a small program, is there any way to render text into a specified rectangle? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
To render text there is the Label widget. To constrain the size of the widget, there is the Ui::add_sized method. To specify the size and the position on the screen (instead of just placing it right after the preceding widget), there's the Ui::put method. If the text does not fit in the rectangle, you can use Label::wrap and Label::truncate to define how it should be rendered. |
Beta Was this translation helpful? Give feedback.
-
Use https://docs.rs/egui/latest/egui/struct.Painter.html#method.text with |
Beta Was this translation helpful? Give feedback.
Use https://docs.rs/egui/latest/egui/struct.Painter.html#method.text with
Align2::CENTER_CENTER
andrect.center