diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-08-02 22:05:49 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-08-02 22:05:49 +0200 |
| commit | 266d457292e7461d448f9141030028ea68b573d1 (patch) | |
| tree | ff3ff3cc289d34040db421b6a7faa1f2aa402b05 /src/layout/text.rs | |
| parent | cbbc46215fe0a0ad8a50e991ec442890b8eadc0a (diff) | |
Refactor model into tree 🛒
Diffstat (limited to 'src/layout/text.rs')
| -rw-r--r-- | src/layout/text.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/layout/text.rs b/src/layout/text.rs index 477099e2..5c18cd32 100644 --- a/src/layout/text.rs +++ b/src/layout/text.rs @@ -40,7 +40,7 @@ pub struct TextContext<'a> { } /// Layouts text into a box. -pub async fn layout_text(text: &str, ctx: TextContext<'_>) -> Layout { +pub async fn layout_text(text: &str, ctx: TextContext<'_>) -> BoxLayout { TextLayouter::new(text, ctx).layout().await } @@ -58,7 +58,7 @@ impl<'a> TextLayouter<'a> { } /// Do the layouting. - async fn layout(mut self) -> Layout { + async fn layout(mut self) -> BoxLayout { // If the primary axis is negative, we layout the characters reversed. if self.ctx.axes.primary.is_positive() { for c in self.text.chars() { @@ -76,8 +76,8 @@ impl<'a> TextLayouter<'a> { self.elements.push(pos, LayoutElement::Text(self.shaped)); } - Layout { - dimensions: Size::new(self.width, self.ctx.style.font_size()), + BoxLayout { + size: Size::new(self.width, self.ctx.style.font_size()), align: self.ctx.align, elements: self.elements, } |
