diff --git a/src/big_text.rs b/src/big_text.rs index e5d8324..e4f6c27 100644 --- a/src/big_text.rs +++ b/src/big_text.rs @@ -96,20 +96,6 @@ impl Widget for BigText<'_> { } } -fn get_alignment_offset<'a>( - area_width: u16, - letter_width: u16, - alignment: Alignment, - line: &'a Line<'a>, -) -> u16 { - let big_line_width = line.width() as u16 * letter_width; - match alignment { - Alignment::Center => (area_width / 2).saturating_sub(big_line_width / 2), - Alignment::Right => area_width.saturating_sub(big_line_width), - Alignment::Left => 0, - } -} - /// Chunk the area into as many x*y cells as possible returned as a 2D iterator of `Rect`s /// representing the rows of cells. The size of each cell depends on given font size fn layout<'a>( @@ -137,6 +123,20 @@ fn layout<'a>( }) } +fn get_alignment_offset<'a>( + area_width: u16, + letter_width: u16, + alignment: Alignment, + line: &'a Line<'a>, +) -> u16 { + let big_line_width = line.width() as u16 * letter_width; + match alignment { + Alignment::Center => (area_width / 2).saturating_sub(big_line_width / 2), + Alignment::Right => area_width.saturating_sub(big_line_width), + Alignment::Left => 0, + } +} + /// Render a single grapheme into a cell by looking up the corresponding 8x8 bitmap in the /// `BITMAPS` array and setting the corresponding cells in the buffer. fn render_symbol(grapheme: StyledGrapheme, area: Rect, buf: &mut Buffer, pixel_size: &PixelSize) {