RTF backend for Dazzle document formatting
This crate implements the FotBuilder trait for RTF (Rich Text Format) output,
which is used for document formatting and print output.
Purpose
The RTF backend generates formatted documents from DSSSL specifications, supporting:
- Paragraphs: Text blocks with formatting
- Character properties: Font, size, weight, posture, color
- Page setup: Margins, size, headers/footers
- Document structure: Sections, page sequences
- Advanced features: Links, tables, lists
Architecture
RtfBackend
├─ output: OutputByteStream (RTF file being written)
├─ font_table: FontTable (font declarations)
├─ color_table: ColorTable (color definitions)
├─ document_props: DocumentProperties (page setup, margins)
└─ flow_stack: Vec<FlowObject> (nested flow object context)
RTF Format Overview
RTF structure:
{\rtf1\ansi\deff0
{\fonttbl...} # Font table
{\colortbl...} # Color table
{\stylesheet...} # Style definitions
\deflang1024 # Document properties
...content... # Paragraphs and text
}
Usage
use RtfBackend;
use FotBuilder;
use File;
let file = create?;
let mut backend = new?;
// Start a paragraph
backend.start_paragraph?;
backend.literal?;
backend.end_paragraph?;
// Finalize and close
backend.finish?;