termcinema-engine 0.1.0

🧠 Core typewriter-style terminal animation engine (SVG renderer) for termcinema
Documentation
/// Layout configuration for the rendering canvas.
///
/// Defines the overall size, spacing, and alignment of the output area.
/// All fields are optional and will fall back to theme or default values.
pub struct LayoutSpec {
    /// Canvas width in **pixels**.
    /// Determines maximum horizontal space for line wrapping and positioning.
    pub width: Option<u32>,

    /// Canvas height in **pixels**.
    /// Determines maximum vertical space for rendering content blocks.
    pub height: Option<u32>,

    /// Optional padding (in pixels) applied to all sides.
    /// Creates spacing between the border and inner content.
    pub padding: Option<u32>,

    /// Optional line spacing between text lines (in pixels).
    /// Affects vertical rhythm and visual readability.
    pub line_spacing: Option<u32>,

    /// Horizontal text alignment:
    /// [`Left`] | [`Center`] | [`Right`].
    /// Applies to each line or block within the canvas.
    pub align: Option<TextAlign>,

    /// Vertical alignment of the entire content block:
    /// [`Top`] | [`Middle`] | [`Bottom`].
    /// Controls placement within the total canvas height.
    pub v_align: Option<VerticalAlign>,
}

/// Horizontal text alignment options.
///
/// Affects how each line of text is positioned within the available width.
#[derive(Clone, Copy)]
pub enum TextAlign {
    /// Align to the left edge (default for most terminals).
    Left,

    /// Centered horizontally.
    Center,

    /// Align to the right edge.
    Right,
}

/// Vertical alignment options for block positioning.
///
/// Determines how the content is placed relative to the canvas height.
#[derive(Debug, Clone)]
pub enum VerticalAlign {
    /// Align to the top (default behavior).
    Top,

    /// Vertically centered.
    Middle,

    /// Align to the bottom.
    Bottom,
}