paperforge-layout 0.1.0

High-level document layout engine
Documentation
use paperforge_core::Color;

use crate::element::{Align, Paragraph};

pub struct ParagraphBuilder {
    paragraph: Paragraph,
}

impl ParagraphBuilder {
    pub fn new(text: &str) -> Self {
        Self {
            paragraph: Paragraph::new(text),
        }
    }

    pub fn align(mut self, align: Align) -> Self {
        self.paragraph.align = align;
        self
    }

    pub fn font_size(mut self, size: f64) -> Self {
        self.paragraph.font_size = size;
        self
    }

    pub fn color(mut self, color: Color) -> Self {
        self.paragraph.color = color;
        self
    }

    pub fn line_spacing(mut self, spacing: f64) -> Self {
        self.paragraph.line_spacing = spacing;
        self
    }

    pub fn build(self) -> Paragraph {
        self.paragraph
    }
}