mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
Widgets will now always line break at \n characters
This commit is contained in:
@@ -275,6 +275,9 @@ impl Font {
|
||||
/// Typeset the given text onto one row.
|
||||
/// Any `\n` will show up as the replacement character.
|
||||
/// Always returns exactly one `Row` in the `Galley`.
|
||||
///
|
||||
/// Most often you probably want `\n` to produce a new row,
|
||||
/// and so [`Self::layout_no_wrap`] may be a better choice.
|
||||
pub fn layout_single_line(&self, text: String) -> Galley {
|
||||
let x_offsets = self.layout_single_row_fragment(&text);
|
||||
let row = Row {
|
||||
@@ -295,6 +298,13 @@ impl Font {
|
||||
}
|
||||
|
||||
/// Always returns at least one row.
|
||||
/// Will line break at `\n`.
|
||||
pub fn layout_no_wrap(&self, text: String) -> Galley {
|
||||
self.layout_multiline(text, f32::INFINITY)
|
||||
}
|
||||
|
||||
/// Always returns at least one row.
|
||||
/// Will wrap text at the given width.
|
||||
pub fn layout_multiline(&self, text: String, max_width_in_points: f32) -> Galley {
|
||||
self.layout_multiline_with_indentation_and_max_width(text, 0.0, max_width_in_points)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user