diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-01-24 16:23:57 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-01-24 16:23:57 +0100 |
| commit | 0a087cd28bbee5fcdffbb9d49b0ba9f413ad7f92 (patch) | |
| tree | fe00c96969ed2ee69e6d3b42de8ff2558f792edd /src/layout/text.rs | |
| parent | 03fddaf3aea778057aedd74dbcb27bae971ec22f (diff) | |
Reorganize modules 🧱
Diffstat (limited to 'src/layout/text.rs')
| -rw-r--r-- | src/layout/text.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/layout/text.rs b/src/layout/text.rs index 16ae93da..eb598e2f 100644 --- a/src/layout/text.rs +++ b/src/layout/text.rs @@ -6,12 +6,14 @@ use crate::style::TextStyle; use super::*; -/// Layouts text into a box. -/// -/// There is no complex layout involved. The text is simply laid out left- -/// to-right using the correct font for each character. -pub async fn layout_text(text: &str, ctx: TextContext<'_, '_>) -> Layout { - TextLayouter::new(text, ctx).layout().await +/// Layouts text into boxes. +struct TextLayouter<'a, 'p> { + ctx: TextContext<'a, 'p>, + text: &'a str, + actions: LayoutActions, + buffer: String, + active_font: FontIndex, + width: Size, } /// The context for text layouting. @@ -25,14 +27,12 @@ pub struct TextContext<'a, 'p> { pub alignment: LayoutAlignment, } -/// Layouts text into boxes. -struct TextLayouter<'a, 'p> { - ctx: TextContext<'a, 'p>, - text: &'a str, - actions: LayoutActions, - buffer: String, - active_font: FontIndex, - width: Size, +/// Layouts text into a box. +/// +/// There is no complex layout involved. The text is simply laid out left- +/// to-right using the correct font for each character. +pub async fn layout_text(text: &str, ctx: TextContext<'_, '_>) -> Layout { + TextLayouter::new(text, ctx).layout().await } impl<'a, 'p> TextLayouter<'a, 'p> { |
