Skip to main content

rdocx_layout/
lib.rs

1//! Layout engine for converting DOCX flow model to positioned page frames.
2//!
3//! This crate implements style resolution, font loading, text shaping,
4//! line breaking, block/table layout, and pagination to produce
5//! [`LayoutResult`] containing [`PageFrame`]s with absolutely-positioned elements.
6
7#![allow(non_camel_case_types)]
8#![allow(clippy::too_many_arguments)]
9
10pub mod block;
11pub mod bundled_fonts;
12pub mod engine;
13pub mod error;
14pub mod font;
15pub mod input;
16pub mod line;
17pub mod output;
18pub mod paginator;
19pub mod style_resolver;
20pub mod table;
21
22pub use error::{LayoutError, Result};
23pub use input::{FontFile, ImageData, LayoutInput};
24pub use output::{
25    Color, DocumentMetadata, FontData, FontId, GlyphRun, LayoutResult, PageFrame, Point,
26    PositionedElement, Rect,
27};
28
29/// Lay out a complete DOCX document, producing positioned page frames.
30pub fn layout_document(input: &LayoutInput) -> Result<LayoutResult> {
31    engine::Engine::new().layout(input)
32}