diff options
| author | Laurenz <laurmaedje@gmail.com> | 2019-06-22 12:51:06 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2019-06-22 12:51:06 +0200 |
| commit | c7ee2b393a369325b3578557e045f2ff94ceab8f (patch) | |
| tree | 063e371b764b119e378644817cc556c397ebd9dd /src/layout/text.rs | |
| parent | f6fe3b5cdd2805f3975985752f9cb0e04e3daf49 (diff) | |
Fix top-left text alignment 📐
Diffstat (limited to 'src/layout/text.rs')
| -rw-r--r-- | src/layout/text.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/layout/text.rs b/src/layout/text.rs index 8aa76c4c..0a0241a0 100644 --- a/src/layout/text.rs +++ b/src/layout/text.rs @@ -1,6 +1,6 @@ //! Layouting of text into boxes. -use crate::doc::TextAction; +use crate::doc::LayoutAction; use crate::font::FontQuery; use crate::size::{Size, Size2D}; use super::*; @@ -39,11 +39,11 @@ pub fn layout(text: &str, ctx: &TextContext) -> LayoutResult<BoxLayout> { // Change the font if necessary. if active_font != index { if !buffer.is_empty() { - actions.push(TextAction::WriteText(buffer)); + actions.push(LayoutAction::WriteText(buffer)); buffer = String::new(); } - actions.push(TextAction::SetFont(index, ctx.style.font_size)); + actions.push(LayoutAction::SetFont(index, ctx.style.font_size)); active_font = index; } @@ -52,11 +52,11 @@ pub fn layout(text: &str, ctx: &TextContext) -> LayoutResult<BoxLayout> { // Write the remaining characters. if !buffer.is_empty() { - actions.push(TextAction::WriteText(buffer)); + actions.push(LayoutAction::WriteText(buffer)); } Ok(BoxLayout { - dimensions: Size2D::new(width, Size::points(ctx.style.font_size)), + dimensions: Size2D::new(width, Size::pt(ctx.style.font_size)), actions, }) } |
