Skip to main content

lightweight_pdf_layout/
warnings.rs

1//! `plan/05-overflow-and-robustness.md` Grundprinzip 8: diagnostics instead
2//! of silent clipping. Collected during the layout pass and returned
3//! alongside the finished PDF bytes by the facade's
4//! `render_with_diagnostics()`, never separately (InDesign "Overset Text"
5//! anti-pattern).
6
7#[derive(Clone, Copy, PartialEq, Eq, Debug)]
8pub enum LayoutWarningKind {
9    /// Text was cut off because its box was too small (`Overflow::Clip`).
10    TextClipped,
11    /// A container's content overflowed its box and was clipped.
12    ContentOverflow,
13    /// An atomic element bigger than a whole page was forced onto its own
14    /// page and clipped there (Grundprinzip 7).
15    ForcedPageBreak,
16    /// Header/Footer content was taller than its reserved band and got
17    /// clipped (band size is fixed, never grows, ADR-011).
18    HeaderFooterOverflow,
19}
20
21#[derive(Clone, Debug)]
22pub struct LayoutWarning {
23    pub kind: LayoutWarningKind,
24    pub page: usize,
25    pub element_hint: String,
26}