1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Improve various documentation

This commit is contained in:
Emil Ernerfeldt
2021-05-20 22:09:35 +02:00
parent 5b462197fa
commit 085233f907
5 changed files with 33 additions and 6 deletions

View File

@@ -341,20 +341,23 @@ impl Font {
self.finalize_galley(galley)
}
/// Always returns at least one row.
/// Will line break at `\n`.
///
/// Always returns at least one row.
pub fn layout_no_wrap(&self, text: String) -> Galley {
self.layout_multiline(text, f32::INFINITY)
}
/// Will wrap text at the given width and line break at `\n`.
///
/// 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)
}
/// * `first_row_indentation`: extra space before the very first character (in points).
/// * `max_width_in_points`: wrapping width.
///
/// Always returns at least one row.
pub fn layout_multiline_with_indentation_and_max_width(
&self,

View File

@@ -315,8 +315,9 @@ impl Fonts {
self.fonts[&text_style].row_height()
}
/// Always returns at least one row.
/// Will line break at `\n`.
///
/// Always returns at least one row.
pub fn layout_no_wrap(&self, text_style: TextStyle, text: String) -> Arc<Galley> {
self.layout_multiline(text_style, text, f32::INFINITY)
}
@@ -338,8 +339,9 @@ impl Fonts {
)
}
/// Will wrap text at the given width and line break at `\n`.
///
/// Always returns at least one row.
/// Will wrap text at the given width.
pub fn layout_multiline(
&self,
text_style: TextStyle,
@@ -356,6 +358,7 @@ impl Fonts {
/// * `first_row_indentation`: extra space before the very first character (in points).
/// * `max_width_in_points`: wrapping width.
///
/// Always returns at least one row.
pub fn layout_multiline_with_indentation_and_max_width(
&self,